From f9bd09a2b40a2e40a893d0d6ac82635ab8b8992f Mon Sep 17 00:00:00 2001 From: rcourtman Date: Fri, 28 Nov 2025 12:07:28 +0000 Subject: [PATCH] Add UI for removed Docker hosts re-enrollment Adds a "Removed Docker Hosts" section to Settings -> Agents that displays hosts blocked from re-enrolling and provides an "Allow re-enroll" button. The backend API already existed; this adds the missing frontend component. Related to #773 --- .../src/components/Settings/UnifiedAgents.tsx | 67 ++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/frontend-modern/src/components/Settings/UnifiedAgents.tsx b/frontend-modern/src/components/Settings/UnifiedAgents.tsx index 7c71468..c127a3d 100644 --- a/frontend-modern/src/components/Settings/UnifiedAgents.tsx +++ b/frontend-modern/src/components/Settings/UnifiedAgents.tsx @@ -6,7 +6,7 @@ import { MonitoringAPI } from '@/api/monitoring'; import { SecurityAPI } from '@/api/security'; import { notificationStore } from '@/stores/notifications'; import type { SecurityStatus } from '@/types/config'; -import type { HostLookupResponse } from '@/types/api'; +import type { HostLookupResponse, RemovedDockerHost } from '@/types/api'; import type { APITokenRecord } from '@/api/security'; import { HOST_AGENT_SCOPE, DOCKER_REPORT_SCOPE } from '@/constants/apiScopes'; import { copyToClipboard } from '@/utils/clipboard'; @@ -302,6 +302,12 @@ export const UnifiedAgents: Component = () => { const legacyAgents = createMemo(() => allHosts().filter(h => h.isLegacy)); const hasLegacyAgents = createMemo(() => legacyAgents().length > 0); + const removedDockerHosts = createMemo(() => { + const removed = state.removedDockerHosts || []; + return removed.sort((a, b) => b.removedAt - a.removedAt); + }); + const hasRemovedDockerHosts = createMemo(() => removedDockerHosts().length > 0); + const getUpgradeCommand = (_hostname: string) => { const token = resolvedToken(); return `curl -fsSL ${pulseUrl()}/install.sh | sudo bash -s -- --url ${pulseUrl()} --token ${token}`; @@ -323,6 +329,16 @@ export const UnifiedAgents: Component = () => { } }; + const handleAllowReenroll = async (hostId: string, hostname?: string) => { + try { + await MonitoringAPI.allowDockerHostReenroll(hostId); + notificationStore.success(`Re-enrollment allowed for ${hostname || hostId}. Restart the agent to reconnect.`); + } catch (err) { + logger.error('Failed to allow re-enrollment', err); + notificationStore.error('Failed to allow re-enrollment'); + } + }; + return (
@@ -711,6 +727,55 @@ export const UnifiedAgents: Component = () => { + + + +
+

Removed Docker Hosts

+

+ Docker hosts that were removed and are blocked from re-enrolling. Allow re-enrollment to let them report again. +

+
+ + + + + + + + + + + + + + {(host) => ( + + + + + + + )} + + +
HostnameHost IDRemovedActions
+ {host.displayName || host.hostname || 'Unknown'} + + {host.id.slice(0, 8)}... + + {formatRelativeTime(host.removedAt)} + + +
+
+
+
); };