提交 42dbb2d0 编写于 作者: C Christoph Kutzinski

Display total time for which item has been queued in tooltip

上级 fd0d1cbe
......@@ -1211,6 +1211,8 @@ public class Queue extends ResourceController implements Saveable {
private /*almost final*/ transient FutureImpl future;
private final long inQueueSince;
/**
* Build is blocked because another build is in progress,
* required {@link Resource}s are not available, or otherwise blocked
......@@ -1233,6 +1235,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}.
* <p>
......@@ -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<Action> 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);
}
/**
......
......@@ -58,7 +58,7 @@ THE SOFTWARE.
<j:otherwise>
<j:forEach var="item" items="${items}">
<tr>
<td class="pane" width="100%" tooltip="${item.why}${h.escape(item.params)}" style="white-space: normal;">
<td class="pane" width="100%" tooltip="${item.why}${h.escape(item.params)}&lt;br&gt;${%WaitingSince(item.inQueueSinceString)}" style="white-space: normal;">
<j:set var="stuck" value="${item.isStuck()}"/>
<j:choose>
<j:when test="${h.hasPermission(item.task,item.task.READ)}">
......
WaitingSince=Waiting since {0}
\ No newline at end of file
......@@ -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
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册