diff --git a/core/src/main/java/hudson/model/Queue.java b/core/src/main/java/hudson/model/Queue.java index e4dc8f00cfab7ac4721ac18ba8d98cf7a6c013a4..2a36d701178f115000301c26f0ca35c541c69d03 100644 --- a/core/src/main/java/hudson/model/Queue.java +++ b/core/src/main/java/hudson/model/Queue.java @@ -1210,6 +1210,8 @@ public class Queue extends ResourceController implements Saveable { public final Task task; private /*almost final*/ transient FutureImpl future; + + private final long inQueueSince; /** * Build is blocked because another build is in progress, @@ -1232,6 +1234,20 @@ public class Queue extends ResourceController implements Saveable { */ @Exported public boolean isStuck() { return false; } + + /** + * Since when is this item in the queue. + * @return Unix timestamp + */ + @Exported + public long getInQueueSince() { + return this.inQueueSince; + } + + public String getInQueueSinceString() { + long duration = System.currentTimeMillis() - this.inQueueSince; + return Util.getTimeSpanString(duration); + } /** * Can be used to wait for the completion (either normal, abnormal, or cancellation) of the {@link Task}. @@ -1265,11 +1281,20 @@ public class Queue extends ResourceController implements Saveable { this.task = task; this.id = id; this.future = future; + this.inQueueSince = System.currentTimeMillis(); + for (Action action: actions) addAction(action); + } + + protected Item(Task task, List actions, int id, FutureImpl future, long inQueueSince) { + this.task = task; + this.id = id; + this.future = future; + this.inQueueSince = inQueueSince; for (Action action: actions) addAction(action); } protected Item(Item item) { - this(item.task, item.getActions(), item.id, item.future); + this(item.task, item.getActions(), item.id, item.future, item.inQueueSince); } /** diff --git a/core/src/main/resources/lib/hudson/queue.jelly b/core/src/main/resources/lib/hudson/queue.jelly index d90eeac1576ec1c0a413024a731bafeade9f7011..68f56b869295d0c47c2626920c58bfcc46e5abf7 100644 --- a/core/src/main/resources/lib/hudson/queue.jelly +++ b/core/src/main/resources/lib/hudson/queue.jelly @@ -58,7 +58,7 @@ THE SOFTWARE. - + diff --git a/core/src/main/resources/lib/hudson/queue.properties b/core/src/main/resources/lib/hudson/queue.properties new file mode 100644 index 0000000000000000000000000000000000000000..4b70234a6e1a7790cb8db46cc71fd5de8c60a26f --- /dev/null +++ b/core/src/main/resources/lib/hudson/queue.properties @@ -0,0 +1 @@ +WaitingSince=Waiting since {0} \ No newline at end of file diff --git a/core/src/main/resources/lib/hudson/queue_de.properties b/core/src/main/resources/lib/hudson/queue_de.properties index 9d3433f32017514010e1ae1644b9e906de9d475f..2bd37d026ce4dc38fb503d59da10b59ebdcf4cfc 100644 --- a/core/src/main/resources/lib/hudson/queue_de.properties +++ b/core/src/main/resources/lib/hudson/queue_de.properties @@ -25,3 +25,4 @@ No\ builds\ in\ the\ queue.=Keine Builds geplant Jenkins\ is\ going\ to\ shut\ down.\ No\ further\ builds\ will\ be\ performed.=Jenkins fährt gerade herunter. Es werden keine weiteren Builds ausgeführt. cancel=Abbrechen Unknown\ Task=Unbekannter Task +WaitingSince=Wartet seit {0} \ No newline at end of file