Skip to content

Commit

Permalink
Unbuilt shown as gray in job view, varied in project view.
Browse files Browse the repository at this point in the history
Possible improvement: change the project bg color when the only other jobs are
successful, as right now it shows as orange.

[FIXED JENKINS-12460]
  • Loading branch information
david-resnick committed Oct 20, 2013
1 parent 0c2e61f commit 32153dd
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 10 deletions.
2 changes: 2 additions & 0 deletions src/main/java/hudson/model/IViewEntry.java
Expand Up @@ -123,4 +123,6 @@ public interface IViewEntry {
*/
public abstract boolean isCompletelyClaimed();

public boolean isNotBuilt();

}
19 changes: 11 additions & 8 deletions src/main/java/hudson/model/JobViewEntry.java
Expand Up @@ -37,10 +37,9 @@ public class JobViewEntry implements IViewEntry {

private Boolean building = false;

/**
* If the build is stable.
*/
private boolean stable;
private boolean stable = false;

private boolean notBuilt = false;

/**
* C'tor
Expand Down Expand Up @@ -98,6 +97,9 @@ public String getBackgroundColor() {
}

public String getStatus() {
if (isNotBuilt()) {
return "never built";
}
if (getStable()) {
return "successful";
}
Expand Down Expand Up @@ -330,20 +332,17 @@ public String getSuccessPercentage() {
private void findStatus() {
Result result = RadiatorUtil.getLastFinishedResult(job);

this.stable = false;
if (result.ordinal == Result.NOT_BUILT.ordinal) {
this.backgroundColor = getColors().getOtherBG();
this.color = getColors().getOtherFG();
this.broken = true;
this.notBuilt = true;
} else if (result.ordinal == Result.SUCCESS.ordinal) {
this.backgroundColor = getColors().getOkBG();
this.color = getColors().getOkFG();
this.broken = false;
this.stable = true;
} else if (result.ordinal == Result.UNSTABLE.ordinal) {
this.backgroundColor = getColors().getFailedBG();
this.color = getColors().getFailedFG();
this.broken = false;
} else {
this.backgroundColor = getColors().getBrokenBG();
this.color = getColors().getBrokenFG();
Expand Down Expand Up @@ -404,6 +403,10 @@ public boolean getStable() {
return stable;
}

public boolean isNotBuilt() {
return notBuilt;
}

/*
* (non-Javadoc)
*
Expand Down
18 changes: 16 additions & 2 deletions src/main/java/hudson/model/ProjectViewEntry.java
Expand Up @@ -6,7 +6,6 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;

Expand Down Expand Up @@ -65,14 +64,25 @@ public TreeSet<IViewEntry> getUnclaimedJobs() {
TreeSet<IViewEntry> unclaimed = new TreeSet<IViewEntry>(
new EntryComparator());
for (IViewEntry job : jobs) {
if ((!job.getStable()) || job.getFailCount() > 0) {
if (((!job.getStable()) || job.getFailCount() > 0) && !job.isNotBuilt()) {
if (!job.isCompletelyClaimed())
unclaimed.add(job);
}
}
return unclaimed;
}

public TreeSet<IViewEntry> getUnbuiltJobs() {
TreeSet<IViewEntry> unbuilt = new TreeSet<IViewEntry>(
new EntryComparator());
for (IViewEntry job : jobs) {
if (job.isNotBuilt()) {
unbuilt.add(job);
}
}
return unbuilt;
}

public TreeSet<IViewEntry> getJobs() {
return jobs;
}
Expand Down Expand Up @@ -252,4 +262,8 @@ public boolean isCompletelyClaimed() {
public String getUnclaimedMatrixBuilds() {
throw new UnsupportedOperationException();
}

public boolean isNotBuilt() {
throw new UnsupportedOperationException();
}
}
20 changes: 20 additions & 0 deletions src/main/resources/hudson/model/RadiatorView/project.jelly
Expand Up @@ -38,6 +38,7 @@

<j:invoke var="passJobs" on="${job}" method="getPassingJobs" />
<j:invoke var="failJobs" on="${job}" method="getUnclaimedJobs" />
<j:invoke var="unbuiltJobs" on="${job}" method="getUnbuiltJobs" />
<j:invoke var="claimedJobs" on="${job}" method="getClaimedBuilds" />
<j:if test="${!failJobs.isEmpty()}">
<j:if
Expand Down Expand Up @@ -83,6 +84,25 @@
</ul>
</p>
</j:if>
<j:if test="${!unbuiltJobs.isEmpty()}">
<p>
Never Built:
<ul>
<j:forEach var="subjob" items="${unbuiltJobs}">
<j:invokeStatic className="org.apache.commons.lang.StringUtils"
method="removeStart" var="subjobShortName">
<j:arg type="java.lang.String" value="${subjob.name}" />
<j:arg type="java.lang.String" value="${job.name}_" />
</j:invokeStatic>
<li>
<a href="${subjob.lastBuildUrl}">${subjobShortName}</a>
<j:if test="${subjob.getBuilding()}">(building now)</j:if>
<j:if test="${subjob.getQueued()}">(build pending)</j:if>
</li>
</j:forEach>
</ul>
</p>
</j:if>
</div>

</j:jelly>

0 comments on commit 32153dd

Please sign in to comment.