Skip to content

Commit 17abe4f

Browse files
Refine badges in Jenkins (#11254)
Co-authored-by: Kris Stern <krisstern@outlook.com>
1 parent 45c2842 commit 17abe4f

File tree

15 files changed

+80
-78
lines changed

15 files changed

+80
-78
lines changed

core/src/main/resources/hudson/PluginManager/updates.jelly

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ THE SOFTWARE.
131131
<j:forEach var="label" items="${p.categories}">
132132
<j:if test="${!it.isMetaLabel(label)}">
133133
<a href="?filter=${app.updateCenter.getCategoryDisplayName(label)}"
134-
class="jenkins-table__link jenkins-table__badge">
134+
class="jenkins-badge">
135135
${app.updateCenter.getCategoryDisplayName(label)}
136136
</a>
137137
</j:if>

core/src/main/resources/hudson/model/Job/buildTimeTrend_resources.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,7 @@ window.displayBuilds = function (data) {
123123
a1.appendChild(span1);
124124
td2.appendChild(a1);
125125
var a2 = document.createElement("a");
126-
a2.classList.add(
127-
"jenkins-table__link",
128-
"jenkins-table__badge",
129-
"model-link",
130-
"inside",
131-
);
126+
a2.classList.add("jenkins-badge", "model-link");
132127
a2.href = rootUrl + "/" + e.url;
133128
a2.textContent = e.displayName;
134129
td2.appendChild(a2);

core/src/main/resources/hudson/views/DefaultViewsTabBar/viewTabs.jelly

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,7 @@ THE SOFTWARE.
3636
<l:icon src="${tab.iconFileName}" />
3737
</j:if>
3838
${tab.displayName}
39-
<j:if test="${tab.badge != null}">
40-
<div class="pill jenkins-!-${tab.badge.severity}-color" aria-label="${tab.badge.tooltip}">
41-
${tab.badge.text}
42-
</div>
43-
</j:if>
39+
<l:badge badge="${tab.badge}" />
4440
</a>
4541
</j:forEach>
4642

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ THE SOFTWARE.
2929
<j:choose>
3030
<j:when test="${lfBuild!=null}">
3131
${lfBuild.timestampString}
32-
<a href="${jobBaseUrl}${job.shortUrl}lastFailedBuild/" class="jenkins-table__link jenkins-table__badge model-link inside">${lfBuild.displayName}</a>
32+
<a href="${jobBaseUrl}${job.shortUrl}lastFailedBuild/" class="jenkins-badge model-link">${lfBuild.displayName}</a>
3333
</j:when>
3434
<j:otherwise>
3535
${%N/A}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ THE SOFTWARE.
2929
<j:choose>
3030
<j:when test="${lstBuild!=null}">
3131
${lstBuild.timestampString}
32-
<a href="${jobBaseUrl}${job.shortUrl}lastStableBuild/" class="jenkins-table__link jenkins-table__badge model-link inside">${lstBuild.displayName}</a>
32+
<a href="${jobBaseUrl}${job.shortUrl}lastStableBuild/" class="jenkins-badge model-link">${lstBuild.displayName}</a>
3333
</j:when>
3434
<j:otherwise>
3535
${%N/A}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ THE SOFTWARE.
2929
<j:choose>
3030
<j:when test="${lsBuild!=null}">
3131
${lsBuild.timestampString}
32-
<a href="${jobBaseUrl}${job.shortUrl}lastSuccessfulBuild/" class="jenkins-table__link jenkins-table__badge model-link inside">${lsBuild.displayName}</a>
32+
<a href="${jobBaseUrl}${job.shortUrl}lastSuccessfulBuild/" class="jenkins-badge model-link">${lsBuild.displayName}</a>
3333
</j:when>
3434
<j:otherwise>
3535
${%N/A}

core/src/main/resources/lib/layout/tabs.jelly

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,7 @@ THE SOFTWARE.
4141
<l:icon src="${tab.iconFileName}" />
4242
</j:if>
4343
${tab.displayName}
44-
<j:if test="${tab.badge != null}">
45-
<div class="pill jenkins-!-${tab.badge.severity}-color" aria-label="${tab.badge.tooltip}">
46-
${tab.badge.text}
47-
</div>
48-
</j:if>
44+
<l:badge badge="${tab.badge}" />
4945
</a>
5046
</j:forEach>
5147
</div>

src/main/js/templates/plugin-manager/available.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
{{#if this.categories }}
2020
<div class="app-plugin-manager__categories">
2121
{{#each this.categories }}
22-
<a href="?filter={{ this }}" class="jenkins-table__link jenkins-table__badge">
22+
<a href="?filter={{ this }}" class="jenkins-badge">
2323
{{ this }}
2424
</a>
2525
{{/each}}

src/main/scss/abstracts/_colors.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222

2323
@each $key, $value in theme.$semantics {
2424
.jenkins-\!-#{$key}-color {
25-
--color: #{$value};
25+
--color: var(--#{$key}-color);
2626

27-
color: #{$value} !important;
27+
color: var(--#{$key}-color) !important;
2828
}
2929
}
3030

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,35 @@
1+
@use "../abstracts/mixins";
2+
3+
a.jenkins-badge,
4+
button.jenkins-badge {
5+
pointer-events: auto;
6+
}
7+
18
.jenkins-badge {
9+
@include mixins.item;
10+
11+
--item-background: color-mix(
12+
in sRGB,
13+
var(--color, var(--accent-color)) 7.5%,
14+
var(--background)
15+
);
16+
--item-background--hover: color-mix(
17+
in sRGB,
18+
var(--color, var(--accent-color)) 12.5%,
19+
var(--background)
20+
);
21+
--item-background--active: color-mix(
22+
in sRGB,
23+
var(--color, var(--accent-color)) 17.5%,
24+
var(--background)
25+
);
26+
--item-box-shadow--focus: color-mix(
27+
in sRGB,
28+
var(--color, var(--accent-color)) 10%,
29+
var(--background)
30+
);
31+
32+
position: relative;
233
display: inline-flex;
334
align-items: center;
435
justify-content: center;
@@ -7,18 +38,19 @@
738
font-weight: 400;
839
min-height: 20px;
940
min-width: 20px;
10-
padding: 0 0.4rem;
11-
background: color-mix(
12-
in sRGB,
13-
var(--text-color-secondary) 12.5%,
14-
transparent
15-
);
41+
padding: 0 0.375rem;
42+
gap: 0.35rem;
43+
pointer-events: none;
44+
text-box: cap alphabetic;
45+
46+
&::before {
47+
border: var(--jenkins-border-width) solid
48+
oklch(from currentColor l c h / 0.17);
49+
background-clip: padding-box;
50+
}
1651

17-
&[class*="color"] {
18-
background: color-mix(in sRGB, var(--color) 85%, transparent);
19-
color: var(--white) !important;
20-
box-shadow: inset 0 -1px 2px var(--color, var(--text-color-secondary));
21-
text-shadow: 0 1px 1px rgb(0 0 0 / 0.1);
22-
backdrop-filter: blur(2.5px);
52+
svg {
53+
width: 0.75rem;
54+
height: 0.75rem;
2355
}
2456
}

0 commit comments

Comments
 (0)