Skip to content

Commit 6922348

Browse files
Handle icon and status of a job in jelly views
1 parent 16b756f commit 6922348

File tree

5 files changed

+61
-22
lines changed

5 files changed

+61
-22
lines changed

core/src/main/resources/hudson/model/Job/index.jelly

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,33 @@ THE SOFTWARE.
3131
<div class="jenkins-app-bar">
3232
<div class="jenkins-app-bar__content jenkins-build-caption">
3333
<j:set var="lastBuild" value="${it.lastBuild}" />
34-
<j:if test="${lastBuild != null}">
35-
<a href="${rootURL + '/' + lastBuild.url}" class="jenkins-!-display-contents" tabindex="-1">
36-
<l:icon src="symbol-status-${lastBuild.iconColor.iconName}" tooltip="${lastBuild.iconColor.description}"/>
37-
</a>
38-
</j:if>
34+
<j:choose>
35+
<j:when test="${lastBuild != null}">
36+
<a href="${rootURL + '/' + lastBuild.url}" class="jenkins-!-display-contents" tabindex="-1">
37+
<l:icon src="symbol-status-${lastBuild.iconColor.iconName}" tooltip="${lastBuild.iconColor.description}"/>
38+
</a>
39+
</j:when>
40+
<j:otherwise>
41+
<j:choose>
42+
<j:when test="${it.icon != null}">
43+
<j:choose>
44+
<j:when test="${it.icon.iconClassName != null}">
45+
<!-- symbols and icons -->
46+
<l:icon src="${it.icon.iconClassName}" tooltip="${it.descriptor.displayName}" />
47+
</j:when>
48+
<j:otherwise>
49+
<!-- images -->
50+
<l:icon src="${it.icon.getImageOf(null)}" tooltip="${it.descriptor.displayName}" />
51+
</j:otherwise>
52+
</j:choose>
53+
</j:when>
54+
<j:otherwise>
55+
<!-- defaults to the item type icon -->
56+
<l:icon src="${it.descriptor.iconClassName}" tooltip="${it.descriptor.displayName}" />
57+
</j:otherwise>
58+
</j:choose>
59+
</j:otherwise>
60+
</j:choose>
3961
<h1 class="job-index-headline page-headline">
4062
<l:breakable value="${it.displayName}"/>
4163
</h1>

core/src/main/resources/hudson/views/IconColumn/column.jelly

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,24 @@ THE SOFTWARE.
2626
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
2727
<td class="jenkins-table__cell--tight jenkins-table__icon">
2828
<div class="jenkins-table__cell__button-wrapper">
29-
<!-- defaults to the item type icon -->
30-
<l:icon src="${job.descriptor.iconClassName}" tooltip="${job.descriptor.displayName}" />
29+
<j:choose>
30+
<j:when test="${job.icon != null}">
31+
<j:choose>
32+
<j:when test="${job.icon.iconClassName != null}">
33+
<!-- symbols and icons -->
34+
<l:icon src="${job.icon.iconClassName}" tooltip="${job.descriptor.displayName}" />
35+
</j:when>
36+
<j:otherwise>
37+
<!-- images -->
38+
<l:icon src="${job.icon.getImageOf(null)}" tooltip="${job.descriptor.displayName}" />
39+
</j:otherwise>
40+
</j:choose>
41+
</j:when>
42+
<j:otherwise>
43+
<!-- defaults to the item type icon -->
44+
<l:icon src="${job.descriptor.iconClassName}" tooltip="${job.descriptor.displayName}" />
45+
</j:otherwise>
46+
</j:choose>
3147
</div>
3248
</td>
3349
</j:jelly>

core/src/main/resources/hudson/views/StatusColumn/column.jelly

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ THE SOFTWARE.
2323
-->
2424

2525
<?jelly escape-by-default='true'?>
26-
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:t="/lib/hudson">
27-
<j:choose>
28-
<j:when test="${job.iconColor.iconName != null}">
29-
<td class="jenkins-table__cell--tight jenkins-table__icon" data="${job.iconColor.ordinal()}">
30-
<div class="jenkins-table__cell__button-wrapper">
26+
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
27+
<td class="jenkins-table__cell--tight jenkins-table__icon" data="${job.iconColor.ordinal()}">
28+
<div class="jenkins-table__cell__button-wrapper">
29+
<j:choose>
30+
<j:when test="${job.iconColor.iconName != null}">
3131
<l:icon src="symbol-status-${job.iconColor.iconName}" tooltip="${job.iconColor.description}" />
32-
</div>
33-
</td>
34-
</j:when>
35-
<j:otherwise>
36-
<!-- This is for special conditions, such as folders -->
37-
<t:ballColorTd it="${job.iconColor}" />
38-
</j:otherwise>
39-
</j:choose>
32+
</j:when>
33+
<j:otherwise>
34+
<!-- empty icon -->
35+
<l:icon src="symbol-empty" />
36+
</j:otherwise>
37+
</j:choose>
38+
</div>
39+
</td>
4040
</j:jelly>

core/src/main/resources/lib/hudson/projectView.jelly

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ THE SOFTWARE.
102102
<l:icon src="symbol-status-${job.iconColor.iconName}" tooltip="${job.iconColor.description}" />
103103
</j:when>
104104
<j:otherwise>
105-
<!-- This is for special conditions, such as folders -->
106-
<l:icon src="${job.iconColor.iconClassName}" />
105+
<!-- empty icon -->
106+
<l:icon src="symbol-empty" />
107107
</j:otherwise>
108108
</j:choose>
109109
</div>
Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)