From 3cf4b8f18a7da03373ee8147ff5178cbc0e576f2 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Thu, 9 Sep 2010 22:30:15 +0000 Subject: [PATCH] Made executorCell.jelly customizable per Executable. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@34620 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/model/Queue.java | 5 +++ .../hudson/model/queue/WideJobProperty.java | 27 +++++++++----- .../model/AbstractBuild/executorCell.jelly | 37 +++++++++++++++++++ .../ExecutableImpl/executorCell.jelly | 27 ++++++++++++++ .../model/queue/WideJobProperty/config.jelly | 1 - .../main/resources/lib/hudson/executors.jelly | 14 ++----- 6 files changed, 89 insertions(+), 22 deletions(-) create mode 100644 core/src/main/resources/hudson/model/AbstractBuild/executorCell.jelly create mode 100644 core/src/main/resources/hudson/model/queue/WideJobProperty/ExecutableImpl/executorCell.jelly diff --git a/core/src/main/java/hudson/model/Queue.java b/core/src/main/java/hudson/model/Queue.java index 5541a6aef5..bbadec526a 100644 --- a/core/src/main/java/hudson/model/Queue.java +++ b/core/src/main/java/hudson/model/Queue.java @@ -1126,6 +1126,11 @@ public class Queue extends ResourceController implements Saveable { /** * Represents the real meet of the computation run by {@link Executor}. + * + *

Views

+ *

+ * Implementation must have executorCell.jelly, which is + * used to render the HTML that indicates this executable is executing. */ public interface Executable extends Runnable { /** diff --git a/core/src/main/java/hudson/model/queue/WideJobProperty.java b/core/src/main/java/hudson/model/queue/WideJobProperty.java index 58e0e59774..d7ed0165f0 100644 --- a/core/src/main/java/hudson/model/queue/WideJobProperty.java +++ b/core/src/main/java/hudson/model/queue/WideJobProperty.java @@ -53,17 +53,8 @@ public class WideJobProperty extends JobProperty> { List r = new ArrayList(); for (int i=1; i< weight; i++) r.add(new AbstractSubTask() { - private final AbstractSubTask outerThis = this; public Executable createExecutable() throws IOException { - return new Executable() { - public SubTask getParent() { - return outerThis; - } - - public void run() { - // nothing. we just waste time - } - }; + return new ExecutableImpl(this); } @Override @@ -99,4 +90,20 @@ public class WideJobProperty extends JobProperty> { return "This project occupies multiple executors"; } } + + private static class ExecutableImpl implements Executable { + private final SubTask parent; + + private ExecutableImpl(SubTask parent) { + this.parent = parent; + } + + public SubTask getParent() { + return parent; + } + + public void run() { + // nothing. we just waste time + } + } } diff --git a/core/src/main/resources/hudson/model/AbstractBuild/executorCell.jelly b/core/src/main/resources/hudson/model/AbstractBuild/executorCell.jelly new file mode 100644 index 0000000000..5f27dcf253 --- /dev/null +++ b/core/src/main/resources/hudson/model/AbstractBuild/executorCell.jelly @@ -0,0 +1,37 @@ + + + +

${%Building} + + + ${it.parent.fullDisplayName} #${it.number} + + + + ${%Unknown Task} + + +
+ diff --git a/core/src/main/resources/hudson/model/queue/WideJobProperty/ExecutableImpl/executorCell.jelly b/core/src/main/resources/hudson/model/queue/WideJobProperty/ExecutableImpl/executorCell.jelly new file mode 100644 index 0000000000..98fb70a87e --- /dev/null +++ b/core/src/main/resources/hudson/model/queue/WideJobProperty/ExecutableImpl/executorCell.jelly @@ -0,0 +1,27 @@ + + + + Occupied + diff --git a/core/src/main/resources/hudson/model/queue/WideJobProperty/config.jelly b/core/src/main/resources/hudson/model/queue/WideJobProperty/config.jelly index 59ec549999..64cdd1f258 100644 --- a/core/src/main/resources/hudson/model/queue/WideJobProperty/config.jelly +++ b/core/src/main/resources/hudson/model/queue/WideJobProperty/config.jelly @@ -21,7 +21,6 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. --> - diff --git a/core/src/main/resources/lib/hudson/executors.jelly b/core/src/main/resources/lib/hudson/executors.jelly index 4e1cec1137..3134577f7f 100644 --- a/core/src/main/resources/lib/hudson/executors.jelly +++ b/core/src/main/resources/lib/hudson/executors.jelly @@ -66,17 +66,9 @@ THE SOFTWARE. -
${%Building} - - - ${e.currentExecutable.parent.fullDisplayName} #${e.currentExecutable.number} - - - - ${%Unknown Task} - - -
+ + +