Skip to content

Commit 0a20678

Browse files
committed
make monitoring data a dialog to be opened from details-bar
1 parent 7e3d87c commit 0a20678

5 files changed

Lines changed: 92 additions & 36 deletions

File tree

core/src/main/java/hudson/model/Computer.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@
114114
import jenkins.model.IDisplayExecutor;
115115
import jenkins.model.Jenkins;
116116
import jenkins.model.Tab;
117+
import jenkins.model.details.Detail;
118+
import jenkins.model.details.DetailFactory;
119+
import jenkins.model.details.MonitoringDetails;
117120
import jenkins.search.SearchGroup;
118121
import jenkins.security.ExtendedReadRedaction;
119122
import jenkins.security.ImpersonatingExecutorService;
@@ -1807,4 +1810,18 @@ public List<Tab> getAgentTabs() {
18071810
new Permission[] { EXTENDED_READ, CONNECT };
18081811

18091812
private static final Logger LOGGER = Logger.getLogger(Computer.class.getName());
1813+
1814+
@Extension
1815+
public static final class BasicComputerDetailFactory extends DetailFactory<Computer> {
1816+
1817+
@Override
1818+
public Class<Computer> type() {
1819+
return Computer.class;
1820+
}
1821+
1822+
@NonNull @Override public List<? extends Detail> createFor(@NonNull Computer target) {
1823+
return List.of(new MonitoringDetails(target));
1824+
}
1825+
}
1826+
18101827
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package jenkins.model.details;
2+
3+
import hudson.model.Computer;
4+
5+
public class MonitoringDetails extends Detail{
6+
public MonitoringDetails(Computer computer) {
7+
super(computer);
8+
}
9+
}

core/src/main/resources/jenkins/agent/OverviewTab/index.jelly

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@ THE SOFTWARE.
2626
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
2727
<l:agent-subpage agent="${it.object}">
2828
<l:app-bar title="${it.displayName}" headingLevel="h2">
29-
<div class="app-agent-overview__app-bar-controls">
30-
<t:help href="https://www.jenkins.io/doc/book/using/using-agents/" />
29+
<l:details-bar it="${it.object}">
30+
<a href="https://www.jenkins.io/doc/book/using/using-agents/" class="jenkins-button jenkins-details__button" tooltip="%Help" target="_blank" rel="noopener noreferrer">
31+
<l:icon src="symbol-help-circle" />
32+
</a>
3133
<t:editDescriptionButton permission="${it.CONFIGURE}"
3234
compact="true" />
33-
</div>
35+
</l:details-bar>
3436
</l:app-bar>
3537
<j:set var="it" value="${it.object}" />
3638
<st:include page="index-top.jelly" it="${it}" />
@@ -51,12 +53,12 @@ THE SOFTWARE.
5153
</j:if>
5254

5355
<div class="app-agent-overview__grid">
54-
<j:forEach var="box" items="${it.computerPanelBoxs}">
55-
<st:include it="${box}" page="box.jelly" />
56-
</j:forEach>
57-
<j:forEach var="a" items="${it.widgets}">
58-
<st:include page="index.jelly" from="${a}" optional="true" it="${a}" />
59-
</j:forEach>
56+
<j:forEach var="box" items="${it.computerPanelBoxs}">
57+
<st:include it="${box}" page="box.jelly" />
58+
</j:forEach>
59+
<j:forEach var="a" items="${it.widgets}">
60+
<st:include page="index.jelly" from="${a}" optional="true" it="${a}" />
61+
</j:forEach>
6062
<l:card title="${%Labels}">
6163
<div class="app-agent-overview__labels">
6264
<j:if test="${it.node.assignedLabels.size() gt 1}">
@@ -72,19 +74,6 @@ THE SOFTWARE.
7274
</j:if>
7375
</div>
7476
</l:card>
75-
<l:card title="${%Monitoring Data}">
76-
<table class="jenkins-table jenkins-table--small jenkins-table--auto-width">
77-
<tbody>
78-
<j:forEach var="m" items="${it.monitoringData}">
79-
<tr>
80-
<td>${m.key.columnCaption}</td>
81-
<j:set var="data" value="${m.value}"/>
82-
<st:include page="column.jelly" from="${m.key}" />
83-
</tr>
84-
</j:forEach>
85-
</tbody>
86-
</table>
87-
</l:card>
8877
</div>
8978
<l:card title="${%Node properties}" id="app-agent-overview__node-properties">
9079
<st:include page="nodepropertysummaries.jelly" />
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<!--
2+
The MIT License
3+
4+
Copyright (c) 2024 Jan Faracik
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" xmlns:l="/lib/layout" xmlns:t="/lib/hudson">
27+
<l:dialog title="${%Monitoring Data}">
28+
<table class="jenkins-table jenkins-table--small">
29+
<tbody>
30+
<j:forEach var="m" items="${it.object.monitoringData}">
31+
<tr>
32+
<td>${m.key.columnCaption}</td>
33+
<j:set var="data" value="${m.value}"/>
34+
<st:include page="column.jelly" from="${m.key}" />
35+
</tr>
36+
</j:forEach>
37+
</tbody>
38+
</table>
39+
</l:dialog>
40+
41+
<button class="jenkins-details__item"
42+
data-type="dialog-opener"
43+
data-dialog-id="${dialogId}">
44+
<div class="jenkins-details__item__icon">
45+
<l:icon src="symbol-list" />
46+
</div>
47+
<span>
48+
${%Monitoring Data}
49+
</span>
50+
</button>
51+
52+
</j:jelly>

src/main/scss/pages/_agent.scss

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,11 @@
3333
max-width: 330px;
3434
}
3535

36-
& > div:nth-last-child(2) {
36+
& > div:last-of-type {
3737
flex-grow: 1; /* takes remaining space */
3838
min-width: 0; /* important for overflow handling */
3939
}
4040

41-
& > div:last-of-type {
42-
flex-shrink: 0;
43-
}
44-
4541
.jenkins-table {
4642
margin-bottom: 0;
4743
border-spacing: 2px;
@@ -52,15 +48,8 @@
5248
}
5349
}
5450

55-
.app-agent-overview__app-bar-controls {
56-
display: flex;
57-
align-items: center;
58-
justify-content: center;
59-
gap: 0.75rem;
60-
}
61-
62-
.app-agent-overview__app-bar-controls .jenkins-details__button {
63-
min-height: 2.375rem;
51+
.app-agent-content .jenkins-details .jenkins-button {
52+
min-height: 2rem;
6453
}
6554

6655
.app-agent-overview__labels {

0 commit comments

Comments
 (0)