From 2d97ae6770bb17112925a95a8eaf57a6c9959483 Mon Sep 17 00:00:00 2001 From: raymond zhao Date: Wed, 28 May 2025 13:35:40 -0400 Subject: [PATCH 1/3] Add RAR to GUI Status --- .../core/remoteagentregistry/status/status.go | 4 +- .../status_templates/remote_agents_html.tmpl | 51 +++++++++++++++++++ 2 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 comp/core/remoteagentregistry/status/status_templates/remote_agents_html.tmpl diff --git a/comp/core/remoteagentregistry/status/status.go b/comp/core/remoteagentregistry/status/status.go index dc32a9b2c0d3..6191b4a78283 100644 --- a/comp/core/remoteagentregistry/status/status.go +++ b/comp/core/remoteagentregistry/status/status.go @@ -64,6 +64,6 @@ func (p Provider) Text(_ bool, buffer io.Writer) error { } // HTML renders the html output -func (p Provider) HTML(_ bool, _ io.Writer) error { - return nil +func (p Provider) HTML(_ bool, buffer io.Writer) error { + return status.RenderHTML(templatesFS, "remote_agents_html.tmpl", buffer, p.getStatusInfo()) } diff --git a/comp/core/remoteagentregistry/status/status_templates/remote_agents_html.tmpl b/comp/core/remoteagentregistry/status/status_templates/remote_agents_html.tmpl new file mode 100644 index 000000000000..e45eae860ec8 --- /dev/null +++ b/comp/core/remoteagentregistry/status/status_templates/remote_agents_html.tmpl @@ -0,0 +1,51 @@ +{{- /* Go Template */ -}} + +
+ Remote Agents + + {{ if not .registeredAgents }} + No remote agents registered + {{ else }} + {{ len .registeredAgents }} remote agent(s) registered: + {{- range $agent := .registeredAgents }} + + {{ $agent.DisplayName }}
+
+ + Last seen: {{ formatUnixTime $agent.LastSeenUnix }} ({{ formatUnixTimeSince $agent.LastSeenUnix }})
+
+ {{- end }} + {{ end }} +
+ {{- with .registeredAgentStatuses }} + {{- range $agentStatus := . }} + {{- with $agentStatus }} + + {{ .DisplayName }} + + + {{ if .FailureReason }} + Failure: {{ .FailureReason }} + {{ end }} + {{- if .MainSection }} + {{ range $key, $value := .MainSection -}} + {{ $key }}: {{ $value }}
+ {{ end }} + {{- end }} + + {{- if .NamedSections }} + {{- range $sectionName, $section := .NamedSections }} + {{ $sectionName }}:
+
    + {{- range $key, $value := $section }} +
  • {{ $key }}: {{ $value }} + {{- end }} +
+ {{ end }} + {{- end }} +
+ {{- end }} + {{- end }} + {{- end -}} +
+
From fcb7c47494c487d83d5a638ce15384344284bd4f Mon Sep 17 00:00:00 2001 From: raymond zhao Date: Wed, 28 May 2025 13:50:28 -0400 Subject: [PATCH 2/3] Remove unnecessary comment --- .../status/status_templates/remote_agents_html.tmpl | 2 -- 1 file changed, 2 deletions(-) diff --git a/comp/core/remoteagentregistry/status/status_templates/remote_agents_html.tmpl b/comp/core/remoteagentregistry/status/status_templates/remote_agents_html.tmpl index e45eae860ec8..17ead41fd5e0 100644 --- a/comp/core/remoteagentregistry/status/status_templates/remote_agents_html.tmpl +++ b/comp/core/remoteagentregistry/status/status_templates/remote_agents_html.tmpl @@ -1,5 +1,3 @@ -{{- /* Go Template */ -}} -
Remote Agents From 09524e8d86277599a8bbb46eee68dfb99a00ef4b Mon Sep 17 00:00:00 2001 From: raymond zhao Date: Wed, 28 May 2025 14:37:27 -0400 Subject: [PATCH 3/3] Create separate title for each Remote Agent --- .../status/status_templates/remote_agents_html.tmpl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/comp/core/remoteagentregistry/status/status_templates/remote_agents_html.tmpl b/comp/core/remoteagentregistry/status/status_templates/remote_agents_html.tmpl index 17ead41fd5e0..f89b7a14ad8f 100644 --- a/comp/core/remoteagentregistry/status/status_templates/remote_agents_html.tmpl +++ b/comp/core/remoteagentregistry/status/status_templates/remote_agents_html.tmpl @@ -14,11 +14,11 @@ {{- end }} {{ end }} -
+ {{- with .registeredAgentStatuses }} {{- range $agentStatus := . }} {{- with $agentStatus }} - + {{ .DisplayName }} @@ -45,5 +45,4 @@ {{- end }} {{- end }} {{- end -}} -