提交 e0f0cd67 编写于 作者: K kohsuke

Applied a patch for #1174, but after a refactoring to reuse the jelly fragment.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@7320 71c3de6d-444a-0410-be80-ed276b4c234a
上级 477f0884
......@@ -171,6 +171,10 @@ public abstract class Computer extends AbstractModelObject {
public List<AbstractProject> getTiedJobs() {
return getNode().getSelfLabel().getTiedJobs();
}
public RunList getBuilds() {
return new RunList(Hudson.getInstance().getAllItems(Job.class)).node(getNode());
}
/**
* Called to notify {@link Computer} that its corresponding {@link Node}
......
......@@ -247,6 +247,10 @@ public abstract class View extends AbstractModelObject {
public void doRssFailed( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
rss(req, rsp, " failed builds", new RunList(this).failureOnly());
}
public RunList getBuilds() {
return new RunList(this);
}
private void rss(StaplerRequest req, StaplerResponse rsp, String suffix, RunList runs) throws IOException, ServletException {
RSS.forwardToRss(getDisplayName()+ suffix, getUrl(),
......
package hudson.util;
import hudson.model.AbstractBuild;
import hudson.model.Item;
import hudson.model.Job;
import hudson.model.Node;
import hudson.model.Result;
import hudson.model.Run;
import hudson.model.View;
import hudson.model.Item;
import java.util.ArrayList;
import java.util.Calendar;
......@@ -59,6 +61,21 @@ public class RunList extends ArrayList<Run> {
return this;
}
/**
* Filter the list to builds on a single node only
*/
public RunList node(Node node) {
for (Iterator<Run> itr = iterator(); itr.hasNext();) {
Run r = itr.next();
if (r instanceof AbstractBuild) {
if (!((AbstractBuild) r).getBuiltOn().equals(node)) {
itr.remove();
}
}
}
return this;
}
/**
* Filter the list to regression builds only.
*/
......
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<l:layout title="${it.displayName}">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<h1>
<img src="${imagesURL}/48x48/notepad.gif" />
Build History on ${it.displayName}
</h1>
<t:buildListTable builds="${it.builds}"/>
</l:main-panel>
</l:layout>
</j:jelly>
......@@ -6,6 +6,7 @@
<l:side-panel>
<l:tasks>
<l:task icon="images/24x24/up.gif" href=".." title="Back to List" />
<l:task icon="images/24x24/notepad.gif" href="${rootURL}/${it.url}/builds" title="Build History" />
</l:tasks>
</l:side-panel>
</j:jelly>
\ No newline at end of file
......@@ -7,6 +7,7 @@
<l:tasks>
<l:task icon="images/24x24/up.gif" href=".." title="Back to List" />
<l:task icon="images/24x24/search.gif" href="${rootURL}/computer/${it.displayName}/" title="Status" />
<l:task icon="images/24x24/notepad.gif" href="${rootURL}/${it.url}/builds" title="Build History" />
<l:isAdmin>
<l:task icon="images/24x24/clipboard.gif" href="log" title="Log" />
<l:task icon="images/24x24/computer.gif" href="systemInfo" title="System Information" />
......
......@@ -6,45 +6,7 @@
<img src="${imagesURL}/48x48/user.gif" />
Builds for ${it}
</h1>
<t:setIconSize/>
<table class="pane sortable" id="projectStatus">
<tr>
<th><st:nbsp/></th>
<th>{$%Build}</th>
<th initialSortDir="up">${%Date}</th>
<th>${%Status}</th>
<th><st:nbsp/></th>
</tr>
<j:forEach var="b" items="${it.builds}">
<tr>
<td data="${b.iconColor.ordinal()}">
<a href="${rootURL}/${b.url}">
<img src="${imagesURL}/${iconSize}/${b.buildStatusUrl}"
alt="${b.iconColor.description}"/>
</a>
</td>
<td>
<a href="${rootURL}/${b.project.url}">${b.project.name}</a>
<st:nbsp/>
<a href="${rootURL}/${b.url}">#${b.number}</a>
</td>
<td data="${b.timestampString2}">
${b.timestampString}
</td>
<td>
<t:buildStatusSummary build="${b}" />
</td>
<td>
<a href="${rootURL}/${b.url}console">
<img src="${imagesURL}/${subIconSize}/terminal.gif" title="Console output" border="0" />
</a>
</td>
</tr>
</j:forEach>
</table>
<t:rssBar-with-iconSize/>
<t:buildListTable builds="${it.builds}"/>
</l:main-panel>
</l:layout>
</j:jelly>
\ No newline at end of file
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<l:layout title="${it.displayName}">
<st:include page="sidepanel.jelly" />
<l:main-panel>
<h1>
<img src="${imagesURL}/48x48/notepad.gif" />
Build History of ${it.displayName}
</h1>
<t:buildListTable builds="${it.builds}"/>
</l:main-panel>
</l:layout>
</j:jelly>
......@@ -15,6 +15,7 @@
<j:if test="${it.hasPeople()}">
<l:task icon="images/24x24/user.gif" href="${rootURL}/people/" title="${%People}" />
</j:if>
<l:task icon="images/24x24/notepad.gif" href="${rootURL}/${it.url}builds" title="Build History"/>
<st:include page="sidepanel2.jelly" />
<t:actions />
</l:tasks>
......
<!--
Creates a table of builds.
Attribute:
@builds a collection of builds to be displayed. required.
-->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<t:setIconSize/>
<table class="pane sortable" id="projectStatus">
<tr>
<th><st:nbsp/></th>
<th>${%Build}</th>
<th initialSortDir="up">${%Date}</th>
<th>${%Status}</th>
<th><st:nbsp/></th>
</tr>
<j:forEach var="b" items="${attrs.builds}">
<tr>
<td data="${b.iconColor.ordinal()}">
<a href="${rootURL}/${b.url}">
<img src="${imagesURL}/${iconSize}/${b.buildStatusUrl}"
alt="${b.iconColor.description}"/>
</a>
</td>
<td>
<a href="${rootURL}/${b.project.url}">${b.project.name}</a>
<st:nbsp/>
<a href="${rootURL}/${b.url}">#${b.number}</a>
</td>
<td data="${b.timestampString2}">
${b.timestampString}
</td>
<td>
<t:buildStatusSummary build="${b}" />
</td>
<td>
<a href="${rootURL}/${b.url}console">
<img src="${imagesURL}/${subIconSize}/terminal.gif" title="Console output" border="0" />
</a>
</td>
</tr>
</j:forEach>
</table>
<t:rssBar-with-iconSize/>
</j:jelly>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册