Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Fix mobile alert timeline scroll stability

Pulse Test8a7c88d086a5
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index c0a429f33a..93188e7c08 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -583,16 +583,25 @@ links to the retired top-level routes, and the supporting
`buildResolvedResourceSurfaceLinks` helper was deleted from
`frontend-modern/src/routing/resourceLinks.ts` as part of the same pass.
-That panel renders inline under the history row that opened it, in both the
-desktop table (`AlertHistoryTableAlertRow.tsx`) and the phone card list
-(`AlertHistoryMobileList.tsx`). It must not go back to being a page-level
-sibling in `tabs/HistoryTab.tsx`: the alert history is a long scroller, so a
-page-level panel opened thousands of pixels above a reader scrolled into the
-list and the row-level button read as inert (#1687). Because several alerts
-can share one resource, `resourceIncidentPanel` carries the originating
-`rowKey` and each row renders the panel only when that key matches, which also
-keeps exactly one panel open at a time. Re-triggering the same row closes it,
-matching the neighbouring Timeline toggle.
+On desktop that panel renders inline under the history table row that opened
+it (`AlertHistoryTableAlertRow.tsx`). On phone layouts, Resource and Timeline
+investigations render through
+`MobileAlertHistoryInvestigationDialog.tsx` as one full-height, independently
+scrollable investigation drawer. They must not expand inside
+`AlertHistoryMobileList.tsx`: the history is a fixed-estimate virtualized list,
+so changing one mounted card to incident-timeline height invalidates its spacer
+math and makes the app scroll shell jump or pull the operator back up the page.
+The mobile drawer keeps that list height and scroll position stable, contains
+overscroll within the evidence surface, supports Escape and explicit close,
+and returns focus to the originating action or the history list fallback.
+It must not become a page-level sibling in `tabs/HistoryTab.tsx`, which would
+again open away from a reader deep in history (#1687). Because several alerts
+can share one resource, `resourceIncidentPanel` still carries the originating
+`rowKey`, and the mobile investigation state allows exactly one Timeline or
+Resource surface at a time. Resource incident expansion and filtering remain
+reactive accessors inside each keyed incident row; snapshotting the expanded
+set or filter set would let state update while the visible Events timeline
+stays closed or stale.
The alert history filter bar carries no saved-views affordance.
`AlertHistoryFiltersCard.tsx` must not pass a `savedViewsKey` to the shared
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 5f38c13c73..f846888eb0 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -951,6 +951,16 @@ warnings remain visible before expansion. The responsive route must preserve
named tabs, keyboard focus, dialog focus containment, and phone-width overflow
checks; journey 83 is the desktop/browser accessibility proof and is not
mobile-device proof.
+The shared `Dialog` runtime in `useDialogState.ts` owns focus containment,
+body-scroll locking, and focus restoration for every modal and drawer. Closing
+an overlay must restore its previous trigger with `preventScroll`; a plain
+`focus()` may make the app scroll shell jump to a virtualized or previously
+off-screen trigger just as the operator dismisses the overlay. Escape belongs
+to the top dialog and must stop the same keydown from reaching later global or
+shell listeners before it closes. Feature-owned
+dialogs may provide a stable fallback target when their original virtual row
+has unmounted, but they must use the same scroll-neutral focus contract rather
+than compensating with page-level scroll writes.
Assistant shell entry changes must keep Assistant contextual rather than
generic: `AppLayout.tsx` and the command palette may expose a compact launcher,
@@ -4686,6 +4696,20 @@ not overlap or create horizontal overflow. The 390px operator qualification
must assert three visible labels, non-overlapping client rectangles, keyboard
reachability, and a contained document before its actual-pixels receipt is
recorded.
+Alert History investigation detail is also responsive by interaction model,
+not only by CSS. Desktop may keep Timeline and Resource incident detail inline
+with its table row, while the virtualized phone card list must open the shared
+detail components inside the feature-owned full-height `Dialog` drawer in
+`frontend-modern/src/features/alerts/MobileAlertHistoryInvestigationDialog.tsx`.
+The drawer owns a bounded `overflow-y-auto` and `overscroll-contain` evidence
+scrollport, while the app scroll shell and the fixed-estimate history window
+remain unchanged underneath it. Escape and the explicit close action dismiss
+the drawer and restore focus to the originating row action when that
+virtualized row still exists, falling back to the phone history list when it
+does not. Future expandable content inside a fixed-estimate list must use the
+same independent-detail boundary or move to a variable-height virtualizer; it
+must not change a mounted virtual row's height and compensate with ad hoc page
+scroll writes.
Because that popover combines view application, default selection, removal,
and an inline naming form, it is a labelled non-modal dialog rather than an
ARIA menu. Its trigger exposes the dialog relationship, Escape returns focus
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.json
index 8526a9d003..78dd21ad5a 100644
--- a/frontend-modern/browser-verification.json
+++ b/frontend-modern/browser-verification.json
@@ -1,29 +1,41 @@
{
"version": 1,
- "base_sha": "cb27b8eb248a863502e39dbb4c6eebbdfc41c3c0",
- "verified_at": "2026-08-28T00:22:52Z",
+ "base_sha": "bf1b81700bc08a53cc36afcf4049e16e71d8b37c",
+ "verified_at": "2026-08-28T08:08:14Z",
"result": "passed",
"changed_paths": [
- "frontend-modern/src/utils/alertOverviewPresentation.ts"
+ "frontend-modern/src/components/shared/useDialogState.ts",
+ "frontend-modern/src/features/alerts/AlertHistoryItemActions.tsx",
+ "frontend-modern/src/features/alerts/AlertHistoryMobileList.tsx",
+ "frontend-modern/src/features/alerts/AlertResourceIncidentsPanel.tsx",
+ "frontend-modern/src/features/alerts/MobileAlertHistoryInvestigationDialog.tsx"
],
"content_sha256": {
- "frontend-modern/src/utils/alertOverviewPresentation.ts": "b3fb07bdffbd444b7bdddb2103e30106bbf7337c76960aeb8cffd33fd67d0f8c"
+ "frontend-modern/src/components/shared/useDialogState.ts": "cf9fd26fe5fe4697351e8cb523b736c955b9d11ff5b7c6256355ab85051a2bd9",
+ "frontend-modern/src/features/alerts/AlertHistoryItemActions.tsx": "794c1bae95735fc6bda600932d9429f1b9964f8168154d95f831967b797a5084",
+ "frontend-modern/src/features/alerts/AlertHistoryMobileList.tsx": "7187798541822ae85897dfa03c2bfc9fdb0bc3c83ad8d97d347cef612baa5bda",
+ "frontend-modern/src/features/alerts/AlertResourceIncidentsPanel.tsx": "38225bfcf8f80a0f1fdb46edf96fcc706f45517c9a540964fef12c7a1ab577ea",
+ "frontend-modern/src/features/alerts/MobileAlertHistoryInvestigationDialog.tsx": "b9eaeb9e7bf30334c25ddccf9f8bc4d465dc138fe65d61270c575de79dbe9ce5"
},
- "routes": ["/alerts/overview", "/alerts/history"],
+ "routes": ["/alerts/history"],
"viewports": [
- { "width": 1280, "height": 720 },
+ { "width": 1440, "height": 900 },
{ "width": 390, "height": 844 }
],
"states": [
- "active critical and warning alert cards retain distinct red and warning-yellow presentations",
- "informational history alerts use the first-class blue severity badge and filter",
- "Alerts Overview and filtered Alert History remain fluid at the 390px layout contract",
- "unknown severity values fail safe to the warning palette under targeted regression coverage"
+ "desktop Alert History default table and contextual inline resource panel",
+ "narrow Alert History default and search-filtered virtualized card lists",
+ "narrow full-height Resource incidents drawer with empty, single-incident, and multiple-incident results",
+ "narrow resource event timeline collapsed and expanded with reactive event cards",
+ "narrow direct Incident timeline drawer with loaded incident, event filters, note field, and disabled save action",
+ "closed investigation with the history scroll position retained underneath"
],
"interactions": [
- "inspected computed card and badge presentation for a live warning alert and confirmed the warning-yellow palette",
- "navigated from Alerts Overview to Alert History and confirmed informational badges render with the blue palette",
- "expanded narrow History filters, selected Info, and confirmed the 16-result informational projection",
- "confirmed both narrow routes have a 390px document width with no horizontal overflow"
+ "opened Resource investigation from cards near the top and deep inside virtualized mobile history",
+ "expanded resource Events timelines and scrolled the drawer evidence while confirming the background app scroll position stayed fixed",
+ "changed resource event disclosure state and confirmed event cards appeared without changing the virtualized history row height",
+ "opened the direct Incident timeline and dismissed mobile investigations through the explicit close action and Escape",
+ "confirmed explicit dismissal returns focus to the originating Resource or Timeline action without scrolling it into view",
+ "opened and closed the existing desktop inline Resource investigation and inspected the desktop table pixels"
]
}
diff --git a/frontend-modern/src/components/shared/__tests__/Dialog.test.tsx b/frontend-modern/src/components/shared/__tests__/Dialog.test.tsx
index 1b5f0f60cd..6bd47aedb1 100644
--- a/frontend-modern/src/components/shared/__tests__/Dialog.test.tsx
+++ b/frontend-modern/src/components/shared/__tests__/Dialog.test.tsx
@@ -1,5 +1,6 @@
import { afterEach, describe, expect, it, vi } from 'vitest';
import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
import { Dialog } from '@/components/shared/Dialog';
import { dialogStackHasBlockingDialog } from '@/components/shared/useDialogState';
import dialogSource from '@/components/shared/Dialog.tsx?raw';
@@ -66,10 +67,14 @@ describe('Dialog', () => {
<div class="p-4">Body</div>
</Dialog>
));
+ const laterDocumentHandler = vi.fn();
+ document.addEventListener('keydown', laterDocumentHandler);
expect(document.body.style.overflow).toBe('hidden');
fireEvent.keyDown(document, { key: 'Escape' });
expect(onClose).toHaveBeenCalledTimes(1);
+ expect(laterDocumentHandler).not.toHaveBeenCalled();
+ document.removeEventListener('keydown', laterDocumentHandler);
unmount();
expect(document.body.style.overflow).toBe('');
});
@@ -124,4 +129,29 @@ describe('Dialog', () => {
await Promise.resolve();
expect(screen.getByRole('textbox', { name: 'Outcome' })).toHaveFocus();
});
+
+ it('restores trigger focus without moving the background scroll position', async () => {
+ const [isOpen, setIsOpen] = createSignal(false);
+ render(() => (
+ <>
+ <button type="button" onClick={() => setIsOpen(true)}>
+ Open investigation
+ </button>
+ <Dialog isOpen={isOpen()} onClose={() => setIsOpen(false)}>
+ <button type="button" onClick={() => setIsOpen(false)}>
+ Close investigation
+ </button>
+ </Dialog>
+ </>
+ ));
+
+ const trigger = screen.getByRole('button', { name: 'Open investigation' });
+ trigger.focus();
+ const focusSpy = vi.spyOn(trigger, 'focus');
+ await fireEvent.click(trigger);
+ await fireEvent.click(screen.getByRole('button', { name: 'Close investigation' }));
+
+ expect(focusSpy).toHaveBeenCalledWith({ preventScroll: true });
+ expect(trigger).toHaveFocus();
+ });
});
diff --git a/frontend-modern/src/components/shared/useDialogState.ts b/frontend-modern/src/components/shared/useDialogState.ts
index bb28773547..70001da148 100644
--- a/frontend-modern/src/components/shared/useDialogState.ts
+++ b/frontend-modern/src/components/shared/useDialogState.ts
@@ -69,6 +69,7 @@ export function useDialogState(options: DialogStateOptions): {
if (!panelRef) return;
if (event.key === 'Escape') {
event.preventDefault();
+ event.stopImmediatePropagation();
options.onClose();
return;
}
@@ -105,7 +106,7 @@ export function useDialogState(options: DialogStateOptions): {
document.removeEventListener('keydown', onKeyDown);
unlockBodyScroll();
if (previousFocus && document.contains(previousFocus)) {
- previousFocus.focus();
+ previousFocus.focus({ preventScroll: true });
}
});
});
diff --git a/frontend-modern/src/features/alerts/AlertHistoryItemActions.tsx b/frontend-modern/src/features/alerts/AlertHistoryItemActions.tsx
index a49623eac2..5a6ba06b8f 100644
--- a/frontend-modern/src/features/alerts/AlertHistoryItemActions.tsx
+++ b/frontend-modern/src/features/alerts/AlertHistoryItemActions.tsx
@@ -12,6 +12,8 @@ interface AlertHistoryItemActionsProps {
state: AlertHistoryState;
class?: string;
touchSized?: boolean;
+ onTimelineClick?: () => void;
+ onResourceClick?: () => void;
}
export function AlertHistoryItemActions(props: AlertHistoryItemActionsProps) {
@@ -25,7 +27,12 @@ export function AlertHistoryItemActions(props: AlertHistoryItemActionsProps) {
class={`rounded-md border border-border px-2 py-1 text-[10px] text-muted hover:bg-surface-hover ${
props.touchSized ? 'min-h-11' : ''
}`}
+ data-alert-history-action="timeline"
onClick={() => {
+ if (props.onTimelineClick) {
+ props.onTimelineClick();
+ return;
+ }
void props.state.toggleIncidentTimeline(
rowKey(),
props.alert.id,
@@ -42,8 +49,13 @@ export function AlertHistoryItemActions(props: AlertHistoryItemActionsProps) {
class={`rounded-md border border-border px-2 py-1 text-[10px] text-muted hover:bg-surface-hover ${
props.touchSized ? 'min-h-11' : ''
}`}
+ data-alert-history-action="resource"
title={getAlertResourceIncidentViewTitle()}
onClick={() => {
+ if (props.onResourceClick) {
+ props.onResourceClick();
+ return;
+ }
void props.state.openResourceIncidentPanel(
props.alert.resourceId as string,
props.alert.resourceName,
diff --git a/frontend-modern/src/features/alerts/AlertHistoryMobileList.tsx b/frontend-modern/src/features/alerts/AlertHistoryMobileList.tsx
index 3bccbf1295..3d1c856808 100644
--- a/frontend-modern/src/features/alerts/AlertHistoryMobileList.tsx
+++ b/frontend-modern/src/features/alerts/AlertHistoryMobileList.tsx
@@ -1,6 +1,5 @@
-import { Show, createMemo } from 'solid-js';
+import { Show, createMemo, createSignal } from 'solid-js';
-import { IncidentTimelinePanel } from '@/components/Alerts/IncidentTimelinePanel';
import { getAlertHistoryResourceTypeBadgeClass } from '@/utils/alertHistoryPresentation';
import {
getAlertHistoryStatusPresentation,
@@ -8,9 +7,12 @@ import {
} from '@/utils/alertIncidentPresentation';
import { AlertHistoryItemActions } from './AlertHistoryItemActions';
-import { AlertResourceIncidentsPanel } from './AlertResourceIncidentsPanel';
import { PlatformWindowedList } from '@/features/platformPage/PlatformWindowedList';
import { getGroupSummaryLabel } from './AlertHistoryTableGroupRow';
+import {
+ MobileAlertHistoryInvestigationDialog,
+ type MobileAlertHistoryInvestigation,
+} from './MobileAlertHistoryInvestigationDialog';
import type { AlertHistoryState } from './useAlertHistoryState';
interface AlertHistoryMobileListProps {
@@ -24,6 +26,10 @@ type AlertHistoryMobileItem =
| { kind: 'alert'; key: string; alert: AlertHistoryAlert };
export function AlertHistoryMobileList(props: AlertHistoryMobileListProps) {
+ const [investigation, setInvestigation] = createSignal<MobileAlertHistoryInvestigation | null>(
+ null,
+ );
+
const mobileItems = createMemo<AlertHistoryMobileItem[]>(() => {
const items: AlertHistoryMobileItem[] = [];
for (const [groupIndex, group] of props.state.groupedAlerts().entries()) {
@@ -35,127 +41,205 @@ export function AlertHistoryMobileList(props: AlertHistoryMobileListProps) {
return items;
});
+ const getInvestigationReturnFocusTarget = (
+ current: MobileAlertHistoryInvestigation,
+ ): HTMLElement | null => {
+ const card = Array.from(
+ document.querySelectorAll<HTMLElement>('[data-alert-history-row-key]'),
+ ).find((candidate) => candidate.dataset.alertHistoryRowKey === current.rowKey);
+ const action = card?.querySelector<HTMLElement>(
+ `[data-alert-history-action="${current.kind}"]`,
+ );
+ const list = document.querySelector<HTMLElement>('[data-testid="alert-history-mobile-list"]');
+ return action ?? list;
+ };
+
+ const closeInvestigation = () => {
+ const current = investigation();
+ if (!current) return;
+ const currentFocusTarget = getInvestigationReturnFocusTarget(current);
+ setInvestigation(null);
+ currentFocusTarget?.focus({ preventScroll: true });
+
+ requestAnimationFrame(() => {
+ requestAnimationFrame(() => {
+ getInvestigationReturnFocusTarget(current)?.focus({ preventScroll: true });
+ });
+ });
+
+ if (current.kind === 'timeline') {
+ if (props.state.expandedIncidents().has(current.rowKey)) {
+ void props.state.toggleIncidentTimeline(
+ current.rowKey,
+ current.alert.id,
+ current.alert.startTime,
+ );
+ }
+ return;
+ }
+
+ if (props.state.resourceIncidentPanel()?.rowKey === current.rowKey) {
+ props.state.setResourceIncidentPanel(null);
+ }
+ };
+
+ const closePreviousInvestigationState = () => {
+ const current = investigation();
+ if (!current) return;
+
+ if (current.kind === 'timeline' && props.state.expandedIncidents().has(current.rowKey)) {
+ void props.state.toggleIncidentTimeline(
+ current.rowKey,
+ current.alert.id,
+ current.alert.startTime,
+ );
+ }
+ if (
+ current.kind === 'resource' &&
+ props.state.resourceIncidentPanel()?.rowKey === current.rowKey
+ ) {
+ props.state.setResourceIncidentPanel(null);
+ }
+ };
+
+ const openTimelineInvestigation = (alert: AlertHistoryAlert, rowKey: string) => {
+ const current = investigation();
+ if (current?.kind === 'timeline' && current.rowKey === rowKey) {
+ closeInvestigation();
+ return;
+ }
+
+ closePreviousInvestigationState();
+ setInvestigation({ kind: 'timeline', alert, rowKey });
+ if (!props.state.expandedIncidents().has(rowKey)) {
+ void props.state.toggleIncidentTimeline(rowKey, alert.id, alert.startTime);
+ }
+ };
+
+ const openResourceInvestigation = (alert: AlertHistoryAlert, rowKey: string) => {
+ const current = investigation();
+ if (current?.kind === 'resource' && current.rowKey === rowKey) {
+ closeInvestigation();
+ return;
+ }
+
+ closePreviousInvestigationState();
+ setInvestigation({ kind: 'resource', alert, rowKey });
+ void props.state.openResourceIncidentPanel(
+ alert.resourceId as string,
+ alert.resourceName,
+ rowKey,
+ );
+ };
+
return (
- <div class="space-y-3 md:hidden" data-testid="alert-history-mobile-list">
- <PlatformWindowedList
- items={mobileItems}
- estimatedItemHeight={260}
- enableThreshold={18}
- windowSize={24}
- >
- {(item) => {
- if (item.kind === 'group') {
- return (
- <header class="flex items-start justify-between gap-3 rounded-lg border border-border bg-surface-alt px-3 py-2">
- <h3
- class="min-w-0 truncate text-xs font-semibold text-base-content"
- title={item.group.fullLabel}
- >
- {item.group.label}
- </h3>
- <span class="shrink-0 text-[10px] text-muted">
- {getGroupSummaryLabel(item.group)}
- </span>
- </header>
- );
- }
-
- const alert = item.alert;
- const rowKey = () => props.state.getIncidentRowKey(alert);
- const status = () => getAlertHistoryStatusPresentation(alert.status);
-
- return (
- <article
- class={`overflow-hidden rounded-lg border border-border bg-surface p-3 ${status().rowClassName}`}
- >
- <div class="flex items-start justify-between gap-3">
- <div class="min-w-0">
- <h4
- class="truncate text-sm font-semibold text-base-content"
- title={alert.resourceName}
- >
- {alert.resourceName}
- </h4>
- <span
- class={`${getAlertHistoryResourceTypeBadgeClass(alert.resourceType)} mt-1 inline-flex`}
- title={alert.resourceType}
+ <>
+ <div class="space-y-3 md:hidden" data-testid="alert-history-mobile-list" tabindex="-1">
+ <PlatformWindowedList
+ items={mobileItems}
+ estimatedItemHeight={260}
+ enableThreshold={18}
+ windowSize={24}
+ >
+ {(item) => {
+ if (item.kind === 'group') {
+ return (
+ <header class="flex items-start justify-between gap-3 rounded-lg border border-border bg-surface-alt px-3 py-2">
+ <h3
+ class="min-w-0 truncate text-xs font-semibold text-base-content"
+ title={item.group.fullLabel}
>
- {alert.title}
+ {item.group.label}
+ </h3>
+ <span class="shrink-0 text-[10px] text-muted">
+ {getGroupSummaryLabel(item.group)}
</span>
- </div>
- <div class="flex shrink-0 flex-col items-end gap-1">
- <span class={getAlertIncidentLevelBadgeClass(alert.severity)}>
- {alert.severity}
- </span>
- <span class={status().className}>{status().label}</span>
- </div>
- </div>
+ </header>
+ );
+ }
- <p class="mt-2 text-xs leading-relaxed text-base-content">{alert.description}</p>
+ const alert = item.alert;
+ const rowKey = () => props.state.getIncidentRowKey(alert);
+ const status = () => getAlertHistoryStatusPresentation(alert.status);
- <dl class="mt-3 grid grid-cols-3 gap-2 text-[10px] text-muted">
- <div>
- <dt class="uppercase tracking-wide">Time</dt>
- <dd
- class="mt-0.5 font-mono text-base-content"
- title={props.state.formatAlertRowTimestamp(alert.startTime)}
- >
- {props.state.formatAlertRowTime(alert.startTime)}
- </dd>
- </div>
- <div>
- <dt class="uppercase tracking-wide">Duration</dt>
- <dd class="mt-0.5 text-base-content">{alert.duration}</dd>
- </div>
- <div class="min-w-0">
- <dt class="uppercase tracking-wide">Node</dt>
- <dd
- class="mt-0.5 truncate text-base-content"
- title={alert.nodeDisplayName || alert.node || ''}
- >
- {alert.nodeDisplayName || alert.node || '—'}
- </dd>
+ return (
+ <article
+ class={`overflow-hidden rounded-lg border border-border bg-surface p-3 ${status().rowClassName}`}
+ data-alert-history-row-key={rowKey()}
+ >
+ <div class="flex items-start justify-between gap-3">
+ <div class="min-w-0">
+ <h4
+ class="truncate text-sm font-semibold text-base-content"
+ title={alert.resourceName}
+ >
+ {alert.resourceName}
+ </h4>
+ <span
+ class={`${getAlertHistoryResourceTypeBadgeClass(alert.resourceType)} mt-1 inline-flex`}
+ title={alert.resourceType}
+ >
+ {alert.title}
+ </span>
+ </div>
+ <div class="flex shrink-0 flex-col items-end gap-1">
+ <span class={getAlertIncidentLevelBadgeClass(alert.severity)}>
+ {alert.severity}
+ </span>
+ <span class={status().className}>{status().label}</span>
+ </div>
</div>
- </dl>
- <AlertHistoryItemActions alert={alert} state={props.state} class="mt-3" touchSized />
+ <p class="mt-2 text-xs leading-relaxed text-base-content">{alert.description}</p>
- <Show
- when={alert.source === 'alert' && props.state.expandedIncidents().has(rowKey())}
- >
- <div class="mt-3 border-t border-border pt-3">
- <IncidentTimelinePanel
- loading={() => props.state.incidentLoading()[rowKey()]}
- error={() => props.state.incidentErrors()[rowKey()]}
- timeline={() => props.state.incidentTimelines()[rowKey()]}
- filters={props.state.historyIncidentEventFilters}
- setFilters={props.state.setHistoryIncidentEventFilters}
- filterVariant="compact"
- eventCardVariant="surface"
- noteDraft={() => props.state.incidentNoteDrafts()[rowKey()] || ''}
- onNoteDraftChange={(value) => props.state.setIncidentNoteDraft(rowKey(), value)}
- noteSaving={() => props.state.incidentNoteSaving().has(rowKey())}
- onSaveNote={() => {
- void props.state.saveIncidentNote(rowKey(), alert.id, alert.startTime);
- }}
- onRetry={() => {
- void props.state.loadIncidentTimeline(rowKey(), alert.id, alert.startTime);
- }}
- />
- </div>
- </Show>
+ <dl class="mt-3 grid grid-cols-3 gap-2 text-[10px] text-muted">
+ <div>
+ <dt class="uppercase tracking-wide">Time</dt>
+ <dd
+ class="mt-0.5 font-mono text-base-content"
+ title={props.state.formatAlertRowTimestamp(alert.startTime)}
+ >
+ {props.state.formatAlertRowTime(alert.startTime)}
+ </dd>
+ </div>
+ <div>
+ <dt class="uppercase tracking-wide">Duration</dt>
+ <dd class="mt-0.5 text-base-content">{alert.duration}</dd>
+ </div>
+ <div class="min-w-0">
+ <dt class="uppercase tracking-wide">Node</dt>
+ <dd
+ class="mt-0.5 truncate text-base-content"
+ title={alert.nodeDisplayName || alert.node || ''}
+ >
+ {alert.nodeDisplayName || alert.node || '—'}
+ </dd>
+ </div>
+ </dl>
- {/* Same reasoning as the desktop row: the panel belongs
- under the card that asked for it, not at page level. */}
- <Show when={props.state.resourceIncidentPanel()?.rowKey === rowKey()}>
- <div class="mt-3 border-t border-border pt-3">
- <AlertResourceIncidentsPanel state={props.state} />
- </div>
- </Show>
- </article>
- );
- }}
- </PlatformWindowedList>
- </div>
+ <AlertHistoryItemActions
+ alert={alert}
+ state={props.state}
+ class="mt-3"
+ touchSized
+ onTimelineClick={() => openTimelineInvestigation(alert, rowKey())}
+ onResourceClick={() => openResourceInvestigation(alert, rowKey())}
+ />
+ </article>
+ );
+ }}
+ </PlatformWindowedList>
+ </div>
+
+ <Show when={investigation()}>
+ {(selectedInvestigation) => (
+ <MobileAlertHistoryInvestigationDialog
+ investigation={selectedInvestigation()}
+ state={props.state}
+ onClose={closeInvestigation}
+ />
+ )}
+ </Show>
+ </>
);
}
diff --git a/frontend-modern/src/features/alerts/AlertResourceIncidentsPanel.tsx b/frontend-modern/src/features/alerts/AlertResourceIncidentsPanel.tsx
index b8cdc10ccf..36976e79bc 100644
--- a/frontend-modern/src/features/alerts/AlertResourceIncidentsPanel.tsx
+++ b/frontend-modern/src/features/alerts/AlertResourceIncidentsPanel.tsx
@@ -1,4 +1,4 @@
-import { For, Show } from 'solid-js';
+import { For, Show, createMemo } from 'solid-js';
import { IncidentEventFilters } from '@/components/Alerts/IncidentEventFilters';
import { IncidentAssistantHandoffButton } from '@/components/Alerts/IncidentAssistantHandoffButton';
@@ -34,6 +34,8 @@ import type { AlertHistoryState } from './useAlertHistoryState';
interface AlertResourceIncidentsPanelProps {
state: AlertHistoryState;
getResource?: (resourceId: string) => Resource | undefined;
+ onClose?: () => void;
+ showCloseAction?: boolean;
}
export function AlertResourceIncidentsPanel(props: AlertResourceIncidentsPanelProps) {
@@ -78,13 +80,17 @@ export function AlertResourceIncidentsPanel(props: AlertResourceIncidentsPanelPr
>
{getAlertResourceIncidentRefreshLabel(isLoading())}
</button>
- <button
- type="button"
- class="px-2 py-1 text-xs border rounded-md border-border text-muted hover:bg-surface-hover"
- onClick={() => props.state.setResourceIncidentPanel(null)}
- >
- Close
- </button>
+ <Show when={props.showCloseAction ?? true}>
+ <button
+ type="button"
+ class="px-2 py-1 text-xs border rounded-md border-border text-muted hover:bg-surface-hover"
+ onClick={() =>
+ props.onClose ? props.onClose() : props.state.setResourceIncidentPanel(null)
+ }
+ >
+ Close
+ </button>
+ </Show>
</div>
</div>
<Show when={isLoading()}>
@@ -114,24 +120,27 @@ export function AlertResourceIncidentsPanel(props: AlertResourceIncidentsPanelPr
incident.status,
incident.acknowledged,
);
- const isExpanded = props.state.expandedResourceIncidentIds().has(incident.id);
const events = incident.events || [];
- const filteredEvents = filterIncidentEvents(
- events,
- props.state.resourceIncidentEventFilters(),
+ const isExpanded = () =>
+ props.state.expandedResourceIncidentIds().has(incident.id);
+ const filteredEvents = createMemo(() =>
+ filterIncidentEvents(events, props.state.resourceIncidentEventFilters()),
+ );
+ const eventSummary = createMemo(() =>
+ summarizeIncidentEvents(filteredEvents()),
+ );
+ const recentEvents = createMemo(() =>
+ filteredEvents().length > 6
+ ? filteredEvents().slice(filteredEvents().length - 6)
+ : filteredEvents(),
);
- const eventSummary = summarizeIncidentEvents(filteredEvents);
- const recentEvents =
- filteredEvents.length > 6
- ? filteredEvents.slice(filteredEvents.length - 6)
- : filteredEvents;
- const lastEvent =
- filteredEvents.length > 0
- ? filteredEvents[filteredEvents.length - 1]
+ const lastEvent = () =>
+ filteredEvents().length > 0
+ ? filteredEvents()[filteredEvents().length - 1]
: undefined;
- const filteredLabel =
- filteredEvents.length !== events.length
- ? `${filteredEvents.length}/${events.length}`
+ const filteredLabel = () =>
+ filteredEvents().length !== events.length
+ ? `${filteredEvents().length}/${events.length}`
: `${events.length}`;
return (
@@ -167,7 +176,7 @@ export function AlertResourceIncidentsPanel(props: AlertResourceIncidentsPanelPr
<Show when={events.length > 0}>
<div class={getAlertResourceIncidentSummaryRowClass()}>
<Show
- when={filteredEvents.length > 0}
+ when={filteredEvents().length > 0}
fallback={
<span>
{getAlertResourceIncidentFilteredEventsEmptyState().text}
@@ -178,7 +187,7 @@ export function AlertResourceIncidentsPanel(props: AlertResourceIncidentsPanelPr
<span class="text-[10px] font-medium uppercase tracking-wide text-muted">
Activity
</span>
- <For each={eventSummary}>
+ <For each={eventSummary()}>
{(summary) => (
<span class={getAlertResourceIncidentActivityChipClass()}>
{summary.label} {summary.count}
@@ -186,12 +195,12 @@ export function AlertResourceIncidentsPanel(props: AlertResourceIncidentsPanelPr
)}
</For>
<span>
- {filteredEvents.length !== events.length
- ? `${filteredEvents.length}/${events.length} events`
+ {filteredEvents().length !== events.length
+ ? `${filteredEvents().length}/${events.length} events`
: `${events.length} event${events.length === 1 ? '' : 's'}`}
</span>
- <Show when={lastEvent}>
- <span>Latest: {lastEvent?.summary}</span>
+ <Show when={lastEvent()}>
+ <span>Latest: {lastEvent()?.summary}</span>
</Show>
</div>
</Show>
@@ -202,30 +211,30 @@ export function AlertResourceIncidentsPanel(props: AlertResourceIncidentsPanelPr
props.state.toggleResourceIncidentDetails(incident.id)
}
>
- {getAlertResourceIncidentToggleLabel(isExpanded, filteredLabel)}
+ {getAlertResourceIncidentToggleLabel(isExpanded(), filteredLabel())}
</button>
</div>
</Show>
- <Show when={isExpanded}>
+ <Show when={isExpanded()}>
<div class="mt-2 space-y-2">
<Show
- when={filteredEvents.length > 0}
+ when={filteredEvents().length > 0}
fallback={
<p class="text-[10px] text-muted">
{getAlertResourceIncidentFilteredEventsEmptyState().text}
</p>
}
>
- <For each={recentEvents}>
+ <For each={recentEvents()}>
{(event) => (
<IncidentTimelineEventCard event={event} variant="alt" />
)}
</For>
- <Show when={filteredEvents.length > 0}>
+ <Show when={filteredEvents().length > 0}>
<p class="text-[10px] text-muted">
{getAlertResourceIncidentTruncatedEventsLabel(
- recentEvents.length,
- filteredEvents.length,
+ recentEvents().length,
+ filteredEvents().length,
)}
</p>
</Show>
diff --git a/frontend-modern/src/features/alerts/MobileAlertHistoryInvestigationDialog.tsx b/frontend-modern/src/features/alerts/MobileAlertHistoryInvestigationDialog.tsx
new file mode 100644
index 0000000000..2f76560677
--- /dev/null
+++ b/frontend-modern/src/features/alerts/MobileAlertHistoryInvestigationDialog.tsx
@@ -0,0 +1,99 @@
+import XIcon from 'lucide-solid/icons/x';
+import { Match, Switch } from 'solid-js';
+
+import { IncidentTimelinePanel } from '@/components/Alerts/IncidentTimelinePanel';
+import { ActionIconButton } from '@/components/shared/Button';
+import { Dialog } from '@/components/shared/Dialog';
+
+import { AlertResourceIncidentsPanel } from './AlertResourceIncidentsPanel';
+import type { AlertHistoryState } from './useAlertHistoryState';
+
+type AlertHistoryAlert = ReturnType<AlertHistoryState['groupedAlerts']>[number]['alerts'][number];
+
+export type MobileAlertHistoryInvestigation = {
+ kind: 'timeline' | 'resource';
+ alert: AlertHistoryAlert;
+ rowKey: string;
+};
+
+interface MobileAlertHistoryInvestigationDialogProps {
+ investigation: MobileAlertHistoryInvestigation;
+ state: AlertHistoryState;
+ onClose: () => void;
+}
+
+export function MobileAlertHistoryInvestigationDialog(
+ props: MobileAlertHistoryInvestigationDialogProps,
+) {
+ const dialogTitle = () =>
+ props.investigation.kind === 'timeline' ? 'Incident timeline' : 'Resource incidents';
+ const dialogLabel = () => `${dialogTitle()} for ${props.investigation.alert.resourceName}`;
+ const rowKey = () => props.investigation.rowKey;
+ const alert = () => props.investigation.alert;
+
+ return (
+ <Dialog
+ isOpen
+ onClose={props.onClose}
+ layout="drawer-right"
+ panelClass="max-w-full sm:max-w-xl"
+ ariaLabel={dialogLabel()}
+ >
+ <div class="flex h-full min-h-0 flex-col" data-testid="mobile-alert-investigation">
+ <header class="flex shrink-0 items-start justify-between gap-3 border-b border-border bg-surface px-4 py-3">
+ <div class="min-w-0">
+ <h2 class="text-base font-semibold text-base-content">{dialogTitle()}</h2>
+ <p class="truncate text-xs text-muted" title={alert().resourceName}>
+ {alert().resourceName}
+ </p>
+ </div>
+ <ActionIconButton
+ type="button"
+ onClick={props.onClose}
+ label={`Close ${dialogTitle().toLowerCase()}`}
+ title="Close"
+ tone="muted"
+ size="md"
+ >
+ <XIcon class="h-5 w-5" aria-hidden="true" />
+ </ActionIconButton>
+ </header>
+
+ <div
+ class="min-h-0 flex-1 overflow-y-auto overscroll-contain p-4"
+ data-testid="mobile-alert-investigation-scroll"
+ >
+ <Switch>
+ <Match when={props.investigation.kind === 'timeline'}>
+ <IncidentTimelinePanel
+ loading={() => props.state.incidentLoading()[rowKey()]}
+ error={() => props.state.incidentErrors()[rowKey()]}
+ timeline={() => props.state.incidentTimelines()[rowKey()]}
+ filters={props.state.historyIncidentEventFilters}
+ setFilters={props.state.setHistoryIncidentEventFilters}
+ filterVariant="compact"
+ eventCardVariant="surface"
+ noteDraft={() => props.state.incidentNoteDrafts()[rowKey()] || ''}
+ onNoteDraftChange={(value) => props.state.setIncidentNoteDraft(rowKey(), value)}
+ noteSaving={() => props.state.incidentNoteSaving().has(rowKey())}
+ onSaveNote={() => {
+ void props.state.saveIncidentNote(rowKey(), alert().id, alert().startTime);
+ }}
+ onRetry={() => {
+ void props.state.loadIncidentTimeline(rowKey(), alert().id, alert().startTime);
+ }}
+ />
+ </Match>
+ <Match when={props.investigation.kind === 'resource'}>
+ <AlertResourceIncidentsPanel
+ state={props.state}
+ onClose={props.onClose}
+ showCloseAction={false}
+ />
+ </Match>
+ </Switch>
+ </div>
+ </div>
+ </Dialog>
+ );
+}
diff --git a/frontend-modern/src/features/alerts/__tests__/AlertHistoryMobileList.test.tsx b/frontend-modern/src/features/alerts/__tests__/AlertHistoryMobileList.test.tsx
index ec2902c86c..6059aceef1 100644
--- a/frontend-modern/src/features/alerts/__tests__/AlertHistoryMobileList.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/AlertHistoryMobileList.test.tsx
@@ -1,12 +1,11 @@
import { fireEvent, render, screen } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
import { describe, expect, it, vi } from 'vitest';
import { AlertHistoryMobileList } from '../AlertHistoryMobileList';
import type { AlertHistoryState } from '../useAlertHistoryState';
-function createState(openRowKey: string | null = null) {
- const toggleIncidentTimeline = vi.fn();
- const openResourceIncidentPanel = vi.fn();
+function createState() {
const alert = {
id: 'alert-1',
source: 'alert',
@@ -23,6 +22,26 @@ function createState(openRowKey: string | null = null) {
nodeDisplayName: 'Production cluster',
rawAlertType: 'backup_failed',
};
+ const [expandedIncidents, setExpandedIncidents] = createSignal(new Set<string>());
+ const [resourceIncidentPanel, setResourceIncidentPanel] = createSignal<{
+ resourceId: string;
+ resourceName: string;
+ rowKey: string;
+ } | null>(null);
+ const toggleIncidentTimeline = vi.fn((rowKey: string) => {
+ setExpandedIncidents((current) => {
+ const next = new Set(current);
+ if (next.has(rowKey)) next.delete(rowKey);
+ else next.add(rowKey);
+ return next;
+ });
+ });
+ const openResourceIncidentPanel = vi.fn(
+ (resourceId: string, resourceName: string, rowKey: string) => {
+ setResourceIncidentPanel({ resourceId, resourceName, rowKey });
+ },
+ );
+ const closeResourceIncidentPanel = vi.fn(() => setResourceIncidentPanel(null));
const state = {
groupedAlerts: () => [
@@ -33,11 +52,11 @@ function createState(openRowKey: string | null = null) {
},
],
getIncidentRowKey: () => 'alert-1-row',
- expandedIncidents: () => new Set<string>(),
+ expandedIncidents,
incidentLoading: () => ({}),
incidentErrors: () => ({}),
incidentTimelines: () => ({}),
- historyIncidentEventFilters: () => [],
+ historyIncidentEventFilters: () => new Set<string>(),
setHistoryIncidentEventFilters: vi.fn(),
incidentNoteDrafts: () => ({}),
setIncidentNoteDraft: vi.fn(),
@@ -46,22 +65,24 @@ function createState(openRowKey: string | null = null) {
loadIncidentTimeline: vi.fn(),
toggleIncidentTimeline,
openResourceIncidentPanel,
- resourceIncidentPanel: () =>
- openRowKey
- ? { resourceId: 'node-1', resourceName: 'pve-production-01', rowKey: openRowKey }
- : null,
+ resourceIncidentPanel,
resourceIncidents: () => ({ 'node-1': [] }),
resourceIncidentLoading: () => ({}),
resourceIncidentEventFilters: () => new Set<string>(),
setResourceIncidentEventFilters: vi.fn(),
refreshResourceIncidentPanel: vi.fn(),
- setResourceIncidentPanel: vi.fn(),
+ setResourceIncidentPanel: closeResourceIncidentPanel,
getResource: () => undefined,
formatAlertRowTime: () => '14:30',
formatAlertRowTimestamp: () => 'Tuesday, 4 August 2026 at 14:30:00',
} as unknown as AlertHistoryState;
- return { openResourceIncidentPanel, state, toggleIncidentTimeline };
+ return {
+ closeResourceIncidentPanel,
+ openResourceIncidentPanel,
+ state,
+ toggleIncidentTimeline,
+ };
}
describe('AlertHistoryMobileList', () => {
@@ -95,6 +116,10 @@ describe('AlertHistoryMobileList', () => {
'alert-1',
'2026-08-04T14:30:00.000Z',
);
+ expect(
+ screen.getByRole('dialog', { name: 'Incident timeline for pve-production-01' }),
+ ).toBeInTheDocument();
+ await fireEvent.click(screen.getByRole('button', { name: 'Close incident timeline' }));
await fireEvent.click(screen.getByRole('button', { name: 'Resource' }));
expect(openResourceIncidentPanel).toHaveBeenCalledWith(
@@ -102,25 +127,46 @@ describe('AlertHistoryMobileList', () => {
'pve-production-01',
'alert-1-row',
);
+ expect(
+ screen.getByRole('dialog', { name: 'Resource incidents for pve-production-01' }),
+ ).toBeInTheDocument();
});
- // #1687: the panel used to render at page level, so on a phone it opened far
- // above whatever card the reader had tapped and the button looked inert.
- it('renders the resource incidents panel inside the card that opened it', () => {
- const { state } = createState('alert-1-row');
+ it('keeps resource investigation scrolling outside the virtualized history row', async () => {
+ const { state } = createState();
const { container } = render(() => <AlertHistoryMobileList state={state} />);
+ await fireEvent.click(screen.getByRole('button', { name: 'Resource' }));
const card = container.querySelector('article');
+ const dialog = screen.getByRole('dialog', {
+ name: 'Resource incidents for pve-production-01',
+ });
expect(card).not.toBeNull();
- expect(card?.textContent).toContain('No incidents recorded for this resource yet.');
+ expect(card?.textContent).not.toContain('No incidents recorded for this resource yet.');
+ expect(dialog).not.toBeNull();
+ expect(card?.contains(dialog)).toBe(false);
+ expect(screen.getByTestId('mobile-alert-investigation-scroll')).toHaveClass(
+ 'overflow-y-auto',
+ 'overscroll-contain',
+ );
+ expect(screen.getByText('No incidents recorded for this resource yet.')).toBeVisible();
});
- it('leaves the card alone while a different row owns the panel', () => {
- const { state } = createState('some-other-row');
+ it('dismisses the mobile investigation with Escape and restores the history surface', async () => {
+ const { closeResourceIncidentPanel, state } = createState();
- const { container } = render(() => <AlertHistoryMobileList state={state} />);
+ render(() => <AlertHistoryMobileList state={state} />);
+ const resourceButton = screen.getByRole('button', { name: 'Resource' });
+ resourceButton.focus();
+ await fireEvent.click(resourceButton);
+ expect(screen.getByRole('dialog')).toBeInTheDocument();
+
+ await fireEvent.keyDown(document, { key: 'Escape' });
+ await new Promise<void>((resolve) => requestAnimationFrame(() => resolve()));
- expect(container.textContent).not.toContain('No incidents recorded for this resource yet.');
+ expect(screen.queryByRole('dialog')).not.toBeInTheDocument();
+ expect(closeResourceIncidentPanel).toHaveBeenCalled();
+ expect(screen.getByRole('button', { name: 'Resource' })).toHaveFocus();
});
});
diff --git a/frontend-modern/src/features/alerts/__tests__/AlertResourceIncidentsPanel.test.tsx b/frontend-modern/src/features/alerts/__tests__/AlertResourceIncidentsPanel.test.tsx
index 97edd64f29..f86025cf99 100644
--- a/frontend-modern/src/features/alerts/__tests__/AlertResourceIncidentsPanel.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/AlertResourceIncidentsPanel.test.tsx
@@ -1,5 +1,5 @@
import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
-import type { JSX } from 'solid-js';
+import { createSignal, type JSX } from 'solid-js';
import { afterEach, describe, expect, it, vi } from 'vitest';
import { AlertResourceIncidentsPanel } from '../AlertResourceIncidentsPanel';
@@ -163,4 +163,82 @@ describe('AlertResourceIncidentsPanel', () => {
expect(JSON.stringify(context)).not.toContain('zpool clear tank');
expect(JSON.stringify(context)).not.toContain('secret-output');
});
+
+ it('reactively reveals and hides the selected resource incident timeline', async () => {
+ const [expandedIncidentIds, setExpandedIncidentIds] = createSignal(new Set<string>());
+ const [eventFilters, setEventFilters] = createSignal(new Set<string>(['opened', 'resolved']));
+ const toggleResourceIncidentDetails = vi.fn((incidentId: string) => {
+ setExpandedIncidentIds((current) => {
+ const next = new Set(current);
+ if (next.has(incidentId)) next.delete(incidentId);
+ else next.add(incidentId);
+ return next;
+ });
+ });
+
+ render(() => (
+ <AlertResourceIncidentsPanel
+ state={
+ {
+ resourceIncidentPanel: () => ({
+ resourceId: 'node-1',
+ resourceName: 'Production node',
+ rowKey: 'alert-1-row',
+ }),
+ resourceIncidents: () => ({
+ 'node-1': [
+ {
+ id: 'incident-1',
+ alertType: 'connectivity',
+ level: 'critical',
+ status: 'resolved',
+ acknowledged: false,
+ openedAt: '2026-08-21T09:00:00Z',
+ closedAt: '2026-08-21T09:05:00Z',
+ message: 'Connection lost',
+ events: [
+ {
+ id: 'event-1',
+ type: 'opened',
+ timestamp: '2026-08-21T09:00:00Z',
+ summary: 'Connectivity incident opened',
+ },
+ {
+ id: 'event-2',
+ type: 'resolved',
+ timestamp: '2026-08-21T09:05:00Z',
+ summary: 'Connectivity restored',
+ },
+ ],
+ },
+ ],
+ }),
+ resourceIncidentLoading: () => ({ 'node-1': false }),
+ expandedResourceIncidentIds: expandedIncidentIds,
+ resourceIncidentEventFilters: eventFilters,
+ setResourceIncidentEventFilters: setEventFilters,
+ refreshResourceIncidentPanel: vi.fn(),
+ setResourceIncidentPanel: vi.fn(),
+ toggleResourceIncidentDetails,
+ } as any
+ }
+ getResource={() => undefined}
+ />
+ ));
+
+ expect(screen.queryByText('Connectivity incident opened')).not.toBeInTheDocument();
+
+ await fireEvent.click(screen.getByRole('button', { name: 'Events (2)' }));
+
+ expect(toggleResourceIncidentDetails).toHaveBeenCalledWith('incident-1');
+ expect(screen.getByRole('button', { name: 'Hide events' })).toBeInTheDocument();
+ expect(screen.getByText('Connectivity incident opened')).toBeVisible();
+
+ setEventFilters(new Set<string>(['resolved']));
+ expect(screen.queryByText('Connectivity incident opened')).not.toBeInTheDocument();
+ expect(screen.getByText('Connectivity restored')).toBeVisible();
+
+ await fireEvent.click(screen.getByRole('button', { name: 'Hide events' }));
+ expect(screen.queryByText('Connectivity incident opened')).not.toBeInTheDocument();
+ });
});