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
Align Patrol findings badge tone with runtime state
rcourtmand4622564f731
diff --git a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.tsindex fccc87c688..c195d2b359 100644--- a/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts+++ b/frontend-modern/src/components/AI/__tests__/FindingsPanel.test.ts@@ -20,6 +20,7 @@ import {getFindingStatusBadgeClasses,getFindingStatusLabel,getFindingSeverityToneClasses,+ getPatrolFindingsBadgePresentation,getFindingSourceBadgeClasses,getFindingSourceLabel,hasFindingInvestigationDetails,@@ -136,6 +137,38 @@ describe('aiFindingPresentation', () => {it('contains compact tone classes for critical severity', () => {expect(getFindingSeverityToneClasses('critical')).toContain('bg-red-100');});++ it('uses patrol runtime badge tones when only runtime findings are active', () => {+ expect(+ getPatrolFindingsBadgePresentation([+ {+ status: 'active',+ severity: 'warning',+ resourceId: 'ai-service',+ resourceName: 'Pulse Patrol Service',+ title: 'Pulse Patrol: Insufficient API credits',+ },+ ]),+ ).toEqual({+ toneClasses: 'bg-sky-100 text-sky-700 dark:bg-sky-900 dark:text-sky-300',+ });+ });++ it('keeps warning tones for infrastructure warning findings', () => {+ expect(+ getPatrolFindingsBadgePresentation([+ {+ status: 'active',+ severity: 'warning',+ resourceId: 'vm-101',+ resourceName: 'db-01',+ title: 'Disk nearly full',+ },+ ]),+ ).toEqual({+ toneClasses: getFindingSeverityToneClasses('warning'),+ });+ });});describe('findingStatusPresentation', () => {@@ -389,6 +422,11 @@ describe('aiFindingPresentation', () => {expect(patrolWorkspaceSource).toContain('{state.displayRunHistory().length}');});+ it('routes the findings tab badge tone through the shared patrol findings badge helper', () => {+ expect(patrolWorkspaceSource).toContain('getPatrolFindingsBadgePresentation');+ expect(patrolWorkspaceSource).toContain('findingsBadgePresentation().toneClasses');+ });+it('does not stack a detected loop-state badge on top of acknowledged active findings', () => {expect(findingsPanelSource).toContain("!(finding.acknowledgedAt && finding.loopState === 'detected')",diff --git a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsxindex 2f2480013a..fe334c823a 100644--- a/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx+++ b/frontend-modern/src/features/patrol/PatrolIntelligenceWorkspace.tsx@@ -1,7 +1,7 @@import { Show } from 'solid-js';import { FindingsPanel } from '@/components/AI/FindingsPanel';import { ApprovalBanner, PatrolStatusBar, RunHistoryPanel } from '@/components/patrol';-import { getFindingSeverityToneClasses } from '@/utils/aiFindingPresentation';+import { getPatrolFindingsBadgePresentation } from '@/utils/aiFindingPresentation';import { formatRelativeTime } from '@/utils/format';import { formatTriggerReason } from '@/utils/patrolFormat';import { ResourcePolicySummary } from '@/components/Infrastructure/ResourcePolicySummary';@@ -11,6 +11,7 @@ import type { PatrolIntelligenceState } from './usePatrolIntelligenceState';export function PatrolIntelligenceWorkspace(props: { state: PatrolIntelligenceState }) {const state = props.state;+ const findingsBadgePresentation = () => getPatrolFindingsBadgePresentation(state.activePatrolFindings());return (<>@@ -51,7 +52,7 @@ export function PatrolIntelligenceWorkspace(props: { state: PatrolIntelligenceSt<Show when={state.summaryStats().totalActive > 0}><spanaria-hidden="true"- class={`ml-1.5 px-1.5 py-0.5 text-xs rounded-full ${getFindingSeverityToneClasses(state.summaryStats().criticalFindings > 0 ? 'critical' : 'warning')}`}+ class={`ml-1.5 px-1.5 py-0.5 text-xs rounded-full ${findingsBadgePresentation().toneClasses}`}>{' '}{state.summaryStats().totalActive}diff --git a/frontend-modern/src/utils/aiFindingPresentation.ts b/frontend-modern/src/utils/aiFindingPresentation.tsindex fe2af78fe8..1caf153880 100644--- a/frontend-modern/src/utils/aiFindingPresentation.ts+++ b/frontend-modern/src/utils/aiFindingPresentation.ts@@ -222,6 +222,10 @@ export interface FindingManualControlsPresentation {dismiss: boolean;}+export interface PatrolFindingsBadgePresentation {+ toneClasses: string;+}+export const getFindingSourceLabel = (source: UnifiedFinding['source'] | string): string =>FINDING_SOURCE_LABELS[source] || source;@@ -250,6 +254,30 @@ export const getFindingActiveRuntimeSortOrder = (finding: Pick<UnifiedFinding, 'status' | 'resourceId' | 'resourceName' | 'title'>,): number => (finding.status === 'active' && isPatrolRuntimeFinding(finding) ? 0 : 1);+export const getPatrolFindingsBadgePresentation = (+ findings: Pick<UnifiedFinding, 'status' | 'severity' | 'resourceId' | 'resourceName' | 'title'>[],+): PatrolFindingsBadgePresentation => {+ const activeFindings = findings.filter((finding) => finding.status === 'active');+ if (activeFindings.some((finding) => finding.severity === 'critical' && !isPatrolRuntimeFinding(finding))) {+ return { toneClasses: getFindingSeverityToneClasses('critical') };+ }+ if (activeFindings.some((finding) => finding.severity === 'critical' && isPatrolRuntimeFinding(finding))) {+ return {+ toneClasses: 'bg-sky-100 text-sky-700 dark:bg-sky-900 dark:text-sky-300',+ };+ }+ if (activeFindings.some((finding) => finding.severity === 'warning' && !isPatrolRuntimeFinding(finding))) {+ return { toneClasses: getFindingSeverityToneClasses('warning') };+ }+ if (activeFindings.some((finding) => finding.severity === 'warning' && isPatrolRuntimeFinding(finding))) {+ return {+ toneClasses: 'bg-sky-100 text-sky-700 dark:bg-sky-900 dark:text-sky-300',+ };+ }++ return { toneClasses: 'bg-surface-alt text-muted' };+};+export const getFindingSeverityCompactLabel = (severity: UnifiedFinding['severity'] | string,): string => FINDING_SEVERITY_COMPACT_LABELS[severity] || String(severity).toUpperCase();