Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

fix: Remove agent should delete all types, not just first (#898)

rcourtmanda0e0495adf2
diff --git a/frontend-modern/src/components/Hosts/HostsOverview.tsx b/frontend-modern/src/components/Hosts/HostsOverview.tsx
index 7594efce81..d8f08ed1c8 100644
--- a/frontend-modern/src/components/Hosts/HostsOverview.tsx
+++ b/frontend-modern/src/components/Hosts/HostsOverview.tsx
@@ -990,6 +990,7 @@ const HostRow: Component<HostRowProps> = (props) => {
};
const hostStatus = createMemo(() => getHostStatusIndicator(host));
+ const isOnline = () => host.status === 'online';
const cpuPercent = host.cpuUsage ?? 0;
const memPercent = host.memory?.usage ?? 0;
const diskStats = props.getDiskStats(host);
@@ -999,7 +1000,8 @@ const HostRow: Component<HostRowProps> = (props) => {
const hover = 'hover:bg-gray-50 dark:hover:bg-gray-800/50';
const clickable = aiChatStore.enabled ? 'cursor-pointer' : '';
const aiContext = isInAIContext() ? 'ai-context-row' : '';
- return `${base} ${hover} ${clickable} ${aiContext}`;
+ const offline = !isOnline() ? 'opacity-60' : '';
+ return `${base} ${hover} ${clickable} ${aiContext} ${offline}`;
};
return (
@@ -1095,60 +1097,66 @@ const HostRow: Component<HostRowProps> = (props) => {
{/* CPU */}
<Show when={props.isColVisible('cpu')}>
<td class="px-2 py-1 align-middle" style={{ "min-width": "140px" }}>
- <Show when={props.isMobile()}>
- <div class="md:hidden flex justify-center">
- <MetricText value={cpuPercent} type="cpu" />
+ <Show when={isOnline()} fallback={<div class="flex justify-center"><span class="text-xs text-gray-400">—</span></div>}>
+ <Show when={props.isMobile()}>
+ <div class="md:hidden flex justify-center">
+ <MetricText value={cpuPercent} type="cpu" />
+ </div>
+ </Show>
+ <div class="hidden md:block">
+ <EnhancedCPUBar
+ usage={cpuPercent}
+ loadAverage={host.loadAverage?.[0]}
+ cores={host.cpuCount}
+ />
</div>
</Show>
- <div class="hidden md:block">
- <EnhancedCPUBar
- usage={cpuPercent}
- loadAverage={host.loadAverage?.[0]}
- cores={host.cpuCount}
- />
- </div>
</td>
</Show>
{/* Memory */}
<Show when={props.isColVisible('memory')}>
<td class="px-2 py-1 align-middle" style={{ "min-width": "140px" }}>
- <Show when={props.isMobile()}>
- <div class="md:hidden flex justify-center">
- <MetricText value={memPercent} type="memory" />
+ <Show when={isOnline()} fallback={<div class="flex justify-center"><span class="text-xs text-gray-400">—</span></div>}>
+ <Show when={props.isMobile()}>
+ <div class="md:hidden flex justify-center">
+ <MetricText value={memPercent} type="memory" />
+ </div>
+ </Show>
+ <div class="hidden md:block">
+ <StackedMemoryBar
+ used={host.memory?.used || 0}
+ total={host.memory?.total || 0}
+ balloon={host.memory?.balloon || 0}
+ swapUsed={host.memory?.swapUsed || 0}
+ swapTotal={host.memory?.swapTotal || 0}
+ />
</div>
</Show>
- <div class="hidden md:block">
- <StackedMemoryBar
- used={host.memory?.used || 0}
- total={host.memory?.total || 0}
- balloon={host.memory?.balloon || 0}
- swapUsed={host.memory?.swapUsed || 0}
- swapTotal={host.memory?.swapTotal || 0}
- />
- </div>
</td>
</Show>
{/* Disk */}
<Show when={props.isColVisible('disk')}>
<td class="px-2 py-1 align-middle" style={{ "min-width": "140px" }}>
- <Show when={props.isMobile()}>
- <div class="md:hidden flex justify-center">
- <MetricText value={diskStats.percent} type="disk" />
+ <Show when={isOnline()} fallback={<div class="flex justify-center"><span class="text-xs text-gray-400">—</span></div>}>
+ <Show when={props.isMobile()}>
+ <div class="md:hidden flex justify-center">
+ <MetricText value={diskStats.percent} type="disk" />
+ </div>
+ </Show>
+ <div class="hidden md:block">
+ <StackedDiskBar
+ disks={host.disks}
+ aggregateDisk={{
+ total: diskStats.total,
+ used: diskStats.used,
+ free: diskStats.total - diskStats.used,
+ usage: diskStats.percent / 100
+ }}
+ />
</div>
</Show>
- <div class="hidden md:block">
- <StackedDiskBar
- disks={host.disks}
- aggregateDisk={{
- total: diskStats.total,
- used: diskStats.used,
- free: diskStats.total - diskStats.used,
- usage: diskStats.percent / 100
- }}
- />
- </div>
</td>
</Show>
@@ -1165,7 +1173,7 @@ const HostRow: Component<HostRowProps> = (props) => {
<Show when={props.isColVisible('uptime')}>
<td class="px-2 py-1 align-middle">
<div class="flex justify-center">
- <Show when={host.uptimeSeconds} fallback={<span class="text-xs text-gray-400">—</span>}>
+ <Show when={isOnline() && host.uptimeSeconds} fallback={<span class="text-xs text-gray-400">—</span>}>
<span class="text-xs text-gray-700 dark:text-gray-300 whitespace-nowrap">
{formatUptime(host.uptimeSeconds!)}
</span>
diff --git a/frontend-modern/src/components/Settings/UnifiedAgents.tsx b/frontend-modern/src/components/Settings/UnifiedAgents.tsx
index b39b4385e1..5e2d85fe77 100644
--- a/frontend-modern/src/components/Settings/UnifiedAgents.tsx
+++ b/frontend-modern/src/components/Settings/UnifiedAgents.tsx
@@ -381,16 +381,17 @@ export const UnifiedAgents: Component = () => {
return `curl ${getCurlInsecureFlag()}-fsSL ${url}/install.sh | sudo bash -s -- --url ${url} --token ${token}${getInsecureFlag()}`;
};
- const handleRemoveAgent = async (id: string, type: 'host' | 'docker' | 'kubernetes') => {
+ const handleRemoveAgent = async (id: string, types: ('host' | 'docker')[]) => {
if (!confirm('Are you sure you want to remove this agent? This will stop monitoring but will not uninstall the agent from the remote machine.')) return;
try {
- if (type === 'host') {
- await MonitoringAPI.deleteHostAgent(id);
- } else if (type === 'docker') {
- await MonitoringAPI.deleteDockerHost(id);
- } else {
- await MonitoringAPI.deleteKubernetesCluster(id);
+ // Delete all types associated with this agent
+ for (const type of types) {
+ if (type === 'host') {
+ await MonitoringAPI.deleteHostAgent(id);
+ } else if (type === 'docker') {
+ await MonitoringAPI.deleteDockerHost(id);
+ }
}
notificationStore.success('Agent removed from Pulse');
} catch (err) {
@@ -880,7 +881,7 @@ export const UnifiedAgents: Component = () => {
</td>
<td class="whitespace-nowrap px-4 py-3 text-right text-sm font-medium">
<button
- onClick={() => handleRemoveAgent(agent.id, agent.types[0])}
+ onClick={() => handleRemoveAgent(agent.id, agent.types)}
class="text-red-600 hover:text-red-900 dark:text-red-400 dark:hover:text-red-300"
>
Remove