Skip to content

Commit

Permalink
Merge branch 'use-jenkins-button-for-tables' into projct-app-bar-revamp
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Apr 7, 2024
2 parents ca9ade7 + c6d6ef0 commit 2046f1e
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 47 deletions.
12 changes: 7 additions & 5 deletions core/src/main/resources/hudson/PluginManager/installed.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,14 @@ THE SOFTWARE.
<td class="jenkins-table__cell--tight">
<div class="jenkins-table__cell__button-wrapper">
<j:if test="${p.downgradable}">
<form class="jenkins-buttons-row" method="post"
<form method="post"
class="jenkins-buttons-row"
action="${rootURL}/updateCenter/plugin/${p.shortName}/downgrade">
<button class="jenkins-table__button jenkins-!-color-orange" tooltip="${%downgradeTo(p.backupVersion)}">
<button class="jenkins-button jenkins-button--tertiary jenkins-!-color-orange"
style="padding: 0.5rem"
tooltip="${%downgradeTo(p.backupVersion)}">
<l:icon src="symbol-downgrade-circle"/>
<span class="jenkins-!-margin-left-1"
style="font-size: 0.75rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 50px;">
<span style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60px;">
${p.backupVersion}
</span>
</button>
Expand Down Expand Up @@ -220,7 +222,7 @@ THE SOFTWARE.
</j:if>
<button data-action="uninstall"
type="button"
class="jenkins-table__button jenkins-!-destructive-color"
class="jenkins-button jenkins-button--tertiary jenkins-!-destructive-color"
tooltip="${%Uninstall} ${p.updateInfo.displayName ?: p.displayName}"
data-href="plugin/${p.shortName}/doUninstall"
data-message="${%uninstall-title(p.updateInfo.displayName ?: p.displayName)}">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ THE SOFTWARE.
<local:row name="${lr.name}" href="${lr.searchUrl}/">
<l:isAdmin>
<div class="jenkins-table__cell__button-wrapper">
<a href="${lr.searchUrl}/configure" class="jenkins-table__button">
<a href="${lr.searchUrl}/configure" class="jenkins-button jenkins-button--tertiary">
<l:icon src="symbol-settings" />
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ THE SOFTWARE.
<td class="jenkins-table__cell--tight">
<j:if test="${c.hasPermission(c.EXTENDED_READ)}">
<div class="jenkins-table__cell__button-wrapper">
<a href="../${c.url}configure" class="jenkins-table__button">
<a href="../${c.url}configure" class="jenkins-button jenkins-button--tertiary">
<l:icon src="symbol-settings" />
</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ window.displayBuilds = function (data) {
var div2 = document.createElement("div");
div2.classList.add("jenkins-table__cell__button-wrapper");
var a3 = document.createElement("a");
a3.classList.add("jenkins-table__button");
a3.classList.add("jenkins-button");
a3.href = e.consoleUrl;
a3.innerHTML = p.dataset.consoleOutputIcon;
div2.appendChild(a3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@ THE SOFTWARE.
</td>
<td>
<div class="jenkins-table__cell__button-wrapper">
<a href="${user.url}/configure" class="jenkins-table__button">
<a href="${user.url}/configure" class="jenkins-button jenkins-button--tertiary">
<l:icon src="symbol-settings" />
</a>
</div>
</td>
<td>
<j:if test="${user.canDelete()}">
<div class="jenkins-table__cell__button-wrapper">
<l:confirmationLink href="${user.url}/doDelete" class="jenkins-table__button jenkins-!-destructive-color"
<l:confirmationLink href="${user.url}/doDelete" class="jenkins-button jenkins-button--tertiary jenkins-!-destructive-color"
post="true" message="${%delete.user(user.displayName)}">
<l:icon src="symbol-trash" />
</l:confirmationLink>
Expand Down
51 changes: 23 additions & 28 deletions core/src/main/resources/hudson/views/BuildButtonColumn/column.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -23,32 +23,27 @@ THE SOFTWARE.
-->

<?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:x="jelly:xml">
<x:element name="${jenkins_mobile_show?'div':'td'}">
<j:if test="${!jenkins_mobile_show}">
<x:attribute name="class">jenkins-table__cell--tight</x:attribute>
</j:if>
<j:if test="${job.buildable and job.hasPermission(job.BUILD)}">
<j:set var="id" value="${h.generateId()}"/>
<j:set var="href" value="${jobBaseUrl}${job.shortUrl}build?delay=0sec"/>
<div class="jenkins-table__cell__button-wrapper">
<j:choose>
<j:when test="${job.parameterized}">
<j:set var="title" value="${%Schedule_a_task_with_parameters(h.getRelativeDisplayNameFrom(job, itemGroup),it.taskNoun(job))}"/>
</j:when>
<j:otherwise>
<span class="build-button-column-icon-reference-holder" data-id="${id}" data-url="${href}" data-notification="${%Task_scheduled(it.taskNoun(job))}"/>
<j:set var="title" value="${%Schedule_a_task(h.getRelativeDisplayNameFrom(job, itemGroup),it.taskNoun(job))}"/>
</j:otherwise>
</j:choose>
<j:set var="isQueued" value="${app.queue.contains(job)}"/>
<a id="${id}" tooltip="${title}" class="jenkins-table__button jenkins-!-build-color" href="${href}">
<span class="${isQueued ? 'pulse-animation': ''}">
<l:icon src="symbol-play" />
</span>
<st:adjunct includes="hudson.views.BuildButtonColumn.icon"/>
</a>
</div>
</j:if>
</x:element>
<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">
<td class="jenkins-table__cell--tight">
<j:if test="${job.buildable and job.hasPermission(job.BUILD)}">
<j:set var="id" value="${h.generateId()}"/>
<j:set var="href" value="${jobBaseUrl}${job.shortUrl}build?delay=0sec"/>
<div class="jenkins-table__cell__button-wrapper">
<j:choose>
<j:when test="${job.parameterized}">
<j:set var="title" value="${%Schedule_a_task_with_parameters(h.getRelativeDisplayNameFrom(job, itemGroup),it.taskNoun(job))}"/>
</j:when>
<j:otherwise>
<span class="build-button-column-icon-reference-holder" data-id="${id}" data-url="${href}" data-notification="${%Task_scheduled(it.taskNoun(job))}"/>
<j:set var="title" value="${%Schedule_a_task(h.getRelativeDisplayNameFrom(job, itemGroup),it.taskNoun(job))}"/>
</j:otherwise>
</j:choose>
<j:set var="isQueued" value="${app.queue.contains(job)}"/>
<a id="${id}" tooltip="${title}" class="jenkins-button jenkins-button--tertiary jenkins-!-build-color" href="${href}">
<l:icon src="symbol-play" class="${isQueued ? 'pulse-animation': ''}" />
<st:adjunct includes="hudson.views.BuildButtonColumn.icon"/>
</a>
</div>
</j:if>
</td>
</j:jelly>
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ THE SOFTWARE.
</td>
<td class="jenkins-table__cell--tight">
<div class="jenkins-table__cell__button-wrapper">
<a href="${it.getCloudUrl(request,app,cloud)}configure" class="jenkins-table__button">
<a href="${it.getCloudUrl(request,app,cloud)}configure" class="jenkins-button">
<l:icon src="symbol-settings"/>
</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/lib/hudson/buildHealth.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ THE SOFTWARE.
<div class="jenkins-table__cell__button-wrapper">
<j:choose>
<j:when test="${!empty(healthReports)}">
<a class="build-health-link jenkins-table__button" href="${empty(link)?'#':link}" style="${attrs.style}">
<a class="build-health-link jenkins-button jenkins-button--tertiary" href="${empty(link)?'#':link}" style="${attrs.style}">
<l:icon src="symbol-weather-${buildHealth.iconClassName}" />
</a>
</j:when>
Expand Down
2 changes: 1 addition & 1 deletion test/src/test/java/jenkins/security/Security2780Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void buildButtonTooltipHasNoXss() throws Exception {
AtomicBoolean alertTriggered = new AtomicBoolean(false);
wc.setAlertHandler((p, s) -> alertTriggered.set(true));
HtmlPage page = wc.goTo("");
page.executeJavaScript("document.querySelector('a.jenkins-table__button')._tippy.show()");
page.executeJavaScript("document.querySelector('.jenkins-table a.jenkins-button')._tippy.show()");
wc.waitForBackgroundJavaScript(2000L);
ScriptResult result = page.executeJavaScript("document.querySelector('.tippy-content').innerHTML;");
Object jsResult = result.getJavaScriptResult();
Expand Down
2 changes: 1 addition & 1 deletion war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ THE SOFTWARE.
<!-- dependency of junit -->
<groupId>io.jenkins.plugins</groupId>
<artifactId>checks-api</artifactId>
<version>2.0.2</version>
<version>2.2.0</version>
<type>hpi</type>
</artifactItem>

Expand Down
4 changes: 1 addition & 3 deletions war/src/main/scss/components/_icons.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,5 @@
}

.pulse-animation {
svg {
animation: pulse-animation 2s ease infinite;
}
animation: pulse-animation 2s ease infinite;
}
4 changes: 4 additions & 0 deletions war/src/main/scss/components/_side-panel-widgets.scss
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@
grid-template-columns: auto 1fr auto;
font-weight: 500 !important;

.build-health-link {
margin: -9px -15px;
}

.jenkins-table__cell--tight {
width: auto;
margin-right: 1rem;
Expand Down
16 changes: 14 additions & 2 deletions war/src/main/scss/components/_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,25 @@
}
}

.jenkins-button {
margin: -10px 0;
padding: 0.5rem 0.75rem;

svg,
.build-status-icon__wrapper,
svg {
width: 1.375rem !important;
height: 1.375rem !important;
}
}

&__button,
&__icon {
svg,
.build-status-icon__wrapper,
img {
width: 1.5rem !important;
height: 1.5rem !important;
width: 1.375rem !important;
height: 1.375rem !important;
}
}

Expand Down

0 comments on commit 2046f1e

Please sign in to comment.