Skip to content

Commit

Permalink
Handle icon and status of a job in jelly views
Browse files Browse the repository at this point in the history
  • Loading branch information
strangelookingnerd committed Nov 26, 2024
1 parent a345163 commit a487d65
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 22 deletions.
32 changes: 27 additions & 5 deletions core/src/main/resources/hudson/model/Job/index.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,33 @@ THE SOFTWARE.
<div class="jenkins-app-bar">
<div class="jenkins-app-bar__content jenkins-build-caption">
<j:set var="lastBuild" value="${it.lastBuild}" />
<j:if test="${lastBuild != null}">
<a href="${rootURL + '/' + lastBuild.url}" class="jenkins-!-display-contents" tabindex="-1">
<l:icon src="symbol-status-${lastBuild.iconColor.iconName}" tooltip="${lastBuild.iconColor.description}"/>
</a>
</j:if>
<j:choose>
<j:when test="${lastBuild != null}">
<a href="${rootURL + '/' + lastBuild.url}" class="jenkins-!-display-contents" tabindex="-1">
<l:icon src="symbol-status-${lastBuild.iconColor.iconName}" tooltip="${lastBuild.iconColor.description}"/>
</a>
</j:when>
<j:otherwise>
<j:choose>
<j:when test="${it.icon != null}">
<j:choose>
<j:when test="${it.icon.iconClassName != null}">
<!-- symbols and icons -->
<l:icon src="${it.icon.iconClassName}" tooltip="${it.descriptor.displayName}" />
</j:when>
<j:otherwise>
<!-- images -->
<l:icon src="${it.icon.getImageOf(null)}" tooltip="${it.descriptor.displayName}" />
</j:otherwise>
</j:choose>
</j:when>
<j:otherwise>
<!-- defaults to the item type icon -->
<l:icon src="${it.descriptor.iconClassName}" tooltip="${it.descriptor.displayName}" />
</j:otherwise>
</j:choose>
</j:otherwise>
</j:choose>
<h1 class="job-index-headline page-headline">
<l:breakable value="${it.displayName}"/>
</h1>
Expand Down
20 changes: 18 additions & 2 deletions core/src/main/resources/hudson/views/IconColumn/column.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,24 @@ THE SOFTWARE.
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<td class="jenkins-table__cell--tight jenkins-table__icon">
<div class="jenkins-table__cell__button-wrapper">
<!-- defaults to the item type icon -->
<l:icon src="${job.descriptor.iconClassName}" tooltip="${job.descriptor.displayName}" />
<j:choose>
<j:when test="${job.icon != null}">
<j:choose>
<j:when test="${job.icon.iconClassName != null}">
<!-- symbols and icons -->
<l:icon src="${job.icon.iconClassName}" tooltip="${job.descriptor.displayName}" />
</j:when>
<j:otherwise>
<!-- images -->
<l:icon src="${job.icon.getImageOf(null)}" tooltip="${job.descriptor.displayName}" />
</j:otherwise>
</j:choose>
</j:when>
<j:otherwise>
<!-- defaults to the item type icon -->
<l:icon src="${job.descriptor.iconClassName}" tooltip="${job.descriptor.displayName}" />
</j:otherwise>
</j:choose>
</div>
</td>
</j:jelly>
26 changes: 13 additions & 13 deletions core/src/main/resources/hudson/views/StatusColumn/column.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:t="/lib/hudson">
<j:choose>
<j:when test="${job.iconColor.iconName != null}">
<td class="jenkins-table__cell--tight jenkins-table__icon" data="${job.iconColor.ordinal()}">
<div class="jenkins-table__cell__button-wrapper">
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<td class="jenkins-table__cell--tight jenkins-table__icon" data="${job.iconColor.ordinal()}">
<div class="jenkins-table__cell__button-wrapper">
<j:choose>
<j:when test="${job.iconColor.iconName != null}">
<l:icon src="symbol-status-${job.iconColor.iconName}" tooltip="${job.iconColor.description}" />
</div>
</td>
</j:when>
<j:otherwise>
<!-- This is for special conditions, such as folders -->
<t:ballColorTd it="${job.iconColor}" />
</j:otherwise>
</j:choose>
</j:when>
<j:otherwise>
<!-- empty icon -->
<l:icon src="symbol-empty" />
</j:otherwise>
</j:choose>
</div>
</td>
</j:jelly>
4 changes: 2 additions & 2 deletions core/src/main/resources/lib/hudson/projectView.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ THE SOFTWARE.
<l:icon src="symbol-status-${job.iconColor.iconName}" tooltip="${job.iconColor.description}" />
</j:when>
<j:otherwise>
<!-- This is for special conditions, such as folders -->
<l:icon src="${job.iconColor.iconClassName}" />
<!-- empty icon -->
<l:icon src="symbol-empty" />
</j:otherwise>
</j:choose>
</div>
Expand Down
1 change: 1 addition & 0 deletions war/src/main/resources/images/symbols/empty.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a487d65

Please sign in to comment.