Skip to content

Commit

Permalink
[FIXED JENKINS-41927] Orphaned branched should have name in strikethr…
Browse files Browse the repository at this point in the history
…ough
  • Loading branch information
stephenc committed Feb 10, 2017
1 parent 4a57f3a commit 329efec
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/main/java/jenkins/branch/ItemColumn.java
Expand Up @@ -28,6 +28,9 @@
import hudson.model.Actionable;
import hudson.model.Descriptor;
import hudson.model.DescriptorVisibilityFilter;
import hudson.model.ItemGroup;
import hudson.model.Job;
import hudson.model.TopLevelItem;
import hudson.views.JobColumn;
import hudson.views.ListViewColumn;
import hudson.views.ListViewColumnDescriptor;
Expand Down Expand Up @@ -63,6 +66,24 @@ public boolean isPrimary(Object job) {
return job instanceof Actionable && ((Actionable) job).getAction(PrimaryInstanceMetadataAction.class) != null;
}

/**
* Determines if the item is orphaned.
* @param item the item.
* @return {@code true} if and only if the item is orphaned.
*/
public boolean isOrphaned(Object item) {
if (item instanceof Job) {
Job job = (Job) item;
ItemGroup parent = job.getParent();
if (parent instanceof MultiBranchProject) {
BranchProjectFactory factory = ((MultiBranchProject) parent).getProjectFactory();
return factory.isProject(job) && factory.getBranch(job) instanceof Branch.Dead;
}
}
// TODO determine if an Organization project is dead
return false;
}

/**
* Gets the tool-tip title of a job.
*
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/jenkins/branch/ItemColumn/column.jelly
Expand Up @@ -27,6 +27,13 @@ THE SOFTWARE.
xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:i="jelly:fmt">
<td style="${indenter.getCss(job)}">
<j:choose>
<j:when test="${it.isOrphaned(job)}">
<s>
<a href="${jobBaseUrl}${job.shortUrl}" class='model-link inside' title="${it.getTitle(job)}">
<l:breakable value="${h.getRelativeDisplayNameFrom(job, itemGroup)}"/>
</a>
</s>
</j:when>
<j:when test="${it.isPrimary(job)}">
<strong>
<a href="${jobBaseUrl}${job.shortUrl}" class='model-link inside' title="${it.getTitle(job)}">
Expand Down

0 comments on commit 329efec

Please sign in to comment.