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
Open one alert in Alert History from a link
rcourtmane14f61692190
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.mdindex 7ef648d2c6..48a7978c05 100644--- a/docs/release-control/v6/internal/subsystems/alerts.md+++ b/docs/release-control/v6/internal/subsystems/alerts.md@@ -1650,6 +1650,21 @@ timeline or resource view moves into the cards' drawer when the cards takeover and back to the inline expansion when the table returns(`AlertHistoryTableSection.test.tsx`, `AlertHistoryMobileList.test.tsx`).+`/alerts/history?alert=<id>` (`buildAlertHistoryAlertPath`) opens History+narrowed to one alert's occurrences, the landing a notification can link to.+`useAlertHistoryState` filters to that id before severity and search, shows+every loaded occurrence regardless of the range window, and decides once per+id, only after saved history has loaded and the live alert list is `ready`+(saved history holds resolved alerts only): if nothing matches outside "All+time" it widens to All time once, so a later range is the operator's;+`focusedAlertMissing` reports an id history no longer holds. It opens the+latest occurrence (still firing first) through the shared timeline expansion+and hands the cards a one-shot drawer request a remounted list cannot replay.+The tab names the alert in a status notice with "Show all alerts", and while+the live list is `unavailable` it says the alert may still be firing and+offers Retry instead of a verdict (`useAlertHistoryState.test.tsx`,+`HistoryTab.test.tsx`, `alertOverviewPresentation.test.ts`).+Alert history row timestamps render clock time in the viewer's own locale andmust carry the absolute date and time as a title. The date otherwise livesonly in the day group header, which scrolls out of sight, and a hardcodeddiff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 458f68f419..16109bfdee 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -8948,6 +8948,15 @@ breakpoint only as the fallback before the first measurement, because siderails and panels leave a table far less room than the screen width suggests.Alerts > History switches below an 800px card (`ALERT_HISTORY_TABLE_MIN_WIDTH`).+### A deep link narrows, then decides once++A route parameter that points a list at one record (Alert History's+`?alert=`) narrows the list to that record instead of scrolling a windowed+list to it, waits until every source that could hold the record has+answered before widening or declaring it missing, decides once per record so+later filters stay the operator's, and offers one control back to the full+list.+### Mobile destinations are links and update evidence stays explicitFixed mobile destinations and menu destinations that navigate are anchors withdiff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex d550644baf..691c8209d1 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -3715,6 +3715,15 @@ cached client and floor, so the next incident observes the new policy withoutturning alert fan-out into configuration I/O. The hosted Relay runtime testspin persistence and cache replacement together.+### Alert readiness is published with its alerts++`commitActiveAlertsTruth` sets `activeAlertsHydrationStatus` to `ready` and+applies the alert map in one `batch`, for socket snapshots, socket deltas and+REST recovery alike, so a reader that sees `ready` also sees the alerts it+vouches for. Alert History relies on this before deciding a linked alert is+not firing; the batch adds no work, it only defers effects to one flush+(`websocket-resilience.test.ts`, `websocket-unified.test.ts`).+### Mock alert timelines reuse the canonical fixture graphMock alert incidents are built once with the canonical fixture graph and readdiff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 0668621750..0c3d211e2c 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -6581,6 +6581,12 @@ recovery state and grants no storage action, and Patrol's alert-only guidancesends a physical disk to its tab unsearched, so it never filters storage orrecovery rows by a disk name they do not carry.+### Alert History links open no storage or recovery path++`buildAlertHistoryAlertPath` adds only an alert id to the History route. It+reads no storage or recovery state and grants no action; the History page+reads the same saved and live alerts it always did.+### App-shell AI navigation gating opens no recovery path`App.tsx` now passes the `assistantEnabled` session capability to the keyboarddiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex b64b70918f..d93955f1fd 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -2682,6 +2682,12 @@ the `?q=` key the thresholds page owns; callers pass a resource's displaylabel, never an id, because the thresholds search matches names(`resourceLinks.test.ts`).+`buildAlertHistoryAlertPath(alertId)` builds `/alerts/history?alert=<id>`+from `ALERT_HISTORY_QUERY_PARAMS` (`q`, `period`, `severity`, `alert`), which+now live with the other route keys instead of inside the History hook. The+`alert` key is a public address: notifications build the same link, so it+must not be renamed (`resourceLinks.test.ts`).+17. Platform table ordering is a two-layer contract. Each platform table'sdefault order is owned by its page model's status-first compare(`compareDockerContainers`, `compareKubernetesPods`, and peers), whichdiff --git a/frontend-modern/browser-verification/dcdd0209f870da7b.json b/frontend-modern/browser-verification/dcdd0209f870da7b.jsonnew file mode 100644index 0000000000..bc144434c5--- /dev/null+++ b/frontend-modern/browser-verification/dcdd0209f870da7b.json@@ -0,0 +1,45 @@+{+ "version": 1,+ "base_sha": "90fc6a0f7b3a50130731f6738ca07503bbdff714",+ "verified_at": "2026-10-15T14:58:00Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/features/alerts/AlertHistoryMobileList.tsx",+ "frontend-modern/src/features/alerts/tabs/HistoryTab.tsx",+ "frontend-modern/src/features/alerts/useAlertHistoryState.ts",+ "frontend-modern/src/routing/resourceLinks.ts",+ "frontend-modern/src/stores/websocket.ts",+ "frontend-modern/src/utils/alertOverviewPresentation.ts"+ ],+ "content_sha256": {+ "frontend-modern/src/features/alerts/AlertHistoryMobileList.tsx": "dcfdc3c011b4c18efe10b482a40babc53e1bf81ac47153acd8e05bfbd7831db7",+ "frontend-modern/src/features/alerts/tabs/HistoryTab.tsx": "6f1a1660c7fbf0c3e7a8c54099d7db881b9feac68ee888a77536856afc1306a3",+ "frontend-modern/src/features/alerts/useAlertHistoryState.ts": "d3dda1ae19d8849df0c01aadda3aa2cd9643e287965cbc7fa51b9703d2c07d9e",+ "frontend-modern/src/routing/resourceLinks.ts": "ef764fc47fd76b3ebc3fa3b50d6d0f165634cd110644b8e79583b4652761f6c0",+ "frontend-modern/src/stores/websocket.ts": "72c108000b0067b22d7ba72544a58ff9436bcb5de015a7db8c25218361c52e97",+ "frontend-modern/src/utils/alertOverviewPresentation.ts": "5fd0e62a94e054f46ef0e3d62e023221142a47138ed73f90c31307feeee98d11"+ },+ "routes": [+ "/alerts/history"+ ],+ "viewports": [+ {+ "width": 1280,+ "height": 800+ },+ {+ "width": 375,+ "height": 812+ }+ ],+ "states": [+ "Before (main): /alerts/history ignores ?alert=; a link could only open the whole history",+ "After (1280): an active alert link (id with colons, slashes and spaces) stays in the 7d range, lists one row with its timeline open and a status notice \"Showing Container Health on nginx, opened from a link.\" with Show all alerts",+ "A July alert link widens to All time once and opens its timeline; an id history no longer holds says \"That alert is no longer in Pulse's alert history.\"",+ "Show all alerts removes the filter and keeps the range; at 375px the link opens the card drawer, which stays closed after Escape"+ ],+ "interactions": [+ "Opened links for active, old resolved and unknown alert ids by full page load",+ "Clicked Show all alerts; at phone width closed the drawer with Escape"+ ]+}diff --git a/frontend-modern/src/features/alerts/AlertHistoryMobileList.tsx b/frontend-modern/src/features/alerts/AlertHistoryMobileList.tsxindex 28c0bb4f57..20506a2c75 100644--- a/frontend-modern/src/features/alerts/AlertHistoryMobileList.tsx+++ b/frontend-modern/src/features/alerts/AlertHistoryMobileList.tsx@@ -87,6 +87,20 @@ export function AlertHistoryMobileList(props: AlertHistoryMobileListProps) {}),);+ // A link that opened one alert asks for its timeline; the cards show a+ // timeline only in their drawer, so open it there while they are on show.+ createEffect(+ on(+ () => props.state.focusRequest?.(),+ (request) => {+ if (!request) return;+ props.state.takeFocusRequest();+ if (!active() || aiChatStore.isOpen) return;+ setInvestigation({ kind: 'timeline', alert: request.alert, rowKey: request.rowKey });+ },+ ),+ );+const getInvestigationReturnFocusTarget = (current: MobileAlertHistoryInvestigation,): HTMLElement | null => {diff --git a/frontend-modern/src/features/alerts/__tests__/HistoryTab.test.tsx b/frontend-modern/src/features/alerts/__tests__/HistoryTab.test.tsxindex 70fecc3fa6..75c4dc04a0 100644--- a/frontend-modern/src/features/alerts/__tests__/HistoryTab.test.tsx+++ b/frontend-modern/src/features/alerts/__tests__/HistoryTab.test.tsx@@ -1,4 +1,4 @@-import { render, screen } from '@solidjs/testing-library';+import { fireEvent, render, screen } from '@solidjs/testing-library';import { describe, expect, it, vi } from 'vitest';import { HistoryTab } from '../tabs/HistoryTab';@@ -12,6 +12,8 @@ vi.mock('@solidjs/router', () => ({vi.mock('@/contexts/appRuntime', () => ({useWebSocket: () => ({activeAlerts: {},+ activeAlertsHydrationStatus: () => 'ready',+ refreshActiveAlerts: () => Promise.resolve(true),}),}));@@ -21,11 +23,23 @@ vi.mock('@/hooks/useBreakpoint', () => ({}),}));+const focus = vi.hoisted(() => ({+ id: '',+ missing: false,+ request: null as null | { rowKey: string; alert: { title: string; resourceName: string } },+ clear: vi.fn(),+}));+vi.mock('../useAlertHistoryState', () => ({useAlertHistoryState: () => ({alertData: () => [],loading: () => false,historyLoadError: () => false,+ focusedAlertId: () => focus.id,+ focusedAlertMissing: () => focus.missing,+ focusRequest: () => focus.request,+ focusedAlert: () => focus.request?.alert ?? null,+ clearFocusedAlert: focus.clear,}),}));@@ -63,4 +77,23 @@ describe('HistoryTab', () => {// instead of thousands of pixels above the viewport.expect(screen.queryByText('resource-incidents-panel')).not.toBeInTheDocument();});++ // A notification link opens History narrowed to one alert; the notice+ // names it and offers the way back to every alert.+ it('names the linked alert and offers to show all alerts', () => {+ focus.id = 'disk-1';+ focus.request = { rowKey: 'disk-1::t', alert: { title: 'Disk usage', resourceName: 'nas-01' } };+ try {+ render(() => <HistoryTab getResource={() => undefined} allResources={() => []} />);+ expect(screen.getByRole('status')).toHaveTextContent(+ 'Showing Disk usage on nas-01, opened from a link.',+ );+ fireEvent.click(screen.getByRole('button', { name: 'Show all alerts' }));+ expect(focus.clear).toHaveBeenCalledTimes(1);+ expect(screen.queryByRole('button', { name: /retry/i })).toBeNull();+ } finally {+ focus.id = '';+ focus.request = null;+ }+ });});diff --git a/frontend-modern/src/features/alerts/__tests__/useAlertHistoryState.test.tsx b/frontend-modern/src/features/alerts/__tests__/useAlertHistoryState.test.tsxindex 6f1552b32d..36fd7a2de9 100644--- a/frontend-modern/src/features/alerts/__tests__/useAlertHistoryState.test.tsx+++ b/frontend-modern/src/features/alerts/__tests__/useAlertHistoryState.test.tsx@@ -125,6 +125,123 @@ describe('useAlertHistoryState', () => {onSwitch('replacement');};+ // Notifications link to /alerts/history?alert=<id>: History narrows to that+ // alert's occurrences and opens the latest one's timeline.+ it('narrows History to a linked alert and opens its latest occurrence', async () => {+ setMockLocation('?alert=disk-1');+ const older = { ...row('disk-1'), startTime: new Date(Date.now() - 3_600_000).toISOString() };+ const newer = row('disk-1');+ vi.mocked(AlertsAPI.getHistory).mockResolvedValueOnce([older, row('other'), newer]);+ const { result } = mount();+ await waitFor(() => expect(result.loading()).toBe(false));+ expect(result.focusedAlertId()).toBe('disk-1');+ expect(result.alertData().map(({ id }) => id)).toEqual(['disk-1', 'disk-1']);+ await waitFor(() => expect(result.focusRequest()?.alert.startTime).toBe(newer.startTime));+ expect(result.expandedIncidents().has(`disk-1::${newer.startTime}`)).toBe(true);+ expect(result.focusedAlertMissing()).toBe(false);++ result.clearFocusedAlert();+ expect(mockRouterSearch()).not.toContain('alert=');+ expect(result.alertData()).toHaveLength(3);+ });++ it('widens to all history once when the linked alert is older than the range', async () => {+ setMockLocation('?alert=old-1');+ vi.mocked(AlertsAPI.getHistory)+ .mockResolvedValueOnce([row('recent')])+ .mockResolvedValueOnce([row('recent'), row('old-1')]);+ const { result } = mount();+ await waitFor(() => expect(result.timeFilter()).toBe('all'));+ await waitFor(() => expect(result.alertData().map(({ id }) => id)).toEqual(['old-1']));+ expect(AlertsAPI.getHistory).toHaveBeenCalledTimes(2);+ expect(mockRouterSearch()).toContain('alert=old-1');+ expect(result.focusedAlertMissing()).toBe(false);+ });++ // Saved history holds resolved alerts; a linked alert still firing arrives+ // with the live list, which can land after the saved read.+ it('waits for the live alerts before widening or reporting a linked alert missing', async () => {+ setMockLocation('?alert=live-1');+ vi.mocked(AlertsAPI.getHistory).mockResolvedValue([row('recent')]);+ const [settled, setSettled] = createSignal(false);+ const [active, setActive] = createSignal<Record<string, History[number]>>({});+ const { result } = renderHook(() =>+ useAlertHistoryState({+ activeAlerts: active,+ getResource: () => undefined,+ allResources: () => [],+ activeAlertsSettled: settled,+ }),+ );+ await waitFor(() => expect(result.loading()).toBe(false));+ expect(result.timeFilter()).toBe('7d');+ expect(result.focusedAlertMissing()).toBe(false);++ setActive({ 'live-1': row('live-1') });+ setSettled(true);+ await waitFor(() => expect(result.focusRequest()?.alert.id).toBe('live-1'));+ expect(result.timeFilter()).toBe('7d');+ expect(AlertsAPI.getHistory).toHaveBeenCalledTimes(1);+ expect(result.alertData().map(({ id }) => id)).toEqual(['live-1']);+ });++ it('shows a linked alert still firing even when it started before the range', async () => {+ setMockLocation('?alert=long-1');+ vi.mocked(AlertsAPI.getHistory).mockResolvedValue([row('recent')]);+ const longRunning = {+ ...row('long-1'),+ startTime: new Date(Date.now() - 10 * 24 * 3_600_000).toISOString(),+ };+ const { result } = renderHook(() =>+ useAlertHistoryState({+ activeAlerts: () => ({ 'long-1': longRunning }),+ getResource: () => undefined,+ allResources: () => [],+ }),+ );+ await waitFor(() => expect(result.focusRequest()?.alert.id).toBe('long-1'));+ expect(result.timeFilter()).toBe('7d');+ expect(result.alertData().map(({ id }) => id)).toEqual(['long-1']);+ });++ it('leaves a later range choice to the operator', async () => {+ setMockLocation('?alert=two-days');+ const twoDays = {+ ...row('two-days'),+ startTime: new Date(Date.now() - 2 * 24 * 3_600_000).toISOString(),+ };+ vi.mocked(AlertsAPI.getHistory).mockResolvedValueOnce([twoDays]).mockResolvedValue([]);+ const { result } = mount();+ await waitFor(() => expect(result.focusRequest()?.alert.id).toBe('two-days'));+ result.setTimeFilter('24h');+ await waitFor(() => expect(AlertsAPI.getHistory).toHaveBeenCalledTimes(2));+ await waitFor(() => expect(result.loading()).toBe(false));+ expect(result.timeFilter()).toBe('24h');+ });++ it('hands the cards one drawer request and keeps the alert named for the notice', async () => {+ setMockLocation('?alert=disk-1');+ vi.mocked(AlertsAPI.getHistory).mockResolvedValueOnce([row('disk-1')]);+ const { result } = mount();+ await waitFor(() => expect(result.focusRequest()?.alert.id).toBe('disk-1'));+ expect(result.takeFocusRequest()?.alert.id).toBe('disk-1');+ expect(result.focusRequest()).toBeNull();+ expect(result.takeFocusRequest()).toBeNull();+ expect(result.focusedAlert()?.id).toBe('disk-1');+ result.clearFocusedAlert();+ await waitFor(() => expect(result.focusedAlert()).toBeNull());+ });++ it('says when history no longer holds the linked alert', async () => {+ setMockLocation('?alert=gone');+ vi.mocked(AlertsAPI.getHistory).mockResolvedValue([row('recent')]);+ const { result } = mount();+ await waitFor(() => expect(result.focusedAlertMissing()).toBe(true));+ expect(result.timeFilter()).toBe('all');+ expect(result.alertData()).toEqual([]);+ expect(result.focusRequest()).toBeNull();+ });+it('exposes initial failure and admits only one explicit current-range retry', async () => {vi.mocked(AlertsAPI.getHistory).mockRejectedValueOnce(new Error('Private provider body'));const retry = deferred<History>();diff --git a/frontend-modern/src/features/alerts/tabs/HistoryTab.tsx b/frontend-modern/src/features/alerts/tabs/HistoryTab.tsxindex 8b1e177015..a37ee43be3 100644--- a/frontend-modern/src/features/alerts/tabs/HistoryTab.tsx+++ b/frontend-modern/src/features/alerts/tabs/HistoryTab.tsx@@ -5,7 +5,11 @@ import type { Resource } from '@/types/resource';import { useWebSocket } from '@/contexts/appRuntime';import { useBreakpoint } from '@/hooks/useBreakpoint';import { Button } from '@/components/shared/Button';-import { getAlertHistoryLoadFailure } from '@/utils/alertOverviewPresentation';+import {+ getAlertHistoryFocusNotice,+ getAlertHistoryLoadFailure,+ getAlertOverviewHydrationState,+} from '@/utils/alertOverviewPresentation';import { AlertHistoryAdministrationCard } from '../AlertHistoryAdministrationCard';import { AlertHistoryFiltersCard } from '../AlertHistoryFiltersCard';@@ -20,7 +24,7 @@ export interface HistoryTabProps {export function HistoryTab(props: HistoryTabProps) {const location = useLocation();- const { activeAlerts } = useWebSocket();+ const { activeAlerts, activeAlertsHydrationStatus, refreshActiveAlerts } = useWebSocket();const { isMobile } = useBreakpoint();let hashScrollRafId: number | undefined;const [lastHashScrolled, setLastHashScrolled] = createSignal<string | null>(null);@@ -29,6 +33,9 @@ export function HistoryTab(props: HistoryTabProps) {activeAlerts: () => activeAlerts || {},getResource: props.getResource,allResources: props.allResources,+ // Only a delivered live list settles it: "unavailable" says nothing about+ // whether the linked alert is still firing.+ activeAlertsSettled: () => activeAlertsHydrationStatus() === 'ready',});const scrollToAlertHash = () => {@@ -67,6 +74,14 @@ export function HistoryTab(props: HistoryTabProps) {}});+ const focusNotice = () =>+ getAlertHistoryFocusNotice({+ alertTitle: historyState.focusedAlert()?.title,+ resourceName: historyState.focusedAlert()?.resourceName,+ missing: historyState.focusedAlertMissing(),+ liveAlertsUnavailable: activeAlertsHydrationStatus() === 'unavailable',+ });+return (<div class="space-y-4"><Show when={historyState.historyLoadError()}>@@ -93,6 +108,35 @@ export function HistoryTab(props: HistoryTabProps) {</Button></div></Show>+ <Show when={historyState.focusedAlertId()}>+ <div+ class="flex flex-col gap-3 rounded-md border border-border bg-surface-alt p-4 sm:flex-row sm:items-center sm:justify-between"+ role="status"+ data-alert-history-focus+ >+ <p class="min-w-0 text-sm text-base-content">{focusNotice().text}</p>+ <div class="flex shrink-0 flex-wrap gap-2">+ <Show when={activeAlertsHydrationStatus() === 'unavailable'}>+ <Button+ size="sm"+ variant="secondary"+ class="min-h-11 sm:min-h-0"+ onClick={() => void refreshActiveAlerts()}+ >+ {getAlertOverviewHydrationState('unavailable').retryLabel}+ </Button>+ </Show>+ <Button+ size="sm"+ variant="secondary"+ class="min-h-11 sm:min-h-0"+ onClick={historyState.clearFocusedAlert}+ >+ {focusNotice().clearLabel}+ </Button>+ </div>+ </div>+ </Show><Show when={!historyState.loading() && !historyState.historyLoadError()}><AlertHistoryFrequencyCard state={historyState} /></Show>diff --git a/frontend-modern/src/features/alerts/useAlertHistoryState.ts b/frontend-modern/src/features/alerts/useAlertHistoryState.tsindex 474f1768e5..5516b62e84 100644--- a/frontend-modern/src/features/alerts/useAlertHistoryState.ts+++ b/frontend-modern/src/features/alerts/useAlertHistoryState.ts@@ -1,4 +1,12 @@-import { batch, createEffect, createMemo, createSignal, onCleanup, onMount } from 'solid-js';+import {+ batch,+ createEffect,+ createMemo,+ createSignal,+ onCleanup,+ onMount,+ untrack,+} from 'solid-js';import type { Accessor } from 'solid-js';import { useLocation, useNavigate } from '@solidjs/router';@@ -9,6 +17,7 @@ import type { Alert } from '@/types/api';import type { Resource } from '@/types/resource';import { STORAGE_KEYS } from '@/utils/localStorage';import { logger } from '@/utils/logger';+import { ALERT_HISTORY_QUERY_PARAMS } from '@/routing/resourceLinks';import {getAlertAdministrationClearHistoryError,getAlertAdministrationClearHistoryConfirmation,@@ -38,15 +47,16 @@ export interface UseAlertHistoryStateProps {activeAlerts: Accessor<Record<string, Alert>>;getResource: (resourceId: string) => Resource | undefined;allResources: () => Resource[];+ /**+ * Whether the live alert list has arrived. Saved history holds resolved+ * alerts only, so a linked alert that is still firing is unknown until it+ * does; without this, History would widen or report it missing too early.+ */+ activeAlertsSettled?: () => boolean;}const DEFAULT_TIME_FILTER: AlertHistoryRange = '7d';const DEFAULT_SEVERITY_FILTER: AlertSeverityFilter = 'all';-const ALERT_HISTORY_QUERY_PARAMS = {- query: 'q',- period: 'period',- severity: 'severity',-} as const;const parsePeriod = (raw: string | null | undefined): AlertHistoryRange =>raw === '24h' || raw === '7d' || raw === '30d' || raw === 'all' ? raw : DEFAULT_TIME_FILTER;@@ -102,6 +112,15 @@ export function useAlertHistoryState(props: UseAlertHistoryStateProps) {});};+ // A notification links to one alert (`buildAlertHistoryAlertPath`): History+ // narrows to that alert's occurrences until the operator shows all again.+ const focusedAlertId: Accessor<string> = () =>+ new URLSearchParams(location.search).get(ALERT_HISTORY_QUERY_PARAMS.alert)?.trim() ?? '';++ const clearFocusedAlert = (): void => {+ updateSearchParam((params) => params.delete(ALERT_HISTORY_QUERY_PARAMS.alert));+ };+const [alertHistory, setAlertHistory] = createSignal<Alert[]>([]);const [loadedHistoryRange, setLoadedHistoryRange] = createSignal<AlertHistoryRange | null>(null);const [loading, setLoading] = createSignal(true);@@ -291,15 +310,92 @@ export function useAlertHistoryState(props: UseAlertHistoryStateProps) {});});+ const focusScopedItems = createMemo<HistoryItem[]>(() => {+ const focus = focusedAlertId();+ return focus ? allHistoryData().filter((item) => item.id === focus) : allHistoryData();+ });++ const historyReady = () =>+ (props.activeAlertsSettled?.() ?? true) &&+ !loading() &&+ !historyLoadError() &&+ loadedHistoryRange() === timeFilter();++ // The linked alert may be older than the range on show: widen to all of+ // history, deciding once per alert so a later range is the operator's.+ let rangeCheckedFor = '';+ createEffect(() => {+ const focus = focusedAlertId();+ if (!focus) {+ rangeCheckedFor = '';+ return;+ }+ if (!historyReady() || rangeCheckedFor === focus) return;+ rangeCheckedFor = focus;+ if (focusScopedItems().length > 0 || timeFilter() === 'all') return;+ untrack(() => setTimeFilter('all'));+ });++ const focusedAlertMissing = (): boolean =>+ focusedAlertId() !== '' &&+ historyReady() &&+ timeFilter() === 'all' &&+ focusScopedItems().length === 0;++ // Open the linked alert's latest occurrence once, preferring one still+ // active. The table shows the shared expansion inline; the cards show a+ // timeline only in their drawer, so they take a one-shot request that a+ // remounted list cannot replay after the operator closed it.+ const [focusedAlert, setFocusedAlert] = createSignal<HistoryItem | null>(null);+ const [focusRequest, setFocusRequest] = createSignal<{+ rowKey: string;+ alert: HistoryItem;+ } | null>(null);+ const takeFocusRequest = () => {+ const request = untrack(focusRequest);+ if (request) setFocusRequest(null);+ return request;+ };+ let openedFor = '';+ createEffect(() => {+ const focus = focusedAlertId();+ if (!focus) {+ openedFor = '';+ untrack(() => {+ setFocusedAlert(null);+ setFocusRequest(null);+ });+ return;+ }+ if (openedFor === focus || !historyReady()) return;+ const [latest] = [...focusScopedItems()]+ .filter((item) => item.source === 'alert')+ .sort(+ (left, right) =>+ Number(right.status === 'active') - Number(left.status === 'active') ||+ Date.parse(right.startTime) - Date.parse(left.startTime),+ );+ if (!latest) return;+ openedFor = focus;+ const rowKey = getIncidentRowKey(latest);+ untrack(() => {+ if (!expandedIncidents().has(rowKey)) {+ void toggleIncidentTimeline(rowKey, latest.id, latest.startTime);+ }+ setFocusedAlert(latest);+ setFocusRequest({ rowKey, alert: latest });+ });+ });+const severityAndSearchFilteredItems = createMemo(() => {- return filterAlertHistoryItems(allHistoryData(), severityFilter(), searchTerm());+ return filterAlertHistoryItems(focusScopedItems(), severityFilter(), searchTerm());});// Chip-count source for the severity facet: the same predicate the list// filters with, so each chip shows the row count its selection renders// (before any chart bar drill-down, which narrows further and explicitly).const countForSeverity = (value: AlertSeverityFilter): number =>- filterAlertHistoryItems(allHistoryData(), value, searchTerm()).length;+ filterAlertHistoryItems(focusScopedItems(), value, searchTerm()).length;const alertTrends = createMemo(() => {return buildAlertTrends(severityAndSearchFilteredItems(), timeFilter());@@ -308,7 +404,9 @@ export function useAlertHistoryState(props: UseAlertHistoryStateProps) {const alertData = createMemo(() => {return applyAlertHistoryWindow({filteredItems: severityAndSearchFilteredItems(),- timeFilter: timeFilter(),+ // A linked alert shows every loaded occurrence: one still firing may+ // have started before the range on show.+ timeFilter: focusedAlertId() ? 'all' : timeFilter(),selectedBarIndex: selectedBarIndex(),trends: alertTrends(),});@@ -356,6 +454,12 @@ export function useAlertHistoryState(props: UseAlertHistoryStateProps) {};return {+ focusedAlertId,+ focusedAlertMissing,+ clearFocusedAlert,+ focusRequest,+ takeFocusRequest,+ focusedAlert,STORAGE_KEYS,timeFilter,setTimeFilter,diff --git a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts b/frontend-modern/src/routing/__tests__/resourceLinks.test.tsindex 482bbc1e6a..c6abbabb38 100644--- a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts+++ b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts@@ -1,5 +1,6 @@import { describe, expect, it } from 'vitest';import {+ buildAlertHistoryAlertPath,buildPatrolAttentionPath,API_TOKEN_CREATE_ANCHOR,API_TOKEN_PRESET_QUERY_PARAM,@@ -364,3 +365,10 @@ describe('resource link routing contract', () => {expect(parsePatrolAttentionItemId('?attention=record%2Fone')).toBe('record/one');});});++describe('buildAlertHistoryAlertPath', () => {+ // The notification sender builds the same address; the parameter is a contract.+ it('opens Alert History narrowed to one alert', () => {+ expect(buildAlertHistoryAlertPath('qemu/101-cpu')).toBe('/alerts/history?alert=qemu%2F101-cpu');+ });+});diff --git a/frontend-modern/src/routing/resourceLinks.ts b/frontend-modern/src/routing/resourceLinks.tsindex 07a48b347f..e49dff407d 100644--- a/frontend-modern/src/routing/resourceLinks.ts+++ b/frontend-modern/src/routing/resourceLinks.ts@@ -67,6 +67,21 @@ export const buildAlertThresholdsPath = (? `${path}?${new URLSearchParams({ [ALERT_THRESHOLDS_QUERY_PARAMS.query]: query }).toString()}`: path;};+export const ALERT_HISTORY_PATH = '/alerts/history';+export const ALERT_HISTORY_QUERY_PARAMS = {+ query: 'q',+ period: 'period',+ severity: 'severity',+ alert: 'alert',+} as const;++/**+ * Alert History narrowed to one alert's occurrences, with its latest timeline+ * open. Notifications link here (`internal/notifications` builds the same+ * address), so the parameter name is a public contract.+ */+export const buildAlertHistoryAlertPath = (alertId: string): string =>+ `${ALERT_HISTORY_PATH}?${new URLSearchParams({ [ALERT_HISTORY_QUERY_PARAMS.alert]: alertId }).toString()}`;export const PATROL_PATH = '/patrol';export const PATROL_ATTENTION_QUERY_PARAM = 'attention';export const ACTIONS_PATH = '/actions';diff --git a/frontend-modern/src/stores/__tests__/websocket-resilience.test.ts b/frontend-modern/src/stores/__tests__/websocket-resilience.test.tsindex f76dfdd068..2489524520 100644--- a/frontend-modern/src/stores/__tests__/websocket-resilience.test.ts+++ b/frontend-modern/src/stores/__tests__/websocket-resilience.test.ts@@ -1,5 +1,5 @@import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';-import { createRoot } from 'solid-js';+import { createEffect, createRoot } from 'solid-js';// Mirrors MAX_INBOUND_WEBSOCKET_MESSAGE_BYTES in the store under test.const MAX_INBOUND_WEBSOCKET_MESSAGE_BYTES = 32 * 1024 * 1024;@@ -282,6 +282,45 @@ describe('websocket store resilience', () => {}});+ // History waits for "ready" before deciding a linked alert is not firing;+ // the status must never be observable before the alerts it vouches for.+ it('publishes ready together with the recovered alerts', async () => {+ autoOpenSockets = false;+ const recoveredAlert = {+ id: 'agent:host-3-disk',+ type: 'disk',+ level: 'warning',+ resourceId: 'agent:host-3',+ resourceName: 'host-3',+ node: 'host-3',+ instance: 'host-3',+ message: 'Disk above threshold',+ value: 91,+ threshold: 90,+ startTime: '2026-05-14T07:57:00Z',+ acknowledged: false,+ };+ apiFetchJSONMock.mockResolvedValueOnce([recoveredAlert]);+ const { store, dispose } = await createStoreHarness();+ const seen: number[] = [];+ const disposeObserver = createRoot((disposeRoot) => {+ createEffect(() => {+ if (store.activeAlertsHydrationStatus() === 'ready') {+ seen.push(Object.keys(store.activeAlerts).length);+ }+ });+ return disposeRoot;+ });+ try {+ currentInstance!.onclose?.({ code: 1006, reason: '' } as CloseEvent);+ await flushMicrotasks();+ expect(seen).toEqual([1]);+ } finally {+ disposeObserver();+ dispose();+ }+ });+it('exposes an honest unavailable state and supports an operator retry', async () => {autoOpenSockets = false;const recoveredAlert = {diff --git a/frontend-modern/src/stores/__tests__/websocket-unified.test.ts b/frontend-modern/src/stores/__tests__/websocket-unified.test.tsindex 0f9fc38ba4..ac023b68ef 100644--- a/frontend-modern/src/stores/__tests__/websocket-unified.test.ts+++ b/frontend-modern/src/stores/__tests__/websocket-unified.test.ts@@ -145,6 +145,50 @@ describe('websocket store unified resource contract', () => {}});+ // Alert History waits for "ready" before deciding a linked alert is not+ // firing, so readiness must never be observable before the snapshot's alerts.+ it('publishes alert readiness together with the socket snapshot alerts', async () => {+ const { store, dispose } = await createStoreHarness();+ const seen: number[] = [];+ const disposeObserver = createRoot((disposeRoot) => {+ createComputed(() => {+ if (store.activeAlertsHydrationStatus() === 'ready') {+ seen.push(Object.keys(store.activeAlerts).length);+ }+ });+ return disposeRoot;+ });+ try {+ await waitForOpenTick();+ emitMessage({+ type: 'rawData',+ data: {+ lastUpdate: 1,+ activeAlerts: [+ {+ id: 'agent:host-4-cpu',+ type: 'cpu',+ level: 'warning',+ resourceId: 'agent:host-4',+ resourceName: 'host-4',+ node: 'host-4',+ instance: 'host-4',+ message: 'CPU above threshold',+ value: 91,+ threshold: 90,+ startTime: '2026-05-14T07:57:00Z',+ acknowledged: false,+ },+ ],+ },+ });+ expect(seen).toEqual([1]);+ } finally {+ disposeObserver();+ dispose();+ }+ });+it('ignores retired AI Discovery progress frames without touching resources', async () => {const { store, dispose } = await createStoreHarness();const { eventBus } = await import('@/stores/events');diff --git a/frontend-modern/src/stores/websocket.ts b/frontend-modern/src/stores/websocket.tsindex 0b68e80b83..4c2f2865b7 100644--- a/frontend-modern/src/stores/websocket.ts+++ b/frontend-modern/src/stores/websocket.ts@@ -576,8 +576,11 @@ export function createWebSocketStore(url: string) {activeAlertsRevision += 1;hasActiveAlertsSnapshot = true;lastActiveAlertsPayload = alertsMap;- setActiveAlertsHydrationStatus('ready');- applyActiveAlerts(alertsEnabled ? alertsMap : {});+ // One batch: a reader that sees "ready" must also see the alerts.+ batch(() => {+ setActiveAlertsHydrationStatus('ready');+ applyActiveAlerts(alertsEnabled ? alertsMap : {});+ });};// Cold-start recovery is owned by the canonical store rather than the page.diff --git a/frontend-modern/src/utils/__tests__/alertOverviewPresentation.test.ts b/frontend-modern/src/utils/__tests__/alertOverviewPresentation.test.tsindex 5f5c6a3bad..07e9b4acbb 100644--- a/frontend-modern/src/utils/__tests__/alertOverviewPresentation.test.ts+++ b/frontend-modern/src/utils/__tests__/alertOverviewPresentation.test.ts@@ -1,6 +1,7 @@import { afterEach, beforeEach, describe, expect, it } from 'vitest';import { DEFAULT_LOCALE, setActiveLocale } from '@/i18n';import {+ getAlertHistoryFocusNotice,ALERT_BUCKET_EMPTY_LABEL,ALERT_HISTORY_ALL_TIME_FILTER_LABEL,ALERT_HISTORY_EMPTY_DESCRIPTION,@@ -430,3 +431,22 @@ describe('alertOverviewPresentation', () => {setActiveLocale(DEFAULT_LOCALE);});});++describe('getAlertHistoryFocusNotice', () => {+ it('names the linked alert and says plainly when history no longer holds it', () => {+ expect(getAlertHistoryFocusNotice({ missing: false }).text).toBe(+ 'Showing one alert, opened from a link.',+ );+ expect(+ getAlertHistoryFocusNotice({ alertTitle: 'CPU usage', resourceName: 'db-01', missing: false })+ .text,+ ).toBe('Showing CPU usage on db-01, opened from a link.');+ expect(getAlertHistoryFocusNotice({ missing: false, liveAlertsUnavailable: true }).text).toBe(+ 'Pulse could not load the alerts firing now, so this alert may still be active.',+ );+ expect(getAlertHistoryFocusNotice({ alertTitle: 'CPU usage', missing: true })).toEqual({+ text: "That alert is no longer in Pulse's alert history.",+ clearLabel: 'Show all alerts',+ });+ });+});diff --git a/frontend-modern/src/utils/alertOverviewPresentation.ts b/frontend-modern/src/utils/alertOverviewPresentation.tsindex c74b9e2ee1..9e2ecc95b4 100644--- a/frontend-modern/src/utils/alertOverviewPresentation.ts+++ b/frontend-modern/src/utils/alertOverviewPresentation.ts@@ -433,6 +433,39 @@ export function getAlertHistoryLoadFailure() {} as const;}+/**+ * The notice above History when a link narrowed it to one alert. It names the+ * alert once it is found and says plainly when history no longer holds it.+ */+export function getAlertHistoryFocusNotice(options: {+ alertTitle?: string;+ resourceName?: string;+ missing: boolean;+ liveAlertsUnavailable?: boolean;+}) {+ const clearLabel = 'Show all alerts';+ // Saved history holds resolved alerts only; without the live list Pulse+ // cannot tell whether the linked alert is still firing.+ if (options.liveAlertsUnavailable) {+ return {+ text: 'Pulse could not load the alerts firing now, so this alert may still be active.',+ clearLabel,+ } as const;+ }+ if (options.missing) {+ return { text: "That alert is no longer in Pulse's alert history.", clearLabel } as const;+ }+ const subject = [options.alertTitle, options.resourceName && `on ${options.resourceName}`]+ .filter(Boolean)+ .join(' ');+ return {+ text: subject+ ? `Showing ${subject}, opened from a link.`+ : 'Showing one alert, opened from a link.',+ clearLabel,+ } as const;+}+export function getAlertBucketCountLabel(count: number) {return count === 0 ? ALERT_BUCKET_EMPTY_LABEL : `${count} alert${count === 1 ? '' : 's'}`;}