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
Split alert overview render owners
rcourtmana3dd51042181
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.mdindex 60f5f36ad1..41c28de9d5 100644--- a/docs/release-control/v6/internal/subsystems/alerts.md+++ b/docs/release-control/v6/internal/subsystems/alerts.md@@ -226,6 +226,12 @@ shared acknowledgement owner instead of keeping its own alert mutation fork.Future overview or dashboard recent-alert action behavior should extend thatshared acknowledgement hook instead of putting acknowledge mutations back intoeither render shell.+Render-heavy alert overview ownership now routes through+`frontend-modern/src/features/alerts/AlertOverviewStatsCards.tsx`,+`frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx`,+and `frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx` instead+of rebuilding stats-card, active-alert, and timeline-card presentation inline+inside `frontend-modern/src/features/alerts/OverviewTab.tsx`.Dashboard recent-alert rendering and dashboard alert summary/tone copy nowroute through that same alert overview presentation owner and the alert-owned`frontend-modern/src/components/Alerts/RecentAlertsPanel.tsx` surface insteaddiff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex ec15d2f9a1..c4ea217605 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -510,6 +510,13 @@ shell stays in `frontend-modern/src/features/alerts/OverviewTab.tsx`, whilealert stats, filtered ordering, and single/bulk acknowledge runtime behavior.Future overview control flow should extend that hook rather than restoringaction timers or acknowledge mutations to the tab shell.+Render-heavy overview ownership now lives in+`frontend-modern/src/features/alerts/AlertOverviewStatsCards.tsx`,+`frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx`,+and `frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx`, so+future card-list or timeline-card presentation work should extend those+surfaces rather than expanding `frontend-modern/src/features/alerts/OverviewTab.tsx`+back into a mixed shell.Alert history runtime now follows that same pattern. The shell stays in`frontend-modern/src/features/alerts/tabs/HistoryTab.tsx`, while`frontend-modern/src/features/alerts/useAlertHistoryState.ts` owns historydiff --git a/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx b/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsxnew file mode 100644index 0000000000..e920de1923--- /dev/null+++ b/frontend-modern/src/features/alerts/AlertOverviewActiveAlertsSection.tsx@@ -0,0 +1,139 @@+import { For, Show } from 'solid-js';++import { SectionHeader } from '@/components/shared/SectionHeader';+import type { Alert } from '@/types/api';+import {+ ALERTS_EMPTY_STATE,+ ALERTS_THRESHOLD_HINT,+ getAlertListEmptyState,+} from '@/utils/alertOverviewPresentation';++import { AlertOverviewAlertCard } from './AlertOverviewAlertCard';+import type { AlertIncidentTimelineState } from './useAlertIncidentTimelineState';+import type { AlertOverviewState } from './useAlertOverviewState';++interface AlertOverviewActiveAlertsSectionProps {+ state: AlertOverviewState;+ timelineState: AlertIncidentTimelineState;+ activeAlerts: Record<string, Alert>;+ alertsDisabled: boolean;+ hasAIAlertsFeature: boolean;+ licenseLoading: boolean;+ showAcknowledged: boolean;+ setShowAcknowledged: (value: boolean) => void;+}++export function AlertOverviewActiveAlertsSection(props: AlertOverviewActiveAlertsSectionProps) {+ return (+ <div>+ <SectionHeader title="Active Alerts" size="md" class="mb-3" />+ <Show+ when={Object.keys(props.activeAlerts).length > 0}+ fallback={+ <div class="text-center py-8 text-muted">+ <Show+ when={!props.alertsDisabled}+ fallback={+ <>+ <div class="flex justify-center mb-3">+ <svg+ class="w-12 h-12 text-muted"+ fill="none"+ stroke="currentColor"+ viewBox="0 0 24 24"+ >+ <circle cx="12" cy="12" r="10" stroke-width="2" />+ <line+ x1="4"+ y1="4"+ x2="20"+ y2="20"+ stroke-width="2"+ stroke-linecap="round"+ />+ </svg>+ </div>+ <p class="text-sm">Alerting is paused</p>+ <p class="text-xs mt-1">+ Toggle alerts on to resume monitoring and unlock configuration tabs+ </p>+ </>+ }+ >+ <div class="flex justify-center mb-3">+ <svg+ class="w-12 h-12 text-green-500 dark:text-green-400"+ fill="none"+ stroke="currentColor"+ viewBox="0 0 24 24"+ >+ <circle+ cx="12"+ cy="12"+ r="10"+ stroke="currentColor"+ stroke-width="2"+ fill="none"+ />+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ d="M9 12l2 2 4-4"+ />+ </svg>+ </div>+ <p class="text-sm">{ALERTS_EMPTY_STATE}</p>+ <p class="text-xs mt-1">{ALERTS_THRESHOLD_HINT}</p>+ </Show>+ </div>+ }+ >+ <Show when={props.state.alertStats().acknowledged > 0 || props.state.alertStats().active > 0}>+ <div class="flex flex-wrap items-center justify-between gap-1.5 p-1.5 bg-surface-alt rounded-t-lg border border-border">+ <Show when={props.state.alertStats().acknowledged > 0}>+ <button+ onClick={() => props.setShowAcknowledged(!props.showAcknowledged)}+ class="text-xs text-muted hover:text-base-content transition-colors"+ >+ {props.showAcknowledged ? 'Hide' : 'Show'} acknowledged+ </button>+ </Show>+ <Show when={props.state.alertStats().active > 0}>+ <button+ type="button"+ class="inline-flex items-center gap-1 px-3 py-1.5 text-xs font-medium rounded-md border border-blue-200 dark:border-blue-700 bg-blue-50 dark:bg-blue-900 text-blue-700 dark:text-blue-200 transition-colors hover:bg-blue-100 dark:hover:bg-blue-900 disabled:opacity-60 disabled:cursor-not-allowed"+ disabled={props.state.bulkAckProcessing()}+ onClick={() => {+ void props.state.handleBulkAcknowledge();+ }}+ >+ {props.state.bulkAckProcessing()+ ? 'Acknowledging…'+ : `Acknowledge all (${props.state.alertStats().active})`}+ </button>+ </Show>+ </div>+ </Show>+ <div class="space-y-2">+ <Show when={props.state.filteredAlerts().length === 0}>+ <div class="text-center py-8 text-muted">+ {getAlertListEmptyState(props.showAcknowledged)}+ </div>+ </Show>+ <For each={props.state.filteredAlerts()}>+ {(alert) => (+ <AlertOverviewAlertCard+ alert={alert}+ state={props.state}+ timelineState={props.timelineState}+ hasAIAlertsFeature={props.hasAIAlertsFeature}+ licenseLoading={props.licenseLoading}+ />+ )}+ </For>+ </div>+ </Show>+ </div>+ );+}diff --git a/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsxnew file mode 100644index 0000000000..b6dcc0ed94--- /dev/null+++ b/frontend-modern/src/features/alerts/AlertOverviewAlertCard.tsx@@ -0,0 +1,141 @@+import { Show } from 'solid-js';++import { InvestigateAlertButton } from '@/components/Alerts/InvestigateAlertButton';+import { IncidentTimelinePanel } from '@/components/Alerts/IncidentTimelinePanel';+import type { Alert } from '@/types/api';+import {+ getAlertOverviewAcknowledgedBadgeClass,+ getAlertOverviewCardPresentation,+ getAlertOverviewPrimaryActionClass,+ getAlertOverviewSecondaryActionClass,+ getAlertOverviewStartedAtClass,+} from '@/utils/alertOverviewPresentation';++import { alertTypeDisplayLabel } from './helpers';+import { getCanonicalAlertId } from './identity';+import type { AlertIncidentTimelineState } from './useAlertIncidentTimelineState';+import type { AlertOverviewState } from './useAlertOverviewState';++interface AlertOverviewAlertCardProps {+ alert: Alert;+ state: AlertOverviewState;+ timelineState: AlertIncidentTimelineState;+ hasAIAlertsFeature: boolean;+ licenseLoading: boolean;+}++export function AlertOverviewAlertCard(props: AlertOverviewAlertCardProps) {+ const alertKey = () => getCanonicalAlertId(props.alert);+ const alertCardPresentation = () =>+ getAlertOverviewCardPresentation(+ props.alert.level ?? 'warning',+ props.alert.acknowledged,+ props.state.processingAlerts().has(alertKey()),+ );++ return (+ <div id={`alert-${alertKey()}`} class={alertCardPresentation().cardClassName}>+ <div class="flex flex-col sm:flex-row sm:items-start">+ <div class="flex items-start flex-1">+ <div class={alertCardPresentation().iconClassName}>+ {props.alert.acknowledged ? (+ <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"+ />+ </svg>+ ) : (+ <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">+ <path+ stroke-linecap="round"+ stroke-linejoin="round"+ stroke-width="2"+ d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"+ />+ </svg>+ )}+ </div>+ <div class="flex-1 min-w-0">+ <div class="flex flex-wrap items-center gap-2">+ <span class={alertCardPresentation().resourceClassName}>{props.alert.resourceName}</span>+ <span class="text-xs text-muted">({alertTypeDisplayLabel(props.alert.type)})</span>+ <Show when={props.alert.node}>+ <span class="text-xs text-muted">+ on {props.alert.nodeDisplayName || props.alert.node}+ </span>+ </Show>+ <Show when={props.alert.acknowledged}>+ <span class={getAlertOverviewAcknowledgedBadgeClass()}>Acknowledged</span>+ </Show>+ </div>+ <p class="text-sm text-base-content mt-1 break-words">{props.alert.message}</p>+ <p class={getAlertOverviewStartedAtClass()}>+ Started: {new Date(props.alert.startTime).toLocaleString()}+ </p>+ </div>+ </div>+ <div class="flex flex-wrap items-center gap-1.5 sm:gap-2 mt-3 sm:mt-0 sm:ml-4 self-end sm:self-start justify-end">+ <button+ class={getAlertOverviewPrimaryActionClass(props.alert.acknowledged)}+ disabled={props.state.processingAlerts().has(alertKey())}+ onClick={async (e) => {+ e.preventDefault();+ e.stopPropagation();+ await props.state.handleAlertAcknowledgement(props.alert);+ }}+ >+ {props.state.processingAlerts().has(alertKey())+ ? 'Processing...'+ : props.alert.acknowledged+ ? 'Unacknowledge'+ : 'Acknowledge'}+ </button>+ <button+ class={getAlertOverviewSecondaryActionClass()}+ onClick={() => {+ void props.timelineState.toggleIncidentTimeline(alertKey(), props.alert.startTime);+ }}+ >+ {props.timelineState.expandedIncidents().has(alertKey()) ? 'Hide Timeline' : 'Timeline'}+ </button>+ <InvestigateAlertButton+ alert={props.alert}+ resourceType={+ typeof props.alert.metadata?.resourceType === 'string'+ ? (props.alert.metadata.resourceType as string)+ : undefined+ }+ variant="text"+ size="sm"+ licenseLocked={!props.hasAIAlertsFeature && !props.licenseLoading}+ />+ </div>+ </div>+ <Show when={props.timelineState.expandedIncidents().has(alertKey())}>+ <div class="mt-3 border-t border-border pt-3">+ <IncidentTimelinePanel+ loading={props.timelineState.incidentLoading()[alertKey()]}+ error={props.timelineState.incidentErrors()[alertKey()]}+ timeline={props.timelineState.incidentTimelines()[alertKey()]}+ filters={props.timelineState.eventFilters}+ setFilters={props.timelineState.setEventFilters}+ filterVariant="panel"+ eventCardVariant="alt"+ noteDraft={props.timelineState.incidentNoteDrafts()[alertKey()] || ''}+ onNoteDraftChange={(value) => props.timelineState.setIncidentNoteDraft(alertKey(), value)}+ noteSaving={props.timelineState.incidentNoteSaving().has(alertKey())}+ onSaveNote={() => {+ void props.timelineState.saveIncidentNote(alertKey(), props.alert.startTime);+ }}+ onRetry={() => {+ void props.timelineState.loadIncidentTimeline(alertKey(), props.alert.startTime);+ }}+ />+ </div>+ </Show>+ </div>+ );+}diff --git a/frontend-modern/src/features/alerts/AlertOverviewStatsCards.tsx b/frontend-modern/src/features/alerts/AlertOverviewStatsCards.tsxnew file mode 100644index 0000000000..8d3f96668c--- /dev/null+++ b/frontend-modern/src/features/alerts/AlertOverviewStatsCards.tsx@@ -0,0 +1,94 @@+import { Card } from '@/components/shared/Card';++import type { AlertOverviewState } from './useAlertOverviewState';++interface AlertOverviewStatsCardsProps {+ state: AlertOverviewState;+}++export function AlertOverviewStatsCards(props: AlertOverviewStatsCardsProps) {+ return (+ <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2 sm:gap-4">+ <Card padding="sm" class="sm:p-4">+ <div class="flex items-center justify-between">+ <div>+ <p class="text-[10px] sm:text-sm text-muted uppercase tracking-wider sm:normal-case">+ Acknowledged+ </p>+ <p class="text-lg sm:text-2xl font-semibold text-yellow-600 dark:text-yellow-400">+ {props.state.alertStats().acknowledged}+ </p>+ </div>+ <div class="w-8 h-8 sm:w-10 sm:h-10 bg-yellow-100 dark:bg-yellow-900 rounded-full flex items-center justify-center">+ <svg+ width="16"+ height="16"+ class="sm:w-5 sm:h-5 text-yellow-600 dark:text-yellow-400"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ stroke-width="2"+ >+ <path d="M9 11L12 14L22 4"></path>+ <path d="M21 12V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V5C3 3.89543 3 3 5 3H16"></path>+ </svg>+ </div>+ </div>+ </Card>++ <Card padding="sm" class="sm:p-4">+ <div class="flex items-center justify-between">+ <div>+ <p class="text-[10px] sm:text-sm text-muted uppercase tracking-wider sm:normal-case">+ Last 24 Hours+ </p>+ <p class="text-lg sm:text-2xl font-semibold text-base-content">+ {props.state.alertStats().total24h}+ </p>+ </div>+ <div class="w-8 h-8 sm:w-10 sm:h-10 bg-surface-hover rounded-full flex items-center justify-center">+ <svg+ width="16"+ height="16"+ class="sm:w-5 sm:h-5 text-muted"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ stroke-width="2"+ >+ <circle cx="12" cy="12" r="10"></circle>+ <polyline points="12 6 12 12 16 14"></polyline>+ </svg>+ </div>+ </div>+ </Card>++ <Card padding="sm" class="sm:p-4">+ <div class="flex items-center justify-between">+ <div>+ <p class="text-[10px] sm:text-sm text-muted uppercase tracking-wider sm:normal-case">+ Guest Overrides+ </p>+ <p class="text-lg sm:text-2xl font-semibold text-blue-600 dark:text-blue-400">+ {props.state.alertStats().overrides}+ </p>+ </div>+ <div class="w-8 h-8 sm:w-10 sm:h-10 bg-blue-100 dark:bg-blue-900 rounded-full flex items-center justify-center">+ <svg+ width="16"+ height="16"+ class="sm:w-5 sm:h-5 text-blue-600 dark:text-blue-400"+ viewBox="0 0 24 24"+ fill="none"+ stroke="currentColor"+ stroke-width="2"+ >+ <path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"></path>+ <path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"></path>+ </svg>+ </div>+ </div>+ </Card>+ </div>+ );+}diff --git a/frontend-modern/src/features/alerts/OverviewTab.tsx b/frontend-modern/src/features/alerts/OverviewTab.tsxindex dc45bd92ba..3eeeaa11f4 100644--- a/frontend-modern/src/features/alerts/OverviewTab.tsx+++ b/frontend-modern/src/features/alerts/OverviewTab.tsx@@ -1,28 +1,14 @@-import { InvestigateAlertButton } from '@/components/Alerts/InvestigateAlertButton';--import { createSignal, onCleanup, For, Show, createEffect } from 'solid-js';+import { createSignal, onCleanup, createEffect } from 'solid-js';import { useLocation } from '@solidjs/router';import type { Alert } from '@/types/api';++import { AlertOverviewActiveAlertsSection } from './AlertOverviewActiveAlertsSection';+import { AlertOverviewStatsCards } from './AlertOverviewStatsCards';import type { Override } from './types';-import { alertTypeDisplayLabel } from './helpers';-import { getCanonicalAlertId } from './identity';-import { useAlertOverviewState } from './useAlertOverviewState';import { useAlertIncidentTimelineState } from './useAlertIncidentTimelineState';-import { Card } from '@/components/shared/Card';-import { SectionHeader } from '@/components/shared/SectionHeader';-import { IncidentTimelinePanel } from '@/components/Alerts/IncidentTimelinePanel';-import {- ALERTS_EMPTY_STATE,- ALERTS_THRESHOLD_HINT,- getAlertListEmptyState,- getAlertOverviewAcknowledgedBadgeClass,- getAlertOverviewCardPresentation,- getAlertOverviewPrimaryActionClass,- getAlertOverviewSecondaryActionClass,- getAlertOverviewStartedAtClass,-} from '@/utils/alertOverviewPresentation';-+import { useAlertOverviewState } from './useAlertOverviewState';+export function OverviewTab(props: {overrides: Override[];activeAlerts: Record<string, Alert>;@@ -38,33 +24,13 @@ export function OverviewTab(props: {const location = useLocation();let hashScrollRafId: number | undefined;const [lastHashScrolled, setLastHashScrolled] = createSignal<string | null>(null);- const {- alertStats,- filteredAlerts,- processingAlerts,- bulkAckProcessing,- handleAlertAcknowledgement,- handleBulkAcknowledge,- } = useAlertOverviewState({+ const overviewState = useAlertOverviewState({activeAlerts: () => props.activeAlerts,overrides: () => props.overrides,showAcknowledged: props.showAcknowledged,updateAlert: props.updateAlert,});- const {- incidentTimelines,- incidentLoading,- incidentErrors,- expandedIncidents,- incidentNoteDrafts,- incidentNoteSaving,- eventFilters: incidentEventFilters,- setEventFilters: setIncidentEventFilters,- loadIncidentTimeline,- toggleIncidentTimeline,- setIncidentNoteDraft,- saveIncidentNote,- } = useAlertIncidentTimelineState();+ const timelineState = useAlertIncidentTimelineState();const scrollToAlertHash = () => {const hash = location.hash;@@ -85,7 +51,7 @@ export function OverviewTab(props: {createEffect(() => {location.hash;- filteredAlerts().length;+ overviewState.filteredAlerts().length;props.showAcknowledged();if (hashScrollRafId !== undefined) {cancelAnimationFrame(hashScrollRafId);@@ -105,332 +71,17 @@ export function OverviewTab(props: {return (<div class="space-y-4 sm:space-y-6">- {/* Stats Cards - only show cards not duplicated in sub-tabs */}- <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-2 sm:gap-4">- <Card padding="sm" class="sm:p-4">- <div class="flex items-center justify-between">- <div>- <p class="text-[10px] sm:text-sm text-muted uppercase tracking-wider sm:normal-case">- Acknowledged- </p>- <p class="text-lg sm:text-2xl font-semibold text-yellow-600 dark:text-yellow-400">- {alertStats().acknowledged}- </p>- </div>- <div class="w-8 h-8 sm:w-10 sm:h-10 bg-yellow-100 dark:bg-yellow-900 rounded-full flex items-center justify-center">- <svg- width="16"- height="16"- class="sm:w-5 sm:h-5 text-yellow-600 dark:text-yellow-400"- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- stroke-width="2"- >- <path d="M9 11L12 14L22 4"></path>- <path d="M21 12V19C21 20.1046 20.1046 21 19 21H5C3.89543 21 3 20.1046 3 19V5C3 3.89543 3.89543 3 5 3H16"></path>- </svg>- </div>- </div>- </Card>-- <Card padding="sm" class="sm:p-4">- <div class="flex items-center justify-between">- <div>- <p class="text-[10px] sm:text-sm text-muted uppercase tracking-wider sm:normal-case">- Last 24 Hours- </p>- <p class="text-lg sm:text-2xl font-semibold text-base-content">- {alertStats().total24h}- </p>- </div>- <div class="w-8 h-8 sm:w-10 sm:h-10 bg-surface-hover rounded-full flex items-center justify-center">- <svg- width="16"- height="16"- class="sm:w-5 sm:h-5 text-muted"- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- stroke-width="2"- >- <circle cx="12" cy="12" r="10"></circle>- <polyline points="12 6 12 12 16 14"></polyline>- </svg>- </div>- </div>- </Card>-- <Card padding="sm" class="sm:p-4">- <div class="flex items-center justify-between">- <div>- <p class="text-[10px] sm:text-sm text-muted uppercase tracking-wider sm:normal-case">- Guest Overrides- </p>- <p class="text-lg sm:text-2xl font-semibold text-blue-600 dark:text-blue-400">- {alertStats().overrides}- </p>- </div>- <div class="w-8 h-8 sm:w-10 sm:h-10 bg-blue-100 dark:bg-blue-900 rounded-full flex items-center justify-center">- <svg- width="16"- height="16"- class="sm:w-5 sm:h-5 text-blue-600 dark:text-blue-400"- viewBox="0 0 24 24"- fill="none"- stroke="currentColor"- stroke-width="2"- >- <path d="M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7"></path>- <path d="M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z"></path>- </svg>- </div>- </div>- </Card>- </div>-- {/* Active Alerts */}- <div>- <SectionHeader title="Active Alerts" size="md" class="mb-3" />- <Show- when={Object.keys(props.activeAlerts).length > 0}- fallback={- <div class="text-center py-8 text-muted">- <Show- when={!props.alertsDisabled()}- fallback={- <>- <div class="flex justify-center mb-3">- <svg- class="w-12 h-12 text-muted"- fill="none"- stroke="currentColor"- viewBox="0 0 24 24"- >- <circle cx="12" cy="12" r="10" stroke-width="2" />- <line- x1="4"- y1="4"- x2="20"- y2="20"- stroke-width="2"- stroke-linecap="round"- />- </svg>- </div>- <p class="text-sm">Alerting is paused</p>- <p class="text-xs mt-1">- Toggle alerts on to resume monitoring and unlock configuration tabs- </p>- </>- }- >- <div class="flex justify-center mb-3">- <svg- class="w-12 h-12 text-green-500 dark:text-green-400"- fill="none"- stroke="currentColor"- viewBox="0 0 24 24"- >- <circle- cx="12"- cy="12"- r="10"- stroke="currentColor"- stroke-width="2"- fill="none"- />- <path- stroke-linecap="round"- stroke-linejoin="round"- stroke-width="2"- d="M9 12l2 2 4-4"- />- </svg>- </div>- <p class="text-sm">{ALERTS_EMPTY_STATE}</p>- <p class="text-xs mt-1">{ALERTS_THRESHOLD_HINT}</p>- </Show>- </div>- }- >- <Show when={alertStats().acknowledged > 0 || alertStats().active > 0}>- <div class="flex flex-wrap items-center justify-between gap-1.5 p-1.5 bg-surface-alt rounded-t-lg border border-border">- <Show when={alertStats().acknowledged > 0}>- <button- onClick={() => props.setShowAcknowledged(!props.showAcknowledged())}- class="text-xs text-muted hover:text-base-content transition-colors"- >- {props.showAcknowledged() ? 'Hide' : 'Show'} acknowledged- </button>- </Show>- <Show when={alertStats().active > 0}>- <button- type="button"- class="inline-flex items-center gap-1 px-3 py-1.5 text-xs font-medium rounded-md border border-blue-200 dark:border-blue-700 bg-blue-50 dark:bg-blue-900 text-blue-700 dark:text-blue-200 transition-colors hover:bg-blue-100 dark:hover:bg-blue-900 disabled:opacity-60 disabled:cursor-not-allowed"- disabled={bulkAckProcessing()}- onClick={() => {- void handleBulkAcknowledge();- }}- >- {bulkAckProcessing()- ? 'Acknowledging…'- : `Acknowledge all (${alertStats().active})`}- </button>- </Show>- </div>- </Show>- <div class="space-y-2">- <Show when={filteredAlerts().length === 0}>- <div class="text-center py-8 text-muted">- {getAlertListEmptyState(props.showAcknowledged())}- </div>- </Show>- <For each={filteredAlerts()}>- {(alert) => {- const alertCardPresentation = () =>- getAlertOverviewCardPresentation(- alert.level ?? 'warning',- alert.acknowledged,- processingAlerts().has(getCanonicalAlertId(alert)),- );-- return (- <div- id={`alert-${getCanonicalAlertId(alert)}`}- class={alertCardPresentation().cardClassName}- >- <div class="flex flex-col sm:flex-row sm:items-start">- <div class="flex items-start flex-1">- {/* Status icon */}- <div class={alertCardPresentation().iconClassName}>- {alert.acknowledged ? (- // Checkmark for acknowledged- <svg- class="w-5 h-5"- fill="none"- stroke="currentColor"- viewBox="0 0 24 24"- >- <path- stroke-linecap="round"- stroke-linejoin="round"- stroke-width="2"- d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"- />- </svg>- ) : (- // Warning/Alert icon- <svg- class="w-5 h-5"- fill="none"- stroke="currentColor"- viewBox="0 0 24 24"- >- <path- stroke-linecap="round"- stroke-linejoin="round"- stroke-width="2"- d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"- />- </svg>- )}- </div>- <div class="flex-1 min-w-0">- <div class="flex flex-wrap items-center gap-2">- <span class={alertCardPresentation().resourceClassName}>- {alert.resourceName}- </span>- <span class="text-xs text-muted">- ({alertTypeDisplayLabel(alert.type)})- </span>- <Show when={alert.node}>- <span class="text-xs text-muted">- on {alert.nodeDisplayName || alert.node}- </span>- </Show>- <Show when={alert.acknowledged}>- <span class={getAlertOverviewAcknowledgedBadgeClass()}>- Acknowledged- </span>- </Show>- </div>- <p class="text-sm text-base-content mt-1 break-words">{alert.message}</p>- <p class={getAlertOverviewStartedAtClass()}>- Started: {new Date(alert.startTime).toLocaleString()}- </p>- </div>- </div>- <div class="flex flex-wrap items-center gap-1.5 sm:gap-2 mt-3 sm:mt-0 sm:ml-4 self-end sm:self-start justify-end">- <button- class={getAlertOverviewPrimaryActionClass(alert.acknowledged)}- disabled={processingAlerts().has(getCanonicalAlertId(alert))}- onClick={async (e) => {- e.preventDefault();- e.stopPropagation();- await handleAlertAcknowledgement(alert);- }}- >- {processingAlerts().has(getCanonicalAlertId(alert))- ? 'Processing...'- : alert.acknowledged- ? 'Unacknowledge'- : 'Acknowledge'}- </button>- <button- class={getAlertOverviewSecondaryActionClass()}- onClick={() => {- void toggleIncidentTimeline(getCanonicalAlertId(alert), alert.startTime);- }}- >- {expandedIncidents().has(getCanonicalAlertId(alert))- ? 'Hide Timeline'- : 'Timeline'}- </button>- <InvestigateAlertButton- alert={alert}- resourceType={- typeof alert.metadata?.resourceType === 'string'- ? (alert.metadata.resourceType as string)- : undefined- }- variant="text"- size="sm"- licenseLocked={!props.hasAIAlertsFeature() && !props.licenseLoading()}- />- </div>- </div>- <Show when={expandedIncidents().has(getCanonicalAlertId(alert))}>- <div class="mt-3 border-t border-border pt-3">- <IncidentTimelinePanel- loading={incidentLoading()[getCanonicalAlertId(alert)]}- error={incidentErrors()[getCanonicalAlertId(alert)]}- timeline={incidentTimelines()[getCanonicalAlertId(alert)]}- filters={incidentEventFilters}- setFilters={setIncidentEventFilters}- filterVariant="panel"- eventCardVariant="alt"- noteDraft={incidentNoteDrafts()[getCanonicalAlertId(alert)] || ''}- onNoteDraftChange={(value) =>- setIncidentNoteDraft(getCanonicalAlertId(alert), value)- }- noteSaving={incidentNoteSaving().has(getCanonicalAlertId(alert))}- onSaveNote={() => {- void saveIncidentNote(getCanonicalAlertId(alert), alert.startTime);- }}- onRetry={() => {- void loadIncidentTimeline(getCanonicalAlertId(alert), alert.startTime);- }}- />- </div>- </Show>- </div>- );- }}- </For>- </div>- </Show>- </div>+ <AlertOverviewStatsCards state={overviewState} />+ <AlertOverviewActiveAlertsSection+ state={overviewState}+ timelineState={timelineState}+ activeAlerts={props.activeAlerts}+ alertsDisabled={props.alertsDisabled()}+ hasAIAlertsFeature={props.hasAIAlertsFeature()}+ licenseLoading={props.licenseLoading()}+ showAcknowledged={props.showAcknowledged()}+ setShowAcknowledged={props.setShowAcknowledged}+ /></div>);}diff --git a/frontend-modern/src/features/alerts/useAlertIncidentTimelineState.ts b/frontend-modern/src/features/alerts/useAlertIncidentTimelineState.tsindex a48c6456f6..e6888bceff 100644--- a/frontend-modern/src/features/alerts/useAlertIncidentTimelineState.ts+++ b/frontend-modern/src/features/alerts/useAlertIncidentTimelineState.ts@@ -116,3 +116,5 @@ export function useAlertIncidentTimelineState() {saveIncidentNote,};}++export type AlertIncidentTimelineState = ReturnType<typeof useAlertIncidentTimelineState>;diff --git a/frontend-modern/src/features/alerts/useAlertOverviewState.ts b/frontend-modern/src/features/alerts/useAlertOverviewState.tsindex 5ac061c676..7dae9ff4c1 100644--- a/frontend-modern/src/features/alerts/useAlertOverviewState.ts+++ b/frontend-modern/src/features/alerts/useAlertOverviewState.ts@@ -67,3 +67,5 @@ export function useAlertOverviewState(props: UseAlertOverviewStateProps) {handleBulkAcknowledge,};}++export type AlertOverviewState = ReturnType<typeof useAlertOverviewState>;diff --git a/frontend-modern/src/pages/__tests__/Alerts.helpers.test.ts b/frontend-modern/src/pages/__tests__/Alerts.helpers.test.tsindex f8251b8d00..bb574f39e4 100644--- a/frontend-modern/src/pages/__tests__/Alerts.helpers.test.ts+++ b/frontend-modern/src/pages/__tests__/Alerts.helpers.test.ts@@ -16,6 +16,9 @@ import alertResourceIncidentsPanelSource from '@/features/alerts/AlertResourceInimport alertHistoryStateSource from '@/features/alerts/useAlertHistoryState.ts?raw';import alertHistoryModelSource from '@/features/alerts/alertHistoryModel.ts?raw';import alertIncidentTimelineStateSource from '@/features/alerts/useAlertIncidentTimelineState.ts?raw';+import alertOverviewActiveAlertsSectionSource from '@/features/alerts/AlertOverviewActiveAlertsSection.tsx?raw';+import alertOverviewAlertCardSource from '@/features/alerts/AlertOverviewAlertCard.tsx?raw';+import alertOverviewStatsCardsSource from '@/features/alerts/AlertOverviewStatsCards.tsx?raw';import alertOverviewStateSource from '@/features/alerts/useAlertOverviewState.ts?raw';import alertScheduleStateSource from '@/features/alerts/useAlertScheduleState.ts?raw';import alertDestinationsTabSource from '@/features/alerts/tabs/DestinationsTab.tsx?raw';@@ -328,15 +331,29 @@ describe('tab path helpers', () => {);expect(alertIncidentTimelineStateSource).toContain('AlertsAPI.getIncidentTimeline');expect(alertIncidentTimelineStateSource).toContain('AlertsAPI.addIncidentNote');+ expect(alertOverviewTabSource).toContain('AlertOverviewStatsCards');+ expect(alertOverviewTabSource).toContain('AlertOverviewActiveAlertsSection');expect(alertOverviewTabSource).toContain('useAlertOverviewState');+ expect(alertOverviewTabSource).toContain('useAlertIncidentTimelineState');expect(alertOverviewTabSource).not.toContain('AlertsAPI.bulkAcknowledge');expect(alertOverviewTabSource).not.toContain('AlertsAPI.acknowledge');expect(alertOverviewTabSource).not.toContain('AlertsAPI.unacknowledge');expect(alertOverviewStateSource).toContain('export function useAlertOverviewState');+ expect(alertOverviewStateSource).toContain('export type AlertOverviewState');expect(alertOverviewStateSource).toContain('useAlertAcknowledgementState');expect(alertOverviewStateSource).not.toContain('AlertsAPI.bulkAcknowledge');expect(alertOverviewStateSource).not.toContain('AlertsAPI.acknowledge');expect(alertOverviewStateSource).not.toContain('AlertsAPI.unacknowledge');+ expect(alertOverviewStatsCardsSource).toContain('props.state.alertStats().acknowledged');+ expect(alertOverviewStatsCardsSource).toContain('props.state.alertStats().total24h');+ expect(alertOverviewStatsCardsSource).toContain('props.state.alertStats().overrides');+ expect(alertOverviewActiveAlertsSectionSource).toContain('AlertOverviewAlertCard');+ expect(alertOverviewActiveAlertsSectionSource).toContain('getAlertListEmptyState');+ expect(alertOverviewAlertCardSource).toContain('getAlertOverviewCardPresentation');+ expect(alertOverviewAlertCardSource).toContain('getAlertOverviewAcknowledgedBadgeClass');+ expect(alertOverviewAlertCardSource).toContain('getAlertOverviewStartedAtClass');+ expect(alertOverviewAlertCardSource).toContain('getAlertOverviewPrimaryActionClass');+ expect(alertOverviewAlertCardSource).toContain('getAlertOverviewSecondaryActionClass');expect(alertAcknowledgementStateSource).toContain('export function useAlertAcknowledgementState');expect(alertAcknowledgementStateSource).toContain('AlertsAPI.bulkAcknowledge');expect(alertAcknowledgementStateSource).toContain('AlertsAPI.acknowledge');diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.tsindex d7cb08c0bb..f6edb41800 100644--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts@@ -340,6 +340,9 @@ import alertResourceIncidentsPanelSource from '@/features/alerts/AlertResourceInimport alertHistoryStateSource from '@/features/alerts/useAlertHistoryState.ts?raw';import alertHistoryModelSource from '@/features/alerts/alertHistoryModel.ts?raw';import alertIncidentTimelineStateSource from '@/features/alerts/useAlertIncidentTimelineState.ts?raw';+import alertOverviewActiveAlertsSectionSource from '@/features/alerts/AlertOverviewActiveAlertsSection.tsx?raw';+import alertOverviewAlertCardSource from '@/features/alerts/AlertOverviewAlertCard.tsx?raw';+import alertOverviewStatsCardsSource from '@/features/alerts/AlertOverviewStatsCards.tsx?raw';import alertOverviewStateSource from '@/features/alerts/useAlertOverviewState.ts?raw';import alertScheduleStateSource from '@/features/alerts/useAlertScheduleState.ts?raw';import alertDestinationsTabSource from '@/features/alerts/tabs/DestinationsTab.tsx?raw';@@ -2857,6 +2860,8 @@ describe('frontend resource type boundaries', () => {"import { HistoryTab } from '@/features/alerts/tabs/HistoryTab';",);expect(alertsPageSource).not.toContain('function HistoryTab(');+ expect(alertOverviewTabSource).toContain('AlertOverviewStatsCards');+ expect(alertOverviewTabSource).toContain('AlertOverviewActiveAlertsSection');expect(alertOverviewTabSource).toContain('useAlertIncidentTimelineState');expect(alertHistoryTabSource).toContain('useAlertHistoryState');expect(alertHistoryTabSource).toContain('AlertHistoryFrequencyCard');@@ -3727,7 +3732,6 @@ describe('frontend resource type boundaries', () => {});it('keeps alert incident timeline state copy in a shared presentation utility', () => {- expect(alertOverviewTabSource).toContain('IncidentTimelinePanel');expect(alertOverviewTabSource).toContain('useAlertIncidentTimelineState');expect(alertOverviewTabSource).toContain('useAlertOverviewState');expect(alertIncidentEventFiltersSource).toContain('getAlertIncidentEventFilterContainerClass');@@ -3757,11 +3761,12 @@ describe('frontend resource type boundaries', () => {expect(alertOverviewTabSource).not.toContain('getAlertIncidentTimelineDetailClass');expect(alertOverviewTabSource).not.toContain('getAlertIncidentTimelineCommandClass');expect(alertOverviewTabSource).not.toContain('getAlertIncidentTimelineOutputClass');- expect(alertOverviewTabSource).toContain('getAlertOverviewCardPresentation');- expect(alertOverviewTabSource).toContain('getAlertOverviewAcknowledgedBadgeClass');- expect(alertOverviewTabSource).toContain('getAlertOverviewStartedAtClass');- expect(alertOverviewTabSource).toContain('getAlertOverviewPrimaryActionClass');- expect(alertOverviewTabSource).toContain('getAlertOverviewSecondaryActionClass');+ expect(alertOverviewTabSource).not.toContain('IncidentTimelinePanel');+ expect(alertOverviewTabSource).not.toContain('getAlertOverviewCardPresentation');+ expect(alertOverviewTabSource).not.toContain('getAlertOverviewAcknowledgedBadgeClass');+ expect(alertOverviewTabSource).not.toContain('getAlertOverviewStartedAtClass');+ expect(alertOverviewTabSource).not.toContain('getAlertOverviewPrimaryActionClass');+ expect(alertOverviewTabSource).not.toContain('getAlertOverviewSecondaryActionClass');expect(alertOverviewTabSource).not.toContain('AlertsAPI.bulkAcknowledge');expect(alertOverviewTabSource).not.toContain('AlertsAPI.acknowledge');expect(alertOverviewTabSource).not.toContain('AlertsAPI.unacknowledge');@@ -3773,10 +3778,22 @@ describe('frontend resource type boundaries', () => {expect(alertOverviewTabSource).not.toContain('No incident timeline available.');expect(alertOverviewTabSource).not.toContain('Failed to load timeline.');expect(alertOverviewStateSource).toContain('export function useAlertOverviewState');+ expect(alertOverviewStateSource).toContain('export type AlertOverviewState');expect(alertOverviewStateSource).toContain('useAlertAcknowledgementState');expect(alertOverviewStateSource).not.toContain('AlertsAPI.bulkAcknowledge');expect(alertOverviewStateSource).not.toContain('AlertsAPI.acknowledge');expect(alertOverviewStateSource).not.toContain('AlertsAPI.unacknowledge');+ expect(alertOverviewStatsCardsSource).toContain('props.state.alertStats().acknowledged');+ expect(alertOverviewStatsCardsSource).toContain('props.state.alertStats().total24h');+ expect(alertOverviewStatsCardsSource).toContain('props.state.alertStats().overrides');+ expect(alertOverviewActiveAlertsSectionSource).toContain('AlertOverviewAlertCard');+ expect(alertOverviewActiveAlertsSectionSource).toContain('getAlertListEmptyState');+ expect(alertOverviewAlertCardSource).toContain('IncidentTimelinePanel');+ expect(alertOverviewAlertCardSource).toContain('getAlertOverviewCardPresentation');+ expect(alertOverviewAlertCardSource).toContain('getAlertOverviewAcknowledgedBadgeClass');+ expect(alertOverviewAlertCardSource).toContain('getAlertOverviewStartedAtClass');+ expect(alertOverviewAlertCardSource).toContain('getAlertOverviewPrimaryActionClass');+ expect(alertOverviewAlertCardSource).toContain('getAlertOverviewSecondaryActionClass');expect(alertAcknowledgementStateSource).toContain('export function useAlertAcknowledgementState');expect(alertAcknowledgementStateSource).toContain('AlertsAPI.bulkAcknowledge');expect(alertAcknowledgementStateSource).toContain('AlertsAPI.acknowledge');