Skip to content

Commit

Permalink
JENKINS-66659 Show new icons in build history (#5739)
Browse files Browse the repository at this point in the history
  • Loading branch information
zbynek authored Sep 22, 2021
1 parent ee81453 commit ffeadea
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/jenkins/widgets/BuildListTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class BuildListTable extends RunListProgressiveRendering {
element.put("iconColorOrdinal", iconColor.ordinal());
element.put("iconColorDescription", iconColor.getDescription());
element.put("url", build.getUrl());
element.put("buildStatusUrl", build.getBuildStatusUrl());
element.put("iconName", build.getIconColor().getIconName());
element.put("parentUrl", build.getParent().getUrl());
element.put("parentFullDisplayName", Functions.breakableString(Functions.escape(build.getParent().getFullDisplayName())));
element.put("displayName", build.getDisplayName());
Expand Down
1 change: 0 additions & 1 deletion core/src/main/java/jenkins/widgets/BuildTimeTrend.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public class BuildTimeTrend extends RunListProgressiveRendering {
element.put("iconName", iconColor.getIconName());
element.put("iconColorOrdinal", iconColor.ordinal());
element.put("iconColorDescription", iconColor.getDescription());
element.put("buildStatusUrl", build.getBuildStatusUrl());
element.put("number", build.getNumber());
element.put("displayName", build.getDisplayName());
element.put("duration", build.getDuration());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function buildTimeTrend_displayBuilds(data) {
/**
* Generate SVG Icon
*/
function generateSVGIcon(iconName) {
function generateSVGIcon(iconName, iconSizeClass) {

const imagesURL = document.head.getAttribute('data-imagesurl');

Expand Down Expand Up @@ -79,7 +79,7 @@ function generateSVGIcon(iconName) {
svg1.appendChild(use1);

const svg2 = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
svg2.setAttribute('class', 'svg-icon icon-' + iconName + ' icon-sm');
svg2.setAttribute('class', 'svg-icon icon-' + iconName + ' ' + (iconSizeClass || 'icon-sm'));
svg2.setAttribute('viewBox', "0 0 24 24");
const use2 = document.createElementNS('http://www.w3.org/2000/svg', 'use');
use2.setAttribute('href', imagesURL + '/build-status/build-status-sprite.svg#' + buildStatus)
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/resources/lib/hudson/buildListTable.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ THE SOFTWARE.
</st:documentation>

<t:setIconSize/>
<st:adjunct includes="hudson.model.Job.buildTimeTrend_resources" />
<script>
function displayBuilds(data) {
var p = $$('projectStatus');
Expand All @@ -40,7 +41,7 @@ THE SOFTWARE.
var tr = new Element('tr');
tr.insert(new Element('td', {data: e.iconColorOrdinal}).
insert(new Element('a', {href: '${rootURL}/' + e.url}).
insert(new Element('img', {src: '${imagesURL}/${iconSize}/' + e.buildStatusUrl, alt: e.iconColorDescription, 'class': 'icon${iconSize}'}))));
insert(generateSVGIcon(e.iconName, "${iconSizeClass}"))));
tr.insert(new Element('td').
insert(new Element('a', {href: '${rootURL}/' + e.parentUrl, 'class': 'model-link'}).
update(e.parentFullDisplayName)).
Expand All @@ -53,7 +54,7 @@ THE SOFTWARE.
update(e.buildStatusSummaryMessage.escapeHTML()));
tr.insert(new Element('td').
insert(new Element('a', {href: '${rootURL}/' + e.url + 'console'}).
insert(new Element('img', {src: '${imagesURL}/${subIconSize}/terminal.png', alt: '${%Console output}', border: 0}))));
insert(new Element('img', {src: '${imagesURL}/svgs/terminal.svg', alt: '${%Console output}', class: '${subIconSizeClass}'}))));
p.insert(tr);
Behaviour.applySubtree(tr);
}
Expand Down

0 comments on commit ffeadea

Please sign in to comment.