Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
JENKINS-3549: display promotion stars on the view.
see also pull request #30 which is an alternative implementation. however instead of considering only the last build, consider all promotion processes; those may point to different builds.
- Loading branch information
Showing
10 changed files
with
133 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
src/main/java/hudson/plugins/promoted_builds/PromotionStatusColumn.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package hudson.plugins.promoted_builds; | ||
|
||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
import hudson.Extension; | ||
import hudson.model.Job; | ||
import hudson.model.Run; | ||
import hudson.views.ListViewColumn; | ||
import hudson.views.ListViewColumnDescriptor; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class PromotionStatusColumn extends ListViewColumn { | ||
|
||
@DataBoundConstructor | ||
public PromotionStatusColumn() { | ||
super(); | ||
} | ||
|
||
public PromotedProjectAction getAction(Job job) { | ||
PromotedProjectAction action = job.getAction(PromotedProjectAction.class); | ||
return action; | ||
} | ||
|
||
@Extension | ||
public static class DescriptorImpl extends ListViewColumnDescriptor { | ||
|
||
public DescriptorImpl() { | ||
} | ||
|
||
@Override | ||
public String getDisplayName() { | ||
return Messages.PromotionStatusColumn_DisplayName(); | ||
} | ||
|
||
public boolean shownByDefault() { | ||
return false; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
src/main/resources/hudson/plugins/promoted_builds/PromotionStatusColumn/column.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout"> | ||
<td> | ||
<j:set var="ppa" value="${it.getAction(job)}"/> | ||
<j:choose> | ||
<j:when test="${ppa!=null}"> | ||
<j:set var="pp" value="${ppa.getPromotionProcesses()}"/> | ||
<j:choose> | ||
<j:when test="${pp!=null}"> | ||
<j:forEach var="process" items="${pp}"> | ||
<j:set var="status" value="${ppa.getStatus(process)}"/> | ||
<j:set var="icon" value="${process.getIcon()}"/> | ||
<j:set var="iconUrl" value="${resURL}/plugin/promoted-builds/icons/${iconSize}/${icon}.png"/> | ||
<img width="${iconSize}" height="${iconSize}" | ||
title="${%PromotionProcess} ${process.name}" | ||
src="${iconUrl}"/> | ||
<j:choose> | ||
<j:when test="${status!=null}"> | ||
<j:if test="${status.isLastAnError()}"> | ||
<j:set var="iconUrl" value="${resURL}/images/${iconSize}/error.png"/> | ||
<img width="${iconSize}" height="${iconSize}" | ||
title="${%PromotionProcess} ${process.name} ${%PromotionProcess.failed}" | ||
src="${iconUrl}"/> | ||
</j:if> | ||
<j:set var="target" value="${status.getTarget()}"/> | ||
<a href="${jobBaseUrl}${job.shortUrl}${target.number}/" class="model-link inside"> | ||
${target.displayName} | ||
</a> | ||
</j:when> | ||
<j:otherwise><!-- promotion has never happened / no builds --> | ||
${%Otherwise.noBuild} | ||
</j:otherwise> | ||
</j:choose> | ||
</j:forEach> | ||
</j:when> | ||
<j:otherwise><!-- job has no promotion process (despite project action) --> | ||
${%Otherwise.noPromotionProcess} | ||
</j:otherwise> | ||
</j:choose> | ||
</j:when> | ||
<j:otherwise><!-- job has no promotion process (no project action) --> | ||
${%Otherwise.noPromotedProjectAction} | ||
</j:otherwise> | ||
</j:choose> | ||
</td> | ||
</j:jelly> | ||
|
5 changes: 5 additions & 0 deletions
5
src/main/resources/hudson/plugins/promoted_builds/PromotionStatusColumn/column.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
PromotionProcess = Promotion process | ||
PromotionProcess.failed = failed | ||
Otherwise.noBuild = N/A | ||
Otherwise.noPromotionProcess = N/A | ||
Otherwise.noPromotedProjectAction = N/A |
6 changes: 6 additions & 0 deletions
6
src/main/resources/hudson/plugins/promoted_builds/PromotionStatusColumn/columnHeader.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?jelly escape-by-default='true'?> | ||
<j:jelly xmlns:j="jelly:core"> | ||
<th> | ||
${%PromotionStatusColumn.Header} | ||
</th> | ||
</j:jelly> |
1 change: 1 addition & 0 deletions
1
...in/resources/hudson/plugins/promoted_builds/PromotionStatusColumn/columnHeader.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PromotionStatusColumn.Header = Promotions |
8 changes: 8 additions & 0 deletions
8
src/main/resources/hudson/plugins/promoted_builds/PromotionStatusColumn/config.jelly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?jelly escape-by-default='true'?> | ||
<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" xmlns:p="/lib/hudson/project"> | ||
<f:block> | ||
<p>${%PromotionStatusColumn.Blurb}</p> | ||
</f:block> | ||
</j:jelly> |
1 change: 1 addition & 0 deletions
1
src/main/resources/hudson/plugins/promoted_builds/PromotionStatusColumn/config.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PromotionStatusColumn.Blurb = This column shows the promotion status of the last build. |