提交 1d254b7d 编写于 作者: J Jesse Glick

Merge pull request #1627 from stephenc/simplify-executors-display

simplify displaying the executors
......@@ -62,6 +62,7 @@ import hudson.util.RunList;
import hudson.util.Futures;
import hudson.util.NamingThreadFactory;
import jenkins.model.Jenkins;
import jenkins.model.queue.AsynchronousExecution;
import jenkins.util.ContextResettingExecutorService;
import jenkins.security.MasterToSlaveCallable;
import org.kohsuke.accmod.Restricted;
......@@ -898,12 +899,16 @@ public /*transient*/ abstract class Computer extends Actionable implements Acces
List<DisplayExecutor> result = new ArrayList<DisplayExecutor>(executors.size()+oneOffExecutors.size());
int index = 0;
for (Executor e: executors) {
result.add(new DisplayExecutor(Integer.toString(index+1), String.format("executors/%d", index), e));
if (e.isDisplayCell()) {
result.add(new DisplayExecutor(Integer.toString(index + 1), String.format("executors/%d", index), e));
}
index++;
}
index = 0;
for (OneOffExecutor e: oneOffExecutors) {
result.add(new DisplayExecutor("", String.format("oneOffExecutors/%d", index), e));
if (e.isDisplayCell()) {
result.add(new DisplayExecutor("", String.format("oneOffExecutors/%d", index), e));
}
index++;
}
return result;
......
......@@ -586,6 +586,17 @@ public class Executor extends Thread implements ModelObject {
}
}
/**
* Returns {@code true} if the {@code executorCell.jelly} for this {@link Executor} should be visible.
*
* @return {@code true} if the {@code executorCell.jelly} for this {@link Executor} should be visible.
* @since 1.607
*/
public boolean isDisplayCell() {
AsynchronousExecution asynchronousExecution = getAsynchronousExecution();
return asynchronousExecution == null || asynchronousExecution.displayCell();
}
/**
* Returns true if this executor is waiting for a task to execute.
*/
......
......@@ -39,8 +39,7 @@ THE SOFTWARE.
<j:if test="${!c.acceptingTasks}"> <st:nbsp/> (${%suspended})</j:if>
</d:tag>
<d:tag name="executor">
<j:set var="ae" value="${e.asynchronousExecution}"/>
<j:if test="${(!c.offline or (c.offline and !e.idle)) and (ae == null || ae.displayCell())}">
<j:if test="${!c.offline or (c.offline and !e.idle)}">
<tr>
<td class="pane" align="right" style="vertical-align: top">
${name}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册