Skip to content

Commit

Permalink
Use Notice component for views lacking jobs (jenkinsci#9724)
Browse files Browse the repository at this point in the history
* Use notice for views lacking jobs

* Update _notice.scss

* Rename text to title, use 'invokeBody' rather than description field
  • Loading branch information
janfaracik authored Sep 15, 2024
1 parent 7ff5aaa commit 239ced0
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ THE SOFTWARE.

<j:choose>
<j:when test="${noPlugins}">
<l:notice icon="symbol-plugins" text="${%No plugins installed}" />
<l:notice icon="symbol-plugins" title="${%No plugins installed}" />
</j:when>
<j:otherwise>
<table id="plugins" class="jenkins-table sortable">
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/resources/hudson/PluginManager/updates.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ THE SOFTWARE.
</table>
</j:when>
<j:otherwise>
<l:notice icon="symbol-up-to-date" text="${%No updates available}" />
<l:notice icon="symbol-up-to-date" title="${%No updates available}" />
</j:otherwise>
</j:choose>
<d:invokeBody/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ THE SOFTWARE.
</l:app-bar>

<j:if test="${noLogs}">
<l:notice text="${%No logs available}" icon="symbol-journal" />
<l:notice title="${%No logs available}" icon="symbol-journal" />
</j:if>

<t:logRecords logRecords="${it.logRecords}"/>
Expand Down
11 changes: 6 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,10 @@ 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 title="${%description_1}" icon="symbol-weather-icon-health-00to19">
<j:if test="${it.hasPermission(it.CONFIGURE)}">
${%description_2}
</j:if>
</l:notice>
</j:jelly>
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ THE SOFTWARE.

<j:choose>
<j:when test="${empty(app.pluginManager.plugins) and empty(app.pluginManager.failedPlugins)}">
<l:notice icon="symbol-plugins" text="${%No plugins installed}" />
<l:notice icon="symbol-plugins" title="${%No plugins installed}" />
</j:when>
<j:otherwise>
<table class="jenkins-table sortable">
Expand Down
11 changes: 7 additions & 4 deletions core/src/main/resources/lib/layout/notice.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ THE SOFTWARE.
-->

<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout">
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:d="jelly:define">
<st:documentation>
<st:attribute name="text" use="required">
Sets the text for the notice. HTML isn't supported.
<st:attribute name="title" use="required">
Sets the title for the notice. HTML isn't supported.
</st:attribute>
<st:attribute name="icon" use="required">
Sets the icon for the notice. Supports Jenkins Symbols and regular images.
Expand All @@ -35,6 +35,9 @@ THE SOFTWARE.

<div class="jenkins-notice">
<l:icon src="${attrs.icon}" />
<div>${attrs.text}</div>
<div>${attrs.title}</div>
<div class="jenkins-notice__description">
<d:invokeBody />
</div>
</div>
</j:jelly>
15 changes: 13 additions & 2 deletions war/src/main/scss/components/_notice.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,22 @@
background: var(--button-background);
border-radius: 0.66rem;
font-size: var(--font-size-base);
margin-bottom: 30px;
font-weight: 500;
margin-bottom: var(--section-padding);
font-weight: 450;
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;

&:empty {
display: none;
}
}
}

0 comments on commit 239ced0

Please sign in to comment.