From 9aad21169d5050caf24ea0f3eb7363f9656401f8 Mon Sep 17 00:00:00 2001 From: rcourtman Date: Sun, 21 Dec 2025 11:06:23 +0000 Subject: [PATCH] feat(ui): wire CPU anomaly indicator to dashboard Connect anomaly data to the EnhancedCPUBar component in GuestRow. When a VM/container's CPU is significantly above its learned baseline, a pulsing indicator (e.g., '2.5x') appears directly on the CPU bar. This provides real-time baseline deviation feedback without any LLM involvement - purely deterministic statistical analysis. Memory and disk anomaly hooks are prepared but not yet wired to their respective bar components (TODO for follow-up). --- frontend-modern/src/components/Dashboard/GuestRow.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/frontend-modern/src/components/Dashboard/GuestRow.tsx b/frontend-modern/src/components/Dashboard/GuestRow.tsx index e9ad1a8..3096e6c 100644 --- a/frontend-modern/src/components/Dashboard/GuestRow.tsx +++ b/frontend-modern/src/components/Dashboard/GuestRow.tsx @@ -21,6 +21,8 @@ import { useBreakpoint } from '@/hooks/useBreakpoint'; import { useMetricsViewMode } from '@/stores/metricsViewMode'; import { aiChatStore } from '@/stores/aiChat'; import { useAlertsActivation } from '@/stores/alertsActivation'; +import { useAnomalyForMetric } from '@/hooks/useAnomalies'; + type Guest = VM | Container; @@ -516,6 +518,13 @@ export function GuestRow(props: GuestRowProps) { return buildMetricKey(kind, guestId()); }); + // Get anomalies for this guest's metrics (deterministic, no LLM) + const cpuAnomaly = useAnomalyForMetric(() => props.guest.id, () => 'cpu'); + const memoryAnomaly = useAnomalyForMetric(() => props.guest.id, () => 'memory'); + const diskAnomaly = useAnomalyForMetric(() => props.guest.id, () => 'disk'); + // TODO: Wire memoryAnomaly and diskAnomaly to StackedMemoryBar and StackedDiskBar + void memoryAnomaly; // Prepared for future use + void diskAnomaly; // Prepared for future use const [customUrl, setCustomUrl] = createSignal(props.customUrl); const [shouldAnimateIcon, setShouldAnimateIcon] = createSignal(false); @@ -918,6 +927,7 @@ export function GuestRow(props: GuestRowProps) { usage={cpuPercent()} cores={props.guest.cpus} resourceId={metricsKey()} + anomaly={cpuAnomaly()} />