Skip to content

Commit edc277f

Browse files
committed
Fix: Display shutdown banner on new dashboard page
Address reviewer feedback by fixing the root cause: Root Cause Fix: - Modified app-build-bar::before CSS pseudo-element to only extend upward by section-padding instead of 1000px - This prevents hiding shutdown banners and system messages from plugins like customizable-header Changes: - _build.scss: Changed inset from -1000px to calc(var(--section-padding) * -1) - Removed redundant shutdown-banner calls from new-view-page.jelly, job-subpage.jelly, and run-subpage.jelly since main-panel.jelly already renders the banner (now visible with CSS fix) The shutdown-banner.jelly reusable component is retained for use by main-panel.jelly. Fixes #25946
1 parent 1bb6359 commit edc277f

File tree

4 files changed

+91
-30
lines changed

4 files changed

+91
-30
lines changed

core/src/main/resources/lib/layout/main-panel.jelly

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,40 +23,13 @@ THE SOFTWARE.
2323
-->
2424

2525
<?jelly escape-by-default='true'?>
26-
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:st="jelly:stapler" xmlns:d="jelly:define">
26+
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout">
2727
<st:documentation>
2828
Generates the body as the main content part of a Jenkins page.
2929
</st:documentation>
3030

3131
<j:if test="${mode=='main-panel'}">
32-
<j:if test="${app.isQuietingDown()}">
33-
<j:choose>
34-
<j:when test="${app.isPreparingSafeRestart()}">
35-
<div id='safe-restart-msg'>
36-
<j:choose>
37-
<j:when test="${!app.getQuietDownReason().trim().isEmpty()}">
38-
${app.getQuietDownReason()}
39-
</j:when>
40-
<j:otherwise>
41-
${%saferestart}
42-
</j:otherwise>
43-
</j:choose>
44-
</div>
45-
</j:when>
46-
<j:otherwise>
47-
<div id='shutdown-msg'>
48-
<j:choose>
49-
<j:when test="${app.getQuietDownReason() != null}">
50-
${app.getQuietDownReason()}
51-
</j:when>
52-
<j:otherwise>
53-
${%shutdown}
54-
</j:otherwise>
55-
</j:choose>
56-
</div>
57-
</j:otherwise>
58-
</j:choose>
59-
</j:if>
32+
<l:shutdown-banner />
6033
<a id="skip2content" />
6134
<x:comment>&#10;start of main content ⇒&#10;</x:comment>
6235
<d:invokeBody />
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<!--
2+
The MIT License
3+
4+
Copyright (c) 2025, CloudBees, Inc.
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.
23+
-->
24+
25+
<?jelly escape-by-default='true'?>
26+
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler">
27+
<st:documentation>
28+
Displays a shutdown or safe restart banner when Jenkins is preparing for shutdown.
29+
30+
This component checks if Jenkins is quieting down (preparing for shutdown or safe restart)
31+
and displays an appropriate banner message to inform users that no new builds can be started.
32+
</st:documentation>
33+
34+
<j:if test="${app.isQuietingDown()}">
35+
<j:choose>
36+
<j:when test="${app.isPreparingSafeRestart()}">
37+
<div id="safe-restart-msg">
38+
<j:choose>
39+
<j:when test="${!app.getQuietDownReason().trim().isEmpty()}">
40+
${app.getQuietDownReason()}
41+
</j:when>
42+
<j:otherwise>
43+
${%saferestart}
44+
</j:otherwise>
45+
</j:choose>
46+
</div>
47+
</j:when>
48+
<j:otherwise>
49+
<div id="shutdown-msg">
50+
<j:choose>
51+
<j:when test="${app.getQuietDownReason() != null}">
52+
${app.getQuietDownReason()}
53+
</j:when>
54+
<j:otherwise>
55+
${%shutdown}
56+
</j:otherwise>
57+
</j:choose>
58+
</div>
59+
</j:otherwise>
60+
</j:choose>
61+
</j:if>
62+
</j:jelly>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# The MIT License
2+
#
3+
# Copyright (c) 2025, CloudBees, Inc.
4+
#
5+
# Permission is hereby granted, free of charge, to any person obtaining a copy
6+
# of this software and associated documentation files (the "Software"), to deal
7+
# in the Software without restriction, including without limitation the rights
8+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
# copies of the Software, and to permit persons to whom the Software is
10+
# furnished to do so, subject to the following conditions:
11+
#
12+
# The above copyright notice and this permission notice shall be included in
13+
# all copies or substantial portions of the Software.
14+
#
15+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
# THE SOFTWARE.
22+
23+
shutdown=The Jenkins Controller is preparing for shutdown. No new builds can be started.
24+
saferestart=The Jenkins Controller is restarting safely. Running builds will finish or continue afterwards, depending on the job type. No new builds can be started.

src/main/scss/pages/_build.scss

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,9 @@ body:has(.app-settings-container) {
198198
&::before {
199199
content: "";
200200
position: absolute;
201-
inset: -1000px calc(var(--section-padding) * -1) 0;
201+
// Only extend upward by section-padding to cover the gap, not beyond
202+
// This prevents hiding shutdown banners and system messages above the main panel
203+
inset: calc(var(--section-padding) * -1) calc(var(--section-padding) * -1) 0;
202204
background-color: var(--background);
203205
border-bottom: var(--jenkins-border-width) solid var(--card-border-color);
204206
z-index: -1;

0 commit comments

Comments
 (0)