提交 b86b9938 编写于 作者: K kohsuke

implemented #365.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@2812 71c3de6d-444a-0410-be80-ed276b4c234a
上级 0971dee5
......@@ -6,6 +6,7 @@ import hudson.maven.MavenModule;
import hudson.model.Descriptor.FormException;
import hudson.model.Fingerprint.RangeSet;
import hudson.model.RunMap.Constructor;
import hudson.model.Queue.*;
import hudson.scm.NullSCM;
import hudson.scm.SCM;
import hudson.scm.SCMS;
......@@ -199,6 +200,11 @@ public abstract class AbstractProject<P extends AbstractProject<P,R>,R extends A
return Hudson.getInstance().getQueue().contains(this);
}
@Override
public Queue.Item getQueueItem() {
return Hudson.getInstance().getQueue().getItem(this);
}
/**
* Returns true if a build of this project is in progress.
*/
......
......@@ -119,6 +119,13 @@ public abstract class Job<JobT extends Job<JobT,RunT>, RunT extends Run<JobT,Run
return false;
}
/**
* If this job is in the build queue, return its item.
*/
public Queue.Item getQueueItem() {
return null;
}
/**
* If true, it will keep all the build logs of dependency components.
*/
......
......@@ -207,6 +207,23 @@ public class Queue {
return r;
}
/**
* Gets the information about the queue item for the given project.
*
* @return null if the project is not in the queue.
*/
public synchronized Item getItem(AbstractProject p) {
if(blockedProjects.contains(p))
return new Item(new GregorianCalendar(),p,true,false);
if(buildables.contains(p))
return new Item(new GregorianCalendar(),p,false,true);
for (Item item : queue) {
if (item.project == p)
return item;
}
return null;
}
/**
* Returns true if this queue contains the said project.
*/
......
......@@ -12,14 +12,17 @@
&lt;div style='float:right'>(&lt;a href='${url}/buildTimeTrend'>trend&lt;/a>)&lt;/div>Build History
" id="buildHistory">
<!-- pending build -->
<j:if test="${it.inQueue}">
<tr class="build-row">
<j:set var="pending" value="${it.queueItem}" />
<j:if test="${pending!=null}">
<j:set var="id" value="${h.generateId()}"/>
<tr class="build-row" id="${id}">
<td nowrap="nowrap">
<img width="16" height="16" src="${rootURL}/images/16x16/grey.gif" /><st:nbsp/>
#${it.nextBuildNumber}
</td>
<td nowrap="nowrap">
(pending)
<t:tooltip id="${id}">${pending.why}</t:tooltip>
</td>
</tr>
</j:if>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册