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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
feat(ui): wire memory and disk anomaly indicators
rcourtmanee15a5626d90
diff --git a/frontend-modern/src/components/Dashboard/GuestRow.tsx b/frontend-modern/src/components/Dashboard/GuestRow.tsxindex 3096e6c0ef..1a52954eb5 100644--- a/frontend-modern/src/components/Dashboard/GuestRow.tsx+++ b/frontend-modern/src/components/Dashboard/GuestRow.tsx@@ -522,9 +522,7 @@ export function GuestRow(props: GuestRowProps) {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<string | undefined>(props.customUrl);const [shouldAnimateIcon, setShouldAnimateIcon] = createSignal(false);@@ -960,6 +958,7 @@ export function GuestRow(props: GuestRowProps) {swapUsed={props.guest.memory?.swapUsed || 0}swapTotal={props.guest.memory?.swapTotal || 0}resourceId={metricsKey()}+ anomaly={memoryAnomaly()}/>}>@@ -1002,6 +1001,7 @@ export function GuestRow(props: GuestRowProps) {<StackedDiskBardisks={props.guest.disks}aggregateDisk={props.guest.disk}+ anomaly={diskAnomaly()}/>}>diff --git a/frontend-modern/src/components/Dashboard/StackedDiskBar.tsx b/frontend-modern/src/components/Dashboard/StackedDiskBar.tsxindex 5b15d06eba..158b311912 100644--- a/frontend-modern/src/components/Dashboard/StackedDiskBar.tsx+++ b/frontend-modern/src/components/Dashboard/StackedDiskBar.tsx@@ -2,14 +2,25 @@ import { Show, For, createMemo, createSignal, onMount, onCleanup } from 'solid-jimport { Portal } from 'solid-js/web';import type { Disk } from '@/types/api';import { formatBytes, formatPercent } from '@/utils/format';+import type { AnomalyReport } from '@/types/aiIntelligence';interface StackedDiskBarProps {/** Array of disk objects - if empty/undefined, falls back to aggregate */disks?: Disk[];/** Aggregate disk data (fallback when disks array unavailable) */aggregateDisk?: Disk;+ /** Baseline anomaly if detected */+ anomaly?: AnomalyReport | null;}+// Anomaly severity colors+const anomalySeverityClass: Record<string, string> = {+ critical: 'text-red-400',+ high: 'text-orange-400',+ medium: 'text-yellow-400',+ low: 'text-blue-400',+};+// Color palette for disk segments - distinct colors for visual differentiationconst SEGMENT_COLORS = ['rgba(34, 197, 94, 0.6)', // green@@ -52,6 +63,15 @@ export function StackedDiskBar(props: StackedDiskBarProps) {onCleanup(() => observer.disconnect());});+ // Format anomaly ratio for display+ const anomalyRatio = createMemo(() => {+ if (!props.anomaly || props.anomaly.baseline_mean === 0) return null;+ const ratio = props.anomaly.current_value / props.anomaly.baseline_mean;+ if (ratio >= 2) return `${ratio.toFixed(1)}x`;+ if (ratio >= 1.5) return '↑↑';+ return '↑';+ });+// Determine if we have multiple disks or should use aggregateconst hasMultipleDisks = createMemo(() => {const disks = props.disks;@@ -239,6 +259,15 @@ export function StackedDiskBar(props: StackedDiskBarProps) {[{props.disks?.length}]</span></Show>+ {/* Anomaly indicator */}+ <Show when={props.anomaly && anomalyRatio()}>+ <span+ class={`ml-0.5 font-bold animate-pulse ${anomalySeverityClass[props.anomaly!.severity] || 'text-yellow-400'}`}+ title={props.anomaly!.description}+ >+ {anomalyRatio()}+ </span>+ </Show></span></span></div>diff --git a/frontend-modern/src/components/Dashboard/StackedMemoryBar.tsx b/frontend-modern/src/components/Dashboard/StackedMemoryBar.tsxindex 3da92b8fd1..63c375fa70 100644--- a/frontend-modern/src/components/Dashboard/StackedMemoryBar.tsx+++ b/frontend-modern/src/components/Dashboard/StackedMemoryBar.tsx@@ -4,6 +4,7 @@ import { formatBytes, formatPercent } from '@/utils/format';import { Sparkline } from '@/components/shared/Sparkline';import { useMetricsViewMode } from '@/stores/metricsViewMode';import { getMetricHistoryForRange, getMetricsVersion } from '@/stores/metricsHistory';+import type { AnomalyReport } from '@/types/aiIntelligence';interface StackedMemoryBarProps {used: number;@@ -12,8 +13,17 @@ interface StackedMemoryBarProps {swapTotal?: number;balloon?: number;resourceId?: string; // Required for sparkline mode to fetch history+ anomaly?: AnomalyReport | null; // Baseline anomaly if detected}+// Anomaly severity colors+const anomalySeverityClass: Record<string, string> = {+ critical: 'text-red-400',+ high: 'text-orange-400',+ medium: 'text-yellow-400',+ low: 'text-blue-400',+};+// Colors for memory segmentsconst MEMORY_COLORS = {active: 'rgba(34, 197, 94, 0.6)', // green (base, overridden by threshold)@@ -40,6 +50,15 @@ export function StackedMemoryBar(props: StackedMemoryBarProps) {return getMetricHistoryForRange(props.resourceId, timeRange());});+ // Format anomaly ratio for display+ const anomalyRatio = createMemo(() => {+ if (!props.anomaly || props.anomaly.baseline_mean === 0) return null;+ const ratio = props.anomaly.current_value / props.anomaly.baseline_mean;+ if (ratio >= 2) return `${ratio.toFixed(1)}x`;+ if (ratio >= 1.5) return '↑↑';+ return '↑';+ });+const [containerWidth, setContainerWidth] = createSignal(100);const [showTooltip, setShowTooltip] = createSignal(false);const [tooltipPos, setTooltipPos] = createSignal({ x: 0, y: 0 });@@ -195,6 +214,15 @@ export function StackedMemoryBar(props: StackedMemoryBarProps) {({displaySublabel()})</span></Show>+ {/* Anomaly indicator */}+ <Show when={props.anomaly && anomalyRatio()}>+ <span+ class={`ml-0.5 font-bold animate-pulse ${anomalySeverityClass[props.anomaly!.severity] || 'text-yellow-400'}`}+ title={props.anomaly!.description}+ >+ {anomalyRatio()}+ </span>+ </Show></span></span></div>