Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use symbols for build status #8705

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
root = true

[*.{js, scss, css, hbs}]
[*.{js, scss, css, hbs, svg}]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
Expand Down
8 changes: 8 additions & 0 deletions core/src/main/resources/hudson/model/Job/buildTimeTrend.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ THE SOFTWARE.
<l:breadcrumb title="${%Build Time Trend}" />
<st:adjunct includes="hudson.model.Job.buildTimeTrend_resources" />
<l:main-panel>
<template id="icons">
timja marked this conversation as resolved.
Show resolved Hide resolved
<l:icon src="symbol-status-blue" id="blue" />
<l:icon src="symbol-status-yellow" id="yellow" />
<l:icon src="symbol-status-red" id="red" />
<l:icon src="symbol-status-nobuilt" id="nobuilt" />
<l:icon src="symbol-status-aborted" id="aborted" />
<l:icon src="symbol-status-disabled" id="disabled" />
</template>
<h1>${%Build Time Trend}</h1>
<div align="center">
<img class="build-time-graph" src="buildTimeGraph/png" width="500" height="400" lazymap="buildTimeGraph/map" alt="[${%Build time graph}]" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,76 +67,11 @@ window.buildTimeTrend_displayBuilds = function (data) {
/**
* Generate SVG Icon
*/
function generateSVGIcon(iconName, iconSizeClass) {
const imagesURL = document.head.getAttribute("data-imagesurl");

const isInProgress = iconName.endsWith("anime");
let buildStatus = "never-built";
switch (iconName) {
case "red":
case "red-anime":
buildStatus = "last-failed";
break;
case "yellow":
case "yellow-anime":
buildStatus = "last-unstable";
break;
case "blue":
case "blue-anime":
buildStatus = "last-successful";
break;
case "grey":
case "grey-anime":
case "disabled":
case "disabled-anime":
buildStatus = "last-disabled";
break;
case "aborted":
case "aborted-anime":
buildStatus = "last-aborted";
break;
case "nobuilt":
case "nobuilt-anime":
buildStatus = "never-built";
break;
}
Comment on lines -70 to -102
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused JENKINS-72407

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is not here but in StatusColumn -> column.jelly

function generateSVGIcon(iconName) {
const icons = document.querySelector("#icons");
iconName = iconName.replace("-anime", "");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason why the anime svgs are excluded? Before they were animated when the build was running


const svg1 = document.createElementNS("http://www.w3.org/2000/svg", "svg");
svg1.setAttribute("class", "svg-icon");
svg1.setAttribute("viewBox", "0 0 24 24");
const use1 = document.createElementNS("http://www.w3.org/2000/svg", "use");
use1.setAttribute(
"href",
imagesURL +
"/build-status/build-status-sprite.svg#build-status-" +
(isInProgress ? "in-progress" : "static"),
);
svg1.appendChild(use1);

const svg2 = document.createElementNS("http://www.w3.org/2000/svg", "svg");
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,
);
svg2.appendChild(use2);

const span = document.createElement("span");
span.classList.add("build-status-icon__wrapper", "icon-" + iconName);

let span2 = document.createElement("span");
span2.classList.add("build-status-icon__outer");
span2.appendChild(svg1);

span.appendChild(span2);
span.appendChild(svg2);

return span;
return icons.content.querySelector(`#${iconName}`).cloneNode(true);
}

/**
Expand All @@ -155,7 +90,7 @@ window.displayBuilds = function (data) {
td1.classList.add("jenkins-table__cell--tight", "jenkins-table__icon");
var div1 = document.createElement("div");
div1.classList.add("jenkins-table__cell__button-wrapper");
var svg = generateSVGIcon(e.iconName, p.dataset.iconSizeClass);
var svg = generateSVGIcon(e.iconName);
div1.appendChild(svg);
td1.appendChild(div1);
tr.appendChild(td1);
Expand Down
18 changes: 15 additions & 3 deletions core/src/main/resources/hudson/views/StatusColumn/column.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,18 @@ THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:t="/lib/hudson">
<t:ballColorTd it="${job.iconColor}" />
</j:jelly>
<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}" />
</j:when>
<j:otherwise>
<!-- This is for special conditions, such as folders -->
<l:icon src="${job.iconColor.iconClassName}" />
</j:otherwise>
</j:choose>
</div>
</td>
</j:jelly>
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ THE SOFTWARE.
<div class="pane build-name">
<div class="build-icon">
<a class="build-status-link" href="${h.getConsoleUrl(build)}" tooltip="${build.iconColor.description} > ${%Console Output}">
<l:icon class="${build.buildStatusIconClassName} icon-sm" />
<l:icon src="symbol-status-${build.iconColor.iconName}" />
</a>
</div>
<a class="model-link inside build-link display-name" update-parent-class=".build-row" href="${link}">${build.displayName}</a>
Expand Down
32 changes: 16 additions & 16 deletions core/src/main/resources/jenkins/model/Jenkins/_legend.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -29,87 +29,87 @@ THE SOFTWARE.

<dl class="app-icon-legend">
<dt>
<l:icon class="icon-blue icon-lg"/>
<l:icon src="symbol-status-blue" />
</dt>
<dd>
${%blue}
</dd>

<dt>
<l:icon class="icon-blue-anime icon-lg"/>
<l:icon src="symbol-status-blue-anime" />
</dt>
<dd>
${%blue_anime}
</dd>

<dt>
<l:icon class="icon-yellow icon-lg"/>
<l:icon src="symbol-status-yellow" />
</dt>
<dd>
${%yellow}
</dd>

<dt>
<l:icon class="icon-yellow-anime icon-lg"/>
<l:icon src="symbol-status-yellow-anime" />
</dt>
<dd>
${%yellow_anime}
</dd>

<dt>
<l:icon class="icon-red icon-lg"/>
<l:icon src="symbol-status-red" />
</dt>
<dd>
${%red}
</dd>

<dt>
<l:icon class="icon-red-anime icon-lg"/>
<l:icon src="symbol-status-red-anime" />
</dt>
<dd>
${%red_anime}
</dd>

<dt>
<l:icon class="icon-nobuilt icon-lg"/>
<l:icon src="symbol-status-nobuilt" />
</dt>
<dd>
${%lightgrey}
</dd>

<dt>
<l:icon class="icon-nobuilt-anime icon-lg"/>
<l:icon src="symbol-status-nobuilt-anime" />
</dt>
<dd>
${%lightgrey_anime}
</dd>

<dt>
<l:icon class="icon-disabled icon-lg"/>
<l:icon src="symbol-status-aborted" />
</dt>
<dd>
${%grey}
${%darkgrey}
</dd>

<dt>
<l:icon class="icon-disabled-anime icon-lg"/>
<l:icon src="symbol-status-aborted-anime" />
</dt>
<dd>
${%grey_anime}
${%darkgrey_anime}
</dd>

<dt>
<l:icon class="icon-aborted icon-lg"/>
<l:icon src="symbol-status-disabled" />
</dt>
<dd>
${%darkgrey}
${%grey}
</dd>

<dt>
<l:icon class="icon-aborted-anime icon-lg"/>
<l:icon src="symbol-status-disabled-anime" />
</dt>
<dd>
${%darkgrey_anime}
${%grey_anime}
</dd>
</dl>

Expand Down
9 changes: 9 additions & 0 deletions core/src/main/resources/lib/hudson/buildListTable.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@ THE SOFTWARE.
A collection of builds to be displayed.
</st:attribute>
</st:documentation>
<template id="icons">
timja marked this conversation as resolved.
Show resolved Hide resolved
<l:icon src="symbol-status-blue" id="blue" />
<l:icon src="symbol-status-yellow" id="yellow" />
<l:icon src="symbol-status-red" id="red" />
<l:icon src="symbol-status-nobuilt" id="nobuilt" />
<l:icon src="symbol-status-aborted" id="aborted" />
<l:icon src="symbol-status-disabled" id="disabled" />
<l:icon src="symbol-terminal" id="console" />
</template>

<t:setIconSize/>
<st:adjunct includes="hudson.model.Job.buildTimeTrend_resources" />
Expand Down
10 changes: 9 additions & 1 deletion core/src/main/resources/lib/hudson/projectView.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,15 @@ THE SOFTWARE.
<div class="jenkins-jobs-list__item">
<a class="jenkins-jobs-list__item__details" href="${jobBaseUrl}${job.shortUrl}">
<div class="jenkins-jobs-list__item__icons">
<t:ballColorTd it="${job.iconColor}" />
<j:choose>
<j:when test="${job.iconColor.iconName != null}">
<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}" />
</j:otherwise>
</j:choose>
</div>
<div class="jenkins-jobs-list__item__details__text">
<p class="jenkins-jobs-list__item__label">${job.displayName}</p>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions war/src/main/resources/images/symbols/status-aborted.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions war/src/main/resources/images/symbols/status-blue-anime.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions war/src/main/resources/images/symbols/status-blue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions war/src/main/resources/images/symbols/status-disabled.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions war/src/main/resources/images/symbols/status-nobuilt.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions war/src/main/resources/images/symbols/status-red-anime.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions war/src/main/resources/images/symbols/status-red.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions war/src/main/resources/images/symbols/status-yellow-anime.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions war/src/main/resources/images/symbols/status-yellow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 11 additions & 2 deletions war/src/main/scss/base/_style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -866,13 +866,22 @@ table.progress-bar.red td.progress-bar-done {

/* Unknown */

[data-symbol-animation] {
animation: spin 1s linear infinite;
transform-origin: center;

@media (prefers-reduced-motion) {
animation-duration: 3s;
}
}

@keyframes spin {
from {
transform: rotate(0deg) translateZ(0);
transform: rotate(0deg);
}

to {
transform: rotate(360deg) translateZ(0);
transform: rotate(360deg);
}
}

Expand Down
11 changes: 11 additions & 0 deletions war/src/main/scss/pages/_dashboard.scss
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,14 @@ $min-button-size: 36px;
}
}
}

.build-status-link {
display: inline-flex;
align-items: center;
justify-content: center;

svg {
width: 1rem;
height: 1rem;
}
}
Loading