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
Converge platform alert severity indicators
rcourtman7239f607485f
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.mdindex 0a9a21f96e..79f920aa65 100644--- a/docs/release-control/v6/internal/subsystems/alerts.md+++ b/docs/release-control/v6/internal/subsystems/alerts.md@@ -519,6 +519,14 @@ status labels. Overview stat-card labels must also route through the alertoverview presentation helper, and user-facing configuration or thresholds copymust use workload, VM, and container vocabulary instead of exposing internalguest override/filter names unless the UI is naming a backend field directly.+Alert severity presentation has a split ownership boundary: alerts owns+`formatAlertSeverityLabel`, compact severity labels, legacy alert severity+class helpers, and severity-bucket-to-`StatusIndicatorVariant` mapping in+`frontend-modern/src/utils/alertSeverityPresentation.ts`, while+frontend-primitives owns the visible platform severity badge and dot shells in+`frontend-modern/src/components/shared/AlertSeverityBadge.tsx`. Platform alert+tables must consume that split instead of recreating provider-local severity+label, text-class, or variant helpers.Alert history filter defaults such as the all-time period option must likewisecome from the alert overview/history presentation helper and the sharedfilter-option label primitive rather than hard-coded title-case strings in thediff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 007fb959d0..3c1d90cc1f 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -2417,6 +2417,14 @@ presentation for product surfaces that display state rather than toggle it.Product components must compose `StatusIndicatorBadge` instead of calling`getStatusIndicatorBadgeToneClasses` directly; low-level status utilities maystill expose the tone mapping for that primitive and utility-level tests.+Platform alert severity indicators are a governed specialization of that same+primitive family. `frontend-modern/src/components/shared/AlertSeverityBadge.tsx`+owns the alert severity badge and dot shells, while+`frontend-modern/src/utils/alertSeverityPresentation.ts` owns alert severity+label formatting and severity-bucket-to-status-indicator mapping. Docker,+Kubernetes, TrueNAS, vSphere, and future platform alert tables must compose+`AlertSeverityBadge` and `AlertSeverityDot`; they must not recreate+`severityVariant`, `severityTextClass`, or severity badge spans locally.Read-only metadata badges follow the same primitive-owned shell rule.`frontend-modern/src/components/shared/MetadataBadge.tsx` owns filled andoutlined appearances, compact sizing, shape, typed tone vocabulary, fitdiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex a85e11d3ce..a69cd17055 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -1777,6 +1777,14 @@ ResourceDetailDrawer may own which actions are available and how they call theresource state, but Assistant, copy-context, close, and future drawer-headeractions must compose the shared Button drawer-header action primitives insteadof restoring resource-drawer-local button classes,+and platform alert tables use the same dependency rule for severity+presentation: Docker, Kubernetes, TrueNAS, and vSphere incident rows may own+which incidents exist and which native detail rows are shown, but visible+severity dots, badges, and severity label formatting must compose+`AlertSeverityDot`, `AlertSeverityBadge`, and+`formatAlertSeverityLabel` from the frontend-primitives-owned shared path+instead of restoring table-local `severityVariant`, `severityTextClass`, or+severity-label helpers,and local operator identity labels now split from governed detail summaries:infrastructure tables, selectors, links, and drawer headings must preserve thecanonical local instance identity (`displayName`, canonical display name,diff --git a/frontend-modern/scripts/shared-template-registry.json b/frontend-modern/scripts/shared-template-registry.jsonindex b0dd385e4c..80e4e252db 100644--- a/frontend-modern/scripts/shared-template-registry.json+++ b/frontend-modern/scripts/shared-template-registry.json@@ -727,6 +727,45 @@"scripts/shared-template-audit.mjs"]},+ {+ "id": "platform-alert-severity-indicator-shell",+ "category": "status-indicator",+ "summary": "Platform alert tables must compose AlertSeverityBadge and AlertSeverityDot for shared severity labels, tone mapping, and status-indicator rendering instead of recreating severity helpers locally.",+ "canonical": {+ "path": "src/components/shared/AlertSeverityBadge.tsx",+ "export": "AlertSeverityBadge"+ },+ "requiredConsumers": [+ { "path": "src/features/docker/DockerAlertsTable.tsx" },+ { "path": "src/features/kubernetes/KubernetesAlertsTable.tsx" },+ { "path": "src/features/truenas/TrueNASAlertsTable.tsx" },+ { "path": "src/features/vmware/VsphereAlertsTable.tsx" }+ ],+ "forbiddenPatterns": [+ {+ "path": "src/features/docker/DockerAlertsTable.tsx",+ "patterns": ["severityVariant", "severityTextClass"]+ },+ {+ "path": "src/features/kubernetes/KubernetesAlertsTable.tsx",+ "patterns": ["severityVariant", "severityTextClass"]+ },+ {+ "path": "src/features/truenas/TrueNASAlertsTable.tsx",+ "patterns": ["severityVariant", "severityTextClass"]+ },+ {+ "path": "src/features/vmware/VsphereAlertsTable.tsx",+ "patterns": ["severityVariant", "severityTextClass"]+ }+ ],+ "proof": [+ "src/components/shared/SharedPrimitives.guardrails.test.ts",+ "src/components/shared/AlertSeverityBadge.test.tsx",+ "src/utils/__tests__/alertSeverityPresentation.test.ts",+ "scripts/shared-template-audit.mjs"+ ]+ },{"id": "metadata-badge-shell","category": "metadata-badge",@@ -1505,6 +1544,31 @@"scripts/shared-template-audit.mjs"]},+ {+ "id": "platform-alert-severity-local-helper",+ "category": "status-indicator",+ "summary": "Platform alert tables must not recreate severityVariant/severityTextClass helpers; alert severity tone and label presentation belongs to AlertSeverityBadge and alertSeverityPresentation.",+ "canonical": {+ "path": "src/components/shared/AlertSeverityBadge.tsx",+ "export": "AlertSeverityBadge"+ },+ "scopes": [+ "src/features/docker",+ "src/features/kubernetes",+ "src/features/truenas",+ "src/features/vmware"+ ],+ "extensions": [".tsx"],+ "allPatterns": ["severityVariant", "severityTextClass"],+ "legacyReason": "Retired migration debt. Platform alert rows must compose AlertSeverityBadge and AlertSeverityDot instead of page-local severity tone helpers.",+ "allowedPaths": [],+ "ignoredPaths": [],+ "proof": [+ "src/components/shared/SharedPrimitives.guardrails.test.ts",+ "src/components/shared/AlertSeverityBadge.test.tsx",+ "scripts/shared-template-audit.mjs"+ ]+ },{"id": "patrol-finding-metadata-badge-local-shell","category": "metadata-badge",@@ -2358,6 +2422,35 @@"scripts/shared-template-audit.mjs"]},+ {+ "id": "platform-alert-severity-indicator-required",+ "category": "status-indicator",+ "summary": "Feature alert tables with severityBucket-driven platform rows must compose AlertSeverityBadge and AlertSeverityDot so new platform alert tables cannot invent local severity indicators.",+ "canonical": {+ "path": "src/components/shared/AlertSeverityBadge.tsx",+ "export": "AlertSeverityBadge"+ },+ "scopes": [+ "src/features/docker",+ "src/features/kubernetes",+ "src/features/truenas",+ "src/features/vmware"+ ],+ "extensions": [".tsx"],+ "triggerPatterns": [+ "severityBucket",+ "IncidentRow",+ "getPlatformTableCellClassForKind('badge')"+ ],+ "requiredPatterns": ["AlertSeverityBadge", "AlertSeverityDot"],+ "allowedPaths": [],+ "ignoredPaths": [],+ "proof": [+ "src/components/shared/SharedPrimitives.guardrails.test.ts",+ "src/components/shared/AlertSeverityBadge.test.tsx",+ "scripts/shared-template-audit.mjs"+ ]+ },{"id": "platform-row-detail-toggle-inline-detail","category": "row-disclosure",diff --git a/frontend-modern/src/components/shared/AlertSeverityBadge.test.tsx b/frontend-modern/src/components/shared/AlertSeverityBadge.test.tsxnew file mode 100644index 0000000000..4ddbb237bd--- /dev/null+++ b/frontend-modern/src/components/shared/AlertSeverityBadge.test.tsx@@ -0,0 +1,35 @@+import { cleanup, render, screen } from '@solidjs/testing-library';+import { afterEach, describe, expect, it } from 'vitest';+import { AlertSeverityBadge, AlertSeverityDot } from '@/components/shared/AlertSeverityBadge';++afterEach(cleanup);++describe('AlertSeverityBadge', () => {+ it('renders critical alert severity through the shared status badge primitive', () => {+ render(() => <AlertSeverityBadge severity="CRITICAL" bucket="critical" />);++ const badge = screen.getByText('Critical');+ expect(badge).toHaveClass('inline-flex');+ expect(badge).toHaveClass('rounded-full');+ expect(badge).toHaveClass('text-[10px]');+ expect(badge).toHaveClass('bg-red-100');+ expect(badge).toHaveClass('text-red-700');+ });++ it('uses the severity bucket for tone while preserving provider severity text', () => {+ render(() => <AlertSeverityBadge severity="restart_loop" bucket="warning" />);++ const badge = screen.getByText('Restart Loop');+ expect(badge).toHaveClass('bg-amber-100');+ expect(badge).toHaveClass('text-amber-700');+ });++ it('renders alert severity dots through the shared status dot primitive', () => {+ render(() => <AlertSeverityDot severity="Image update" bucket="info" />);++ const dot = screen.getByTitle('Image Update');+ expect(dot).toHaveClass('inline-block');+ expect(dot).toHaveClass('h-2');+ expect(dot).toHaveClass('bg-slate-400');+ });+});diff --git a/frontend-modern/src/components/shared/AlertSeverityBadge.tsx b/frontend-modern/src/components/shared/AlertSeverityBadge.tsxnew file mode 100644index 0000000000..98eff27360--- /dev/null+++ b/frontend-modern/src/components/shared/AlertSeverityBadge.tsx@@ -0,0 +1,59 @@+import { createMemo, type JSX } from 'solid-js';+import { StatusDot } from '@/components/shared/StatusDot';+import { StatusIndicatorBadge } from '@/components/shared/StatusIndicatorBadge';+import { getAlertSeverityIndicator } from '@/utils/alertSeverityPresentation';++type AlertSeverityIndicatorSize = 'xs' | 'sm' | 'md';+type AlertSeverityBadgeShape = 'pill' | 'rounded';++interface AlertSeverityPresentationProps {+ severity?: string | null;+ bucket?: string | null;+ title?: string;+ class?: string;+}++interface AlertSeverityBadgeProps extends AlertSeverityPresentationProps {+ size?: AlertSeverityIndicatorSize;+ shape?: AlertSeverityBadgeShape;+ dot?: boolean;+ uppercase?: boolean;+}++interface AlertSeverityDotProps extends AlertSeverityPresentationProps {+ size?: AlertSeverityIndicatorSize;+ ariaLabel?: string;+ ariaHidden?: boolean;+}++export function AlertSeverityBadge(props: AlertSeverityBadgeProps): JSX.Element {+ const indicator = createMemo(() => getAlertSeverityIndicator(props.severity, props.bucket));++ return (+ <StatusIndicatorBadge+ variant={indicator().variant}+ label={indicator().label}+ size={props.size ?? 'xs'}+ shape={props.shape ?? 'pill'}+ dot={props.dot}+ uppercase={props.uppercase}+ title={props.title}+ class={props.class}+ />+ );+}++export function AlertSeverityDot(props: AlertSeverityDotProps): JSX.Element {+ const indicator = createMemo(() => getAlertSeverityIndicator(props.severity, props.bucket));++ return (+ <StatusDot+ variant={indicator().variant}+ size={props.size ?? 'sm'}+ title={props.title ?? indicator().label}+ ariaLabel={props.ariaLabel}+ ariaHidden={props.ariaHidden}+ class={props.class}+ />+ );+}diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex bf0cda1da8..1c651882f4 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -51,6 +51,7 @@ import loadingSpinnerSource from '@/components/shared/LoadingSpinner.tsx?raw';import statusBadgeSource from '@/components/shared/StatusBadge.tsx?raw';import statusBadgeModelSource from '@/components/shared/statusBadgeModel.ts?raw';import statusIndicatorBadgeSource from '@/components/shared/StatusIndicatorBadge.tsx?raw';+import alertSeverityBadgeSource from '@/components/shared/AlertSeverityBadge.tsx?raw';import metadataBadgeSource from '@/components/shared/MetadataBadge.tsx?raw';import organizationBadgesSource from '@/components/shared/OrganizationBadges.tsx?raw';import discoveryReadinessBadgeSource from '@/components/shared/DiscoveryReadinessBadge.tsx?raw';@@ -111,6 +112,7 @@ import sharedTemplateRegistrySource from '../../../scripts/shared-template-regisimport discoveryTabSource from '@/components/Discovery/DiscoveryTab.tsx?raw';import emailProviderSelectSource from '@/components/Alerts/EmailProviderSelect.tsx?raw';import incidentTimelinePanelSource from '@/components/Alerts/IncidentTimelinePanel.tsx?raw';+import alertSeverityPresentationSource from '@/utils/alertSeverityPresentation.ts?raw';import thresholdsTableDockerIgnoredPrefixesSectionSource from '@/components/Alerts/ThresholdsTableDockerIgnoredPrefixesSection.tsx?raw';import webhookConfigFormSource from '@/components/Alerts/WebhookConfigForm.tsx?raw';import reportMergeModalSource from '@/components/Infrastructure/ReportMergeModal.tsx?raw';@@ -1670,6 +1672,103 @@ describe('shared primitive guardrails', () => {);});+ it('keeps platform alert severity indicators on the shared severity badge primitive', () => {+ const registry = JSON.parse(sharedTemplateRegistrySource) as {+ rules?: Array<{+ id: string;+ canonical?: { path?: string; export?: string };+ requiredConsumers?: Array<{ path?: string }>;+ forbiddenPatterns?: Array<{ path?: string; patterns?: string[] }>;+ }>;+ patternGuards?: Array<{+ id: string;+ canonical?: { path?: string; export?: string };+ allPatterns?: string[];+ scopes?: string[];+ allowedPaths?: string[];+ ignoredPaths?: string[];+ }>;+ requiredPatternGuards?: Array<{+ id: string;+ canonical?: { path?: string; export?: string };+ triggerPatterns?: string[];+ requiredPatterns?: string[];+ scopes?: string[];+ allowedPaths?: string[];+ ignoredPaths?: string[];+ }>;+ };+ const registeredRule = registry.rules?.find(+ (rule) => rule.id === 'platform-alert-severity-indicator-shell',+ );+ const localHelperGuard = registry.patternGuards?.find(+ (guard) => guard.id === 'platform-alert-severity-local-helper',+ );+ const requiredGuard = registry.requiredPatternGuards?.find(+ (guard) => guard.id === 'platform-alert-severity-indicator-required',+ );+ const alertTableConsumerPaths = [+ 'src/features/docker/DockerAlertsTable.tsx',+ 'src/features/kubernetes/KubernetesAlertsTable.tsx',+ 'src/features/truenas/TrueNASAlertsTable.tsx',+ 'src/features/vmware/VsphereAlertsTable.tsx',+ ];++ expect(registeredRule?.canonical?.path).toBe('src/components/shared/AlertSeverityBadge.tsx');+ expect(registeredRule?.canonical?.export).toBe('AlertSeverityBadge');+ expect(registeredRule?.requiredConsumers?.map((consumer) => consumer.path)).toEqual(+ alertTableConsumerPaths,+ );+ expect(registeredRule?.forbiddenPatterns).toEqual(+ alertTableConsumerPaths.map((path) => ({+ path,+ patterns: ['severityVariant', 'severityTextClass'],+ })),+ );+ expect(localHelperGuard?.canonical?.path).toBe('src/components/shared/AlertSeverityBadge.tsx');+ expect(localHelperGuard?.canonical?.export).toBe('AlertSeverityBadge');+ expect(localHelperGuard?.allPatterns).toEqual(['severityVariant', 'severityTextClass']);+ expect(localHelperGuard?.scopes).toEqual([+ 'src/features/docker',+ 'src/features/kubernetes',+ 'src/features/truenas',+ 'src/features/vmware',+ ]);+ expect(localHelperGuard?.allowedPaths ?? []).toHaveLength(0);+ expect(localHelperGuard?.ignoredPaths ?? []).toHaveLength(0);+ expect(requiredGuard?.canonical?.path).toBe('src/components/shared/AlertSeverityBadge.tsx');+ expect(requiredGuard?.canonical?.export).toBe('AlertSeverityBadge');+ expect(requiredGuard?.triggerPatterns).toEqual([+ 'severityBucket',+ 'IncidentRow',+ "getPlatformTableCellClassForKind('badge')",+ ]);+ expect(requiredGuard?.requiredPatterns).toEqual(['AlertSeverityBadge', 'AlertSeverityDot']);+ expect(requiredGuard?.allowedPaths ?? []).toHaveLength(0);+ expect(requiredGuard?.ignoredPaths ?? []).toHaveLength(0);++ expect(alertSeverityBadgeSource).toContain('StatusIndicatorBadge');+ expect(alertSeverityBadgeSource).toContain('StatusDot');+ expect(alertSeverityBadgeSource).toContain('getAlertSeverityIndicator');+ expect(alertSeverityPresentationSource).toContain('getAlertSeverityIndicatorVariant');+ expect(alertSeverityPresentationSource).toContain('formatAlertSeverityLabel');++ for (const source of [+ dockerAlertsTableSource,+ kubernetesAlertsTableSource,+ truenasAlertsTableSource,+ vsphereAlertsTableSource,+ ]) {+ expect(source).toContain('AlertSeverityBadge');+ expect(source).toContain('AlertSeverityDot');+ expect(source).toContain('formatAlertSeverityLabel');+ expect(source).not.toContain('severityVariant');+ expect(source).not.toContain('severityTextClass');+ expect(source).not.toContain('text-red-700 dark:text-red-300');+ expect(source).not.toContain('text-amber-700 dark:text-amber-300');+ }+ });+it('keeps metadata badges on shared badge primitives', () => {const registry = JSON.parse(sharedTemplateRegistrySource) as {rules?: Array<{diff --git a/frontend-modern/src/features/docker/DockerAlertsTable.tsx b/frontend-modern/src/features/docker/DockerAlertsTable.tsxindex cff30e5479..49bddcfdea 100644--- a/frontend-modern/src/features/docker/DockerAlertsTable.tsx+++ b/frontend-modern/src/features/docker/DockerAlertsTable.tsx@@ -7,8 +7,8 @@ import {type DetailSection,type DetailValueTone,} from '@/components/shared/DetailSectionTable';+import { AlertSeverityBadge, AlertSeverityDot } from '@/components/shared/AlertSeverityBadge';import { InlineDetailTableRow } from '@/components/shared/InlineDetailTableRow';-import { StatusDot } from '@/components/shared/StatusDot';import { TableCell, TableHead, TableRow } from '@/components/shared/Table';import { filterChipStatusDot } from '@/components/shared/FilterBar';import {@@ -26,8 +26,8 @@ import {getPlatformResourceDetailRowClass,} from '@/features/platformPage/PlatformResourceDetailTableRow';import type { ResourceType } from '@/types/resource';-import type { StatusIndicatorVariant } from '@/utils/status';import { getAlertFilteredEmptyState } from '@/utils/alertOverviewPresentation';+import { formatAlertSeverityLabel } from '@/utils/alertSeverityPresentation';import {filterDockerIncidents,type DockerIncidentRow,@@ -56,34 +56,6 @@ const DOCKER_INCIDENT_STATUS_OPTIONS: PlatformTableFilterOption<DockerIncidentSe},];-const severityVariant = (severity: DockerIncidentRow['severityBucket']): StatusIndicatorVariant => {- switch (severity) {- case 'critical':- return 'danger';- case 'warning':- return 'warning';- case 'info':- return 'muted';- }-};--const severityLabel = (severity: string): string => {- const normalized = severity.trim();- if (!normalized) return 'Info';- return normalized.charAt(0).toUpperCase() + normalized.slice(1).toLowerCase();-};--const severityTextClass = (severity: DockerIncidentRow['severityBucket']): string => {- switch (severity) {- case 'critical':- return 'text-red-700 dark:text-red-300';- case 'warning':- return 'text-amber-700 dark:text-amber-300';- case 'info':- return 'text-muted';- }-};-const formatResourceType = (type: ResourceType): string => {switch (type) {case 'agent':@@ -165,7 +137,7 @@ const buildAlertDetailSections = (incident: DockerIncidentRow): AlertDetailSecti{label: 'Alert',rows: compactDetailRows([- detailRow('Severity', severityLabel(incident.severity), {+ detailRow('Severity', formatAlertSeverityLabel(incident.severity), {tone: alertTone(incident.severityBucket),}),detailRow('Summary', incident.summary),@@ -203,7 +175,9 @@ const AlertDetail: Component<{ incident: DockerIncidentRow; onClose: () => voidtestId="docker-alert-detail"detailFor={props.incident.id}title="Docker alert detail"- summary={`${severityLabel(props.incident.severity)} · ${formatCode(props.incident.code)}`}+ summary={`${formatAlertSeverityLabel(props.incident.severity)} · ${formatCode(+ props.incident.code,+ )}`}sections={buildAlertDetailSections(props.incident)}detailAttributes={{ 'data-docker-alert-detail-for': props.incident.id }}onClose={props.onClose}@@ -318,10 +292,10 @@ export const DockerAlertsTable: Component<{controlsId={detailRowId()}onToggle={() => drawer.toggle(incident)}/>- <StatusDot+ <AlertSeverityDotsize="sm"- variant={severityVariant(incident.severityBucket)}- title={severityLabel(incident.severity)}+ severity={incident.severity}+ bucket={incident.severityBucket}/><div class="min-w-0"><div@@ -340,13 +314,10 @@ export const DockerAlertsTable: Component<{</div></TableCell><TableCell class={getPlatformTableCellClassForKind('badge')}>- <span- class={`text-[11px] font-semibold ${severityTextClass(- incident.severityBucket,- )}`}- >- {severityLabel(incident.severity)}- </span>+ <AlertSeverityBadge+ severity={incident.severity}+ bucket={incident.severityBucket}+ /></TableCell><TableCell class={getPlatformTableCellClassForKind('text')}><span class="block truncate text-base-content" title={incident.summary}>diff --git a/frontend-modern/src/features/kubernetes/KubernetesAlertsTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesAlertsTable.tsxindex e700ea7d69..fde4854256 100644--- a/frontend-modern/src/features/kubernetes/KubernetesAlertsTable.tsx+++ b/frontend-modern/src/features/kubernetes/KubernetesAlertsTable.tsx@@ -7,8 +7,8 @@ import {type DetailSection,type DetailValueTone,} from '@/components/shared/DetailSectionTable';+import { AlertSeverityBadge, AlertSeverityDot } from '@/components/shared/AlertSeverityBadge';import { InlineDetailTableRow } from '@/components/shared/InlineDetailTableRow';-import { StatusDot } from '@/components/shared/StatusDot';import { TableCell, TableHead, TableRow } from '@/components/shared/Table';import { filterChipStatusDot } from '@/components/shared/FilterBar';import {@@ -26,8 +26,8 @@ import {getPlatformResourceDetailRowClass,} from '@/features/platformPage/PlatformResourceDetailTableRow';import type { ResourceType } from '@/types/resource';-import type { StatusIndicatorVariant } from '@/utils/status';import { getAlertFilteredEmptyState } from '@/utils/alertOverviewPresentation';+import { formatAlertSeverityLabel } from '@/utils/alertSeverityPresentation';import {filterKubernetesIncidents,type KubernetesIncidentRow,@@ -57,36 +57,6 @@ const KUBERNETES_INCIDENT_STATUS_OPTIONS: PlatformTableFilterOption<KubernetesIn},];-const severityVariant = (- severity: KubernetesIncidentRow['severityBucket'],-): StatusIndicatorVariant => {- switch (severity) {- case 'critical':- return 'danger';- case 'warning':- return 'warning';- case 'info':- return 'muted';- }-};--const severityLabel = (severity: string): string => {- const normalized = severity.trim();- if (!normalized) return 'Info';- return normalized.charAt(0).toUpperCase() + normalized.slice(1).toLowerCase();-};--const severityTextClass = (severity: KubernetesIncidentRow['severityBucket']): string => {- switch (severity) {- case 'critical':- return 'text-red-700 dark:text-red-300';- case 'warning':- return 'text-amber-700 dark:text-amber-300';- case 'info':- return 'text-muted';- }-};-const formatResourceType = (type: ResourceType): string => {switch (type) {case 'agent':@@ -181,7 +151,7 @@ const buildAlertDetailSections = (incident: KubernetesIncidentRow): AlertDetailS{label: 'Alert',rows: compactDetailRows([- detailRow('Severity', severityLabel(incident.severity), {+ detailRow('Severity', formatAlertSeverityLabel(incident.severity), {tone: alertTone(incident.severityBucket),}),detailRow('Summary', incident.summary),@@ -222,7 +192,9 @@ const AlertDetail: Component<{ incident: KubernetesIncidentRow; onClose: () => vtestId="kubernetes-alert-detail"detailFor={props.incident.id}title="Kubernetes alert detail"- summary={`${severityLabel(props.incident.severity)} · ${formatCode(props.incident.code)}`}+ summary={`${formatAlertSeverityLabel(props.incident.severity)} · ${formatCode(+ props.incident.code,+ )}`}sections={buildAlertDetailSections(props.incident)}detailAttributes={{ 'data-kubernetes-alert-detail-for': props.incident.id }}onClose={props.onClose}@@ -343,10 +315,10 @@ export const KubernetesAlertsTable: Component<{controlsId={detailRowId()}onToggle={() => drawer.toggle(incident)}/>- <StatusDot+ <AlertSeverityDotsize="sm"- variant={severityVariant(incident.severityBucket)}- title={severityLabel(incident.severity)}+ severity={incident.severity}+ bucket={incident.severityBucket}/><div class="min-w-0"><div@@ -365,13 +337,10 @@ export const KubernetesAlertsTable: Component<{</div></TableCell><TableCell class={getPlatformTableCellClassForKind('badge')}>- <span- class={`text-[11px] font-semibold ${severityTextClass(- incident.severityBucket,- )}`}- >- {severityLabel(incident.severity)}- </span>+ <AlertSeverityBadge+ severity={incident.severity}+ bucket={incident.severityBucket}+ /></TableCell><TableCell class={getPlatformTableCellClassForKind('text')}><span class="block truncate text-base-content" title={incident.summary}>diff --git a/frontend-modern/src/features/truenas/TrueNASAlertsTable.tsx b/frontend-modern/src/features/truenas/TrueNASAlertsTable.tsxindex cfe038acf0..d30d4b4a6e 100644--- a/frontend-modern/src/features/truenas/TrueNASAlertsTable.tsx+++ b/frontend-modern/src/features/truenas/TrueNASAlertsTable.tsx@@ -1,6 +1,6 @@import { For, Show, type Component, type JSX } from 'solid-js';+import { AlertSeverityBadge, AlertSeverityDot } from '@/components/shared/AlertSeverityBadge';import { InlineDetailTableRow } from '@/components/shared/InlineDetailTableRow';-import { StatusDot } from '@/components/shared/StatusDot';import { TableCell, TableHead, TableRow } from '@/components/shared/Table';import {PlatformTableEmptyState,@@ -16,7 +16,6 @@ import {createPlatformResourceDetailState,getPlatformResourceDetailRowClass,} from '@/features/platformPage/PlatformResourceDetailTableRow';-import type { StatusIndicatorVariant } from '@/utils/status';import {filterTrueNASIncidents,type TrueNASIncidentRow,@@ -32,6 +31,7 @@ import {} from '@/components/shared/DetailSectionTable';import type { Resource, ResourceType } from '@/types/resource';import { getAlertFilteredEmptyState } from '@/utils/alertOverviewPresentation';+import { formatAlertSeverityLabel } from '@/utils/alertSeverityPresentation';const TRUENAS_INCIDENT_STATUS_OPTIONS: PlatformTableFilterOption<TrueNASIncidentSeverityFilter>[] =[@@ -41,36 +41,6 @@ const TRUENAS_INCIDENT_STATUS_OPTIONS: PlatformTableFilterOption<TrueNASIncident{ value: 'info', label: 'Info', tone: 'success' },];-const severityVariant = (- severity: TrueNASIncidentRow['severityBucket'],-): StatusIndicatorVariant => {- switch (severity) {- case 'critical':- return 'danger';- case 'warning':- return 'warning';- case 'info':- return 'muted';- }-};--const severityLabel = (severity: string): string => {- const normalized = severity.trim();- if (!normalized) return 'Info';- return normalized.charAt(0).toUpperCase() + normalized.slice(1).toLowerCase();-};--const severityTextClass = (severity: TrueNASIncidentRow['severityBucket']): string => {- switch (severity) {- case 'critical':- return 'text-red-700 dark:text-red-300';- case 'warning':- return 'text-amber-700 dark:text-amber-300';- case 'info':- return 'text-muted';- }-};-const formatResourceType = (type: ResourceType): string => {switch (type) {case 'agent':@@ -145,7 +115,7 @@ const buildAlertDetailSections = (incident: TrueNASIncidentRow): AlertDetailSect{label: 'Alert',rows: compactDetailRows([- detailRow('Severity', severityLabel(incident.severity), {+ detailRow('Severity', formatAlertSeverityLabel(incident.severity), {tone: alertTone(incident.severityBucket),}),detailRow('Summary', incident.summary),@@ -184,7 +154,9 @@ const AlertDetailTable: Component<{ incident: TrueNASIncidentRow; onClose: () =>testId="truenas-alert-detail"detailFor={props.incident.id}title="Alert detail"- summary={`${severityLabel(props.incident.severity)} · ${formatCode(props.incident.code)}`}+ summary={`${formatAlertSeverityLabel(props.incident.severity)} · ${formatCode(+ props.incident.code,+ )}`}sections={buildAlertDetailSections(props.incident)}detailAttributes={{ 'data-truenas-alert-detail-for': props.incident.id }}onClose={props.onClose}@@ -299,10 +271,10 @@ export const TrueNASAlertsTable: Component<{controlsId={detailRowId()}onToggle={() => drawer.toggle(incident)}/>- <StatusDot+ <AlertSeverityDotsize="sm"- variant={severityVariant(incident.severityBucket)}- title={severityLabel(incident.severity)}+ severity={incident.severity}+ bucket={incident.severityBucket}/><div class="min-w-0"><div@@ -321,13 +293,10 @@ export const TrueNASAlertsTable: Component<{</div></TableCell><TableCell class={getPlatformTableCellClassForKind('badge')}>- <span- class={`text-[11px] font-semibold ${severityTextClass(- incident.severityBucket,- )}`}- >- {severityLabel(incident.severity)}- </span>+ <AlertSeverityBadge+ severity={incident.severity}+ bucket={incident.severityBucket}+ /></TableCell><TableCell class={`${getPlatformTableCellClassForKind('text')}`}><span class="block truncate text-base-content" title={incident.summary}>diff --git a/frontend-modern/src/features/vmware/VsphereAlertsTable.tsx b/frontend-modern/src/features/vmware/VsphereAlertsTable.tsxindex b1f3b3fed6..191e6409b0 100644--- a/frontend-modern/src/features/vmware/VsphereAlertsTable.tsx+++ b/frontend-modern/src/features/vmware/VsphereAlertsTable.tsx@@ -7,8 +7,8 @@ import {type DetailSection,type DetailValueTone,} from '@/components/shared/DetailSectionTable';+import { AlertSeverityBadge, AlertSeverityDot } from '@/components/shared/AlertSeverityBadge';import { InlineDetailTableRow } from '@/components/shared/InlineDetailTableRow';-import { StatusDot } from '@/components/shared/StatusDot';import { TableCell, TableHead, TableRow } from '@/components/shared/Table';import { filterChipStatusDot } from '@/components/shared/FilterBar';import {@@ -26,8 +26,8 @@ import {getPlatformResourceDetailRowClass,} from '@/features/platformPage/PlatformResourceDetailTableRow';import type { ResourceType } from '@/types/resource';-import type { StatusIndicatorVariant } from '@/utils/status';import { getAlertFilteredEmptyState } from '@/utils/alertOverviewPresentation';+import { formatAlertSeverityLabel } from '@/utils/alertSeverityPresentation';import {filterVmwareIncidents,type VmwareIncidentRow,@@ -56,34 +56,6 @@ const VSPHERE_INCIDENT_STATUS_OPTIONS: PlatformTableFilterOption<VmwareIncidentS},];-const severityVariant = (severity: VmwareIncidentRow['severityBucket']): StatusIndicatorVariant => {- switch (severity) {- case 'critical':- return 'danger';- case 'warning':- return 'warning';- case 'info':- return 'muted';- }-};--const severityTextClass = (severity: VmwareIncidentRow['severityBucket']): string => {- switch (severity) {- case 'critical':- return 'text-red-700 dark:text-red-300';- case 'warning':- return 'text-amber-700 dark:text-amber-300';- case 'info':- return 'text-muted';- }-};--const severityLabel = (severity: string): string => {- const normalized = severity.trim();- if (!normalized) return 'Info';- return normalized.charAt(0).toUpperCase() + normalized.slice(1).toLowerCase();-};-const formatResourceType = (type: ResourceType): string => {switch (type) {case 'agent':@@ -159,7 +131,7 @@ const buildAlertDetailSections = (incident: VmwareIncidentRow): AlertDetailSecti{label: 'Signal',rows: compactDetailRows([- detailRow('Severity', severityLabel(incident.severity), {+ detailRow('Severity', formatAlertSeverityLabel(incident.severity), {tone: alertTone(incident.severityBucket),}),detailRow('Summary', incident.summary),@@ -199,7 +171,9 @@ const AlertDetail: Component<{ incident: VmwareIncidentRow; onClose: () => voidtestId="vsphere-alert-detail"detailFor={props.incident.id}title="vSphere health detail"- summary={`${severityLabel(props.incident.severity)} · ${formatCode(props.incident.code)}`}+ summary={`${formatAlertSeverityLabel(props.incident.severity)} · ${formatCode(+ props.incident.code,+ )}`}sections={buildAlertDetailSections(props.incident)}detailAttributes={{ 'data-vsphere-alert-detail-for': props.incident.id }}onClose={props.onClose}@@ -314,10 +288,10 @@ export const VsphereAlertsTable: Component<{controlsId={detailRowId()}onToggle={() => drawer.toggle(incident)}/>- <StatusDot+ <AlertSeverityDotsize="sm"- variant={severityVariant(incident.severityBucket)}- title={severityLabel(incident.severity)}+ severity={incident.severity}+ bucket={incident.severityBucket}/><div class="min-w-0"><div@@ -336,13 +310,10 @@ export const VsphereAlertsTable: Component<{</div></TableCell><TableCell class={getPlatformTableCellClassForKind('badge')}>- <span- class={`text-[11px] font-semibold ${severityTextClass(- incident.severityBucket,- )}`}- >- {severityLabel(incident.severity)}- </span>+ <AlertSeverityBadge+ severity={incident.severity}+ bucket={incident.severityBucket}+ /></TableCell><TableCell class={getPlatformTableCellClassForKind('text')}><span class="block truncate text-base-content" title={incident.summary}>diff --git a/frontend-modern/src/utils/__tests__/alertSeverityPresentation.test.ts b/frontend-modern/src/utils/__tests__/alertSeverityPresentation.test.tsindex a3c4fc182b..2389d5f75d 100644--- a/frontend-modern/src/utils/__tests__/alertSeverityPresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/alertSeverityPresentation.test.ts@@ -1,12 +1,35 @@import { describe, expect, it } from 'vitest';import {+ formatAlertSeverityLabel,+ getAlertSeverityIndicator,getAlertSeverityBadgeClass,getAlertSeverityCompactLabel,getAlertSeverityDotClass,+ getAlertSeverityIndicatorVariant,getAlertSeverityTextClass,} from '@/utils/alertSeverityPresentation';describe('alertSeverityPresentation', () => {+ it('formats provider severity labels predictably for platform alert rows', () => {+ expect(formatAlertSeverityLabel('critical')).toBe('Critical');+ expect(formatAlertSeverityLabel('restart_loop')).toBe('Restart Loop');+ expect(formatAlertSeverityLabel('')).toBe('Info');+ });++ it('maps alert severity buckets to status indicator variants', () => {+ expect(getAlertSeverityIndicatorVariant('critical')).toBe('danger');+ expect(getAlertSeverityIndicatorVariant('warning')).toBe('warning');+ expect(getAlertSeverityIndicatorVariant('info')).toBe('muted');+ expect(getAlertSeverityIndicatorVariant('maintenance')).toBe('muted');+ });++ it('uses bucket tone and provider label for shared alert indicators', () => {+ expect(getAlertSeverityIndicator('restart_loop', 'warning')).toEqual({+ variant: 'warning',+ label: 'Restart Loop',+ });+ });+it('maps critical alerts to danger styling', () => {expect(getAlertSeverityBadgeClass('critical')).toContain('red-100');});diff --git a/frontend-modern/src/utils/alertSeverityPresentation.ts b/frontend-modern/src/utils/alertSeverityPresentation.tsindex b89056b580..dd9ed1967f 100644--- a/frontend-modern/src/utils/alertSeverityPresentation.ts+++ b/frontend-modern/src/utils/alertSeverityPresentation.ts@@ -1,4 +1,5 @@import type { Alert } from '@/types/api';+import type { StatusIndicator, StatusIndicatorVariant } from '@/utils/status';const ALERT_SEVERITY_COMPACT_LABELS: Record<string, string> = {critical: 'CRIT',@@ -6,11 +7,53 @@ const ALERT_SEVERITY_COMPACT_LABELS: Record<string, string> = {info: 'INFO',};+const normalizeAlertSeverity = (level?: Alert['level'] | string | null): string =>+ String(level ?? '')+ .trim()+ .toLowerCase();++export function formatAlertSeverityLabel(+ level?: Alert['level'] | string | null,+ fallback = 'Info',+): string {+ const normalized = normalizeAlertSeverity(level);+ if (!normalized) return fallback;+ return normalized+ .split(/[\s_-]+/)+ .filter(Boolean)+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))+ .join(' ');+}++export function getAlertSeverityIndicatorVariant(+ level?: Alert['level'] | string | null,+): StatusIndicatorVariant {+ switch (normalizeAlertSeverity(level)) {+ case 'critical':+ return 'danger';+ case 'warning':+ return 'warning';+ case 'info':+ default:+ return 'muted';+ }+}++export function getAlertSeverityIndicator(+ level?: Alert['level'] | string | null,+ bucket?: Alert['level'] | string | null,+): StatusIndicator {+ return {+ variant: getAlertSeverityIndicatorVariant(bucket ?? level),+ label: formatAlertSeverityLabel(level ?? bucket),+ };+}+export function getAlertSeverityBadgeClass(level: Alert['level'] | string): string {const base ='inline-flex shrink-0 items-center rounded px-1.5 py-0.5 text-[10px] font-semibold uppercase';- switch (level) {+ switch (normalizeAlertSeverity(level)) {case 'critical':return `${base} bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300`;case 'warning':@@ -21,7 +64,7 @@ export function getAlertSeverityBadgeClass(level: Alert['level'] | string): stri}export function getAlertSeverityTextClass(level: Alert['level'] | string): string {- switch (level) {+ switch (normalizeAlertSeverity(level)) {case 'critical':return 'text-red-600 dark:text-red-400';case 'warning':@@ -32,11 +75,12 @@ export function getAlertSeverityTextClass(level: Alert['level'] | string): strin}export function getAlertSeverityCompactLabel(level: Alert['level'] | string): string {- return ALERT_SEVERITY_COMPACT_LABELS[level] || String(level).toUpperCase();+ const normalized = normalizeAlertSeverity(level);+ return ALERT_SEVERITY_COMPACT_LABELS[normalized] || String(level).toUpperCase();}export function getAlertSeverityDotClass(level: Alert['level'] | string): string {- switch (level) {+ switch (normalizeAlertSeverity(level)) {case 'critical':return 'h-2 w-2 rounded-full bg-red-500';case 'warning':