From e0971a53055aa4a22039c19a712985c95adcdd21 Mon Sep 17 00:00:00 2001 From: kohsuke Date: Sun, 1 Mar 2009 03:28:33 +0000 Subject: [PATCH] [FIXED HUDSON-3152] In 1.288. Builds blocked by the shut-down process now reports its status accordingly. git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@15916 71c3de6d-444a-0410-be80-ed276b4c234a --- core/src/main/java/hudson/Functions.java | 9 +++++ core/src/main/java/hudson/model/Queue.java | 5 ++- .../hudson/model/Messages.properties | 1 + .../widgets/BuildHistoryWidget/entries.jelly | 37 ++++++++++--------- 4 files changed, 34 insertions(+), 18 deletions(-) diff --git a/core/src/main/java/hudson/Functions.java b/core/src/main/java/hudson/Functions.java index 58fcfeca68..28b3674af0 100644 --- a/core/src/main/java/hudson/Functions.java +++ b/core/src/main/java/hudson/Functions.java @@ -1074,6 +1074,15 @@ public class Functions { } } + /** + * Prepend a prefix only when there's the specified body. + */ + public String prepend(String prefix, String body) { + if(body!=null && body.length()>0) + return prefix+body; + return body; + } + private static final Pattern SCHEME = Pattern.compile("[a-z]+://.+"); /** diff --git a/core/src/main/java/hudson/model/Queue.java b/core/src/main/java/hudson/model/Queue.java index 7ed8f910a0..7e922a64f1 100644 --- a/core/src/main/java/hudson/model/Queue.java +++ b/core/src/main/java/hudson/model/Queue.java @@ -1063,8 +1063,11 @@ public class Queue extends ResourceController implements Saveable { @Override public String getWhy() { - Label label = task.getAssignedLabel(); Hudson hudson = Hudson.getInstance(); + if(hudson.isQuietingDown()) + return Messages.Queue_HudsonIsAboutToShutDown(); + + Label label = task.getAssignedLabel(); if (hudson.getNodes().isEmpty()) label = null; // no master/slave. pointless to talk about nodes diff --git a/core/src/main/resources/hudson/model/Messages.properties b/core/src/main/resources/hudson/model/Messages.properties index f7c3bdb7fc..df7e5e6b7b 100644 --- a/core/src/main/resources/hudson/model/Messages.properties +++ b/core/src/main/resources/hudson/model/Messages.properties @@ -113,6 +113,7 @@ Job.minutes=mins Queue.AllNodesOffline=All nodes of label ''{0}'' are offline Queue.BlockedBy=Blocked by {0} +Queue.HudsonIsAboutToShutDown=Hudson is about to shut down Queue.InProgress=A build is already in progress Queue.InQuietPeriod=In the quiet period. Expires in {0} Queue.NodeOffline={0} is offline diff --git a/core/src/main/resources/hudson/widgets/BuildHistoryWidget/entries.jelly b/core/src/main/resources/hudson/widgets/BuildHistoryWidget/entries.jelly index 65a81856f4..687ed4b420 100644 --- a/core/src/main/resources/hudson/widgets/BuildHistoryWidget/entries.jelly +++ b/core/src/main/resources/hudson/widgets/BuildHistoryWidget/entries.jelly @@ -29,23 +29,26 @@ THE SOFTWARE. - - - - - ${%pending} - #${it.owner.nextBuildNumber+queuedItems.size()-i-1} - - -
- - cancel this build - -
- (${%pending}) - - -
+ + + + + ${%pending} + + #${it.owner.nextBuildNumber+queuedItems.size()-i-1} + + +
+ + + cancel this build + + +
+ (${%pending}${h.prepend(' - ',item.why)}) + + +