Skip to content

Commit

Permalink
show node monitors on agent page (#8725)
Browse files Browse the repository at this point in the history
* show node monitors on agent page

add an advanced button on the agent page. When clicking it will show the
node monitors for this agent including any warnings/errors

* fix style
  • Loading branch information
mawinter69 authored Dec 13, 2023
1 parent 38d31c1 commit 64dc384
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
12 changes: 12 additions & 0 deletions core/src/main/java/hudson/model/Computer.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
import java.util.Enumeration;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -1161,6 +1162,17 @@ public String getSearchUrl() {
return r;
}

@Restricted(NoExternalUse.class)
public Map<NodeMonitor, Object> getMonitoringData() {
Map<NodeMonitor, Object> r = new LinkedHashMap<>();
for (NodeMonitor monitor : NodeMonitor.getAll()) {
if (monitor.getColumnCaption() != null) {
r.put(monitor, monitor.data(this));
}
}
return r;
}

/**
* Gets the system properties of the JVM on this computer.
* If this is the master, it returns the system property of the master computer.
Expand Down
14 changes: 13 additions & 1 deletion core/src/main/resources/hudson/model/Computer/index.jelly
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,19 @@ THE SOFTWARE.
<p>${%title.no_manual_launch(it.retentionStrategy.descriptor.displayName)}</p>
</j:if>

<j:if test="${it.node.assignedLabels.size() gt 1}">
<f:advanced title="${%Monitoring Data}">
<table class="jenkins-table jenkins-table--small jenkins-table--auto-width">
<j:forEach var="m" items="${it.monitoringData}">
<tr>
<td>${m.key.columnCaption}</td>
<j:set var="data" value="${m.value}"/>
<st:include page="column.jelly" from="${m.key}" />
</tr>
</j:forEach>
</table>
</f:advanced>

<j:if test="${it.node.assignedLabels.size() gt 1}">
<div class="jenkins-!-margin-bottom-3">
<h2>${%Labels}</h2>
<j:forEach var="entry" items="${it.node.labelCloud}">
Expand Down
4 changes: 4 additions & 0 deletions war/src/main/scss/components/_table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,10 @@
}
}

&--auto-width {
width: auto !important;
}

&--small {
--table-padding: 0.2rem;

Expand Down

0 comments on commit 64dc384

Please sign in to comment.