Skip to content

Commit

Permalink
Use notice for views lacking jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Sep 12, 2024
1 parent bb7a30a commit c5128f4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
9 changes: 4 additions & 5 deletions core/src/main/resources/hudson/model/View/noJob.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
${%description_1}
<j:if test="${it.hasPermission(it.CONFIGURE)}">
${%description_2}
</j:if>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<l:notice text="${%description_1}"
description="${it.hasPermission(it.CONFIGURE) ? '%description_2' : null}"
icon="symbol-weather-icon-health-00to19" />
</j:jelly>
8 changes: 8 additions & 0 deletions core/src/main/resources/lib/layout/notice.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,18 @@ THE SOFTWARE.
<st:attribute name="icon" use="required">
Sets the icon for the notice. Supports Jenkins Symbols and regular images.
</st:attribute>
<st:attribute name="description">
Optional description for the notice. HTML is supported.
</st:attribute>
</st:documentation>

<div class="jenkins-notice">
<l:icon src="${attrs.icon}" />
<div>${attrs.text}</div>
<j:if test="${attrs.description != null}">
<div class="jenkins-notice__description">
<j:out value="${attrs.description}" />
</div>
</j:if>
</div>
</j:jelly>
9 changes: 8 additions & 1 deletion war/src/main/scss/components/_notice.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@
background: var(--button-background);
border-radius: 0.66rem;
font-size: var(--font-size-base);
margin-bottom: 30px;
margin-bottom: var(--section-padding);
font-weight: 500;
padding: calc(var(--section-padding) * 2);
text-align: center;

svg {
width: 2.5rem;
height: 2.5rem;
}

&__description {
color: var(--text-color-secondary);
margin-top: -0.375rem;
}
}

0 comments on commit c5128f4

Please sign in to comment.