(control) Add a summary table for Actors in the Node overview

This commit is contained in:
Viktor Lofgren 2024-01-12 16:32:15 +01:00
parent 56d832d661
commit 98c0972619
6 changed files with 38 additions and 5 deletions

View File

@ -14,7 +14,7 @@ public record ActorRunState(String name,
public String stateIcon() { public String stateIcon() {
if (terminal) { if (terminal) {
return "\uD83D\uDE34"; return "\uD83D\uDC80"; // Unicode Skull
} }
else if (state.equals("MONITOR")) { else if (state.equals("MONITOR")) {
return "\uD83D\uDD26"; return "\uD83D\uDD26";

View File

@ -319,12 +319,18 @@ public class ControlNodeService {
private Object nodeOverviewModel(Request request, Response response) throws SQLException { private Object nodeOverviewModel(Request request, Response response) throws SQLException {
int nodeId = Integer.parseInt(request.params("id")); int nodeId = Integer.parseInt(request.params("id"));
var config = nodeConfigurationService.get(nodeId); var config = nodeConfigurationService.get(nodeId);
var actors = executorClient.getActorStates(Context.fromRequest(request), nodeId).states();
actors.removeIf(actor -> actor.state().equals("MONITOR"));
return Map.of( return Map.of(
"node", new IndexNode(nodeId), "node", new IndexNode(nodeId),
"status", getStatus(config), "status", getStatus(config),
"events", getEvents(nodeId), "events", getEvents(nodeId),
"processes", heartbeatService.getProcessHeartbeatsForNode(nodeId), "processes", heartbeatService.getProcessHeartbeatsForNode(nodeId),
"jobs", heartbeatService.getTaskHeartbeatsForNode(nodeId), "jobs", heartbeatService.getTaskHeartbeatsForNode(nodeId),
"actors", actors,
"tab", Map.of("overview", true) "tab", Map.of("overview", true)
); );
} }

View File

@ -11,6 +11,7 @@
<div class="mt-2"> <div class="mt-2">
{{> control/partials/processes-table }} {{> control/partials/processes-table }}
{{> control/partials/actor-summary-table }}
</div> </div>
<div class="mt-2"> <div class="mt-2">
{{> control/partials/events-table-summary }} {{> control/partials/events-table-summary }}
@ -21,7 +22,7 @@
{{> control/partials/foot-includes }} {{> control/partials/foot-includes }}
<script> <script>
window.setInterval(() => { window.setInterval(() => {
refresh(["processes", "jobs", "events"]); refresh(["processes", "jobs", "events", "actors"]);
}, 2000); }, 2000);
</script> </script>
</html> </html>

View File

@ -15,8 +15,14 @@
{{#if nodes}} {{#if nodes}}
<div class="my-3 p-3 border bg-light"> <div class="my-3 p-3 border bg-light">
<p>
Index nodes are processing units. The search engine requires at least one, but more can be added Index nodes are processing units. The search engine requires at least one, but more can be added
to spread the system load across multiple physical disks or even multiple servers. to spread the system load across multiple physical disks or even multiple servers.
</p>
<p>
New index nodes register themselves automatically upon start-up. They can't be fully removed,
but can be disabled in the settings.
</p>
</div> </div>
<table class="table"> <table class="table">

View File

@ -0,0 +1,20 @@
<h2>Actor Summary</h2>
<small class="text-muted">Idle monitoring actors are hidden. See the <a href="/nodes/{{node.id}}/actors">Actors tab</a>
for a complete view.</small>
<table id="actors" class="table">
<tr>
<th>Actor</th>
<th>State</th>
</tr>
{{#each actors}}
<tr>
<td title="{{actorDescription}}">{{name}}</td>
<td title="{{stateDescription}}">{{stateIcon}}&nbsp;{{state}}</td>
</tr>
{{/each}}
{{#unless actors}}
<tr>
<td colspan="2">No activity</td>
</tr>
{{/unless}}
</table>