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.

Share alert incident timeline card

rcourtman5465bd1aee6c
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index be7127012d..bdc197f467 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -85,10 +85,12 @@ presentation now also route through
`frontend-modern/src/utils/alertIncidentPresentation.ts` instead of remaining
duplicated inline across the alerts page and overview timeline surfaces.
-Alert incident event meta rows and detail text treatments now also route
-through `frontend-modern/src/utils/alertIncidentPresentation.ts` instead of
-keeping duplicate summary/detail typography inline in the alerts page and
-overview timelines.
+Alert incident timeline event cards now route through
+`frontend-modern/src/components/Alerts/IncidentTimelineEventCard.tsx`,
+while their meta-row, heading, detail, command, and output typography still
+route through `frontend-modern/src/utils/alertIncidentPresentation.ts`
+instead of keeping duplicate timeline card structure inline in the alerts
+page and overview timelines.
Resource incident panel cards, summary rows, and toggle-button presentation
now also route through `frontend-modern/src/utils/alertIncidentPresentation.ts`
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index ec25e26640..3b7ddecde3 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -131,6 +131,11 @@ Alert incident meta-row and detail-text presentation must also route through
the alerts page and overview timeline maintain duplicated inline incident
typography rules.
+Alert incident timeline event card structure must also route through
+`frontend-modern/src/components/Alerts/IncidentTimelineEventCard.tsx` so the
+alerts page and overview timeline share one canonical event-card renderer
+instead of reimplementing the same summary/detail/output block twice.
+
Resource incident panel card and summary-row presentation must also route
through `frontend-modern/src/utils/alertIncidentPresentation.ts` instead of
maintaining page-local incident panel styling inside
diff --git a/frontend-modern/src/components/Alerts/IncidentTimelineEventCard.tsx b/frontend-modern/src/components/Alerts/IncidentTimelineEventCard.tsx
new file mode 100644
index 0000000000..55664ef2b4
--- /dev/null
+++ b/frontend-modern/src/components/Alerts/IncidentTimelineEventCard.tsx
@@ -0,0 +1,49 @@
+import { Show } from 'solid-js';
+import type { IncidentEvent } from '@/types/api';
+import {
+ getAlertIncidentTimelineCommandClass,
+ getAlertIncidentTimelineDetailClass,
+ getAlertIncidentTimelineEventCardClass,
+ getAlertIncidentTimelineHeadingClass,
+ getAlertIncidentTimelineMetaRowClass,
+ getAlertIncidentTimelineOutputClass,
+} from '@/utils/alertIncidentPresentation';
+
+export interface IncidentTimelineEventCardProps {
+ event: IncidentEvent;
+ variant: 'surface' | 'alt';
+}
+
+function getEventDetail(event: IncidentEvent, key: 'note' | 'command' | 'output_excerpt') {
+ const value = event.details?.[key];
+ if (typeof value !== 'string') {
+ return null;
+ }
+
+ const trimmed = value.trim();
+ return trimmed.length > 0 ? trimmed : null;
+}
+
+export function IncidentTimelineEventCard(props: IncidentTimelineEventCardProps) {
+ const note = () => getEventDetail(props.event, 'note');
+ const command = () => getEventDetail(props.event, 'command');
+ const outputExcerpt = () => getEventDetail(props.event, 'output_excerpt');
+
+ return (
+ <div class={getAlertIncidentTimelineEventCardClass(props.variant)}>
+ <div class={getAlertIncidentTimelineMetaRowClass()}>
+ <span class={getAlertIncidentTimelineHeadingClass()}>{props.event.summary}</span>
+ <span>{new Date(props.event.timestamp).toLocaleString()}</span>
+ </div>
+ <Show when={note()}>
+ <p class={getAlertIncidentTimelineDetailClass()}>{note()}</p>
+ </Show>
+ <Show when={command()}>
+ <p class={getAlertIncidentTimelineCommandClass()}>{command()}</p>
+ </Show>
+ <Show when={outputExcerpt()}>
+ <p class={getAlertIncidentTimelineOutputClass()}>{outputExcerpt()}</p>
+ </Show>
+ </div>
+ );
+}
diff --git a/frontend-modern/src/components/Alerts/__tests__/IncidentTimelineEventCard.test.tsx b/frontend-modern/src/components/Alerts/__tests__/IncidentTimelineEventCard.test.tsx
new file mode 100644
index 0000000000..03ab6f1219
--- /dev/null
+++ b/frontend-modern/src/components/Alerts/__tests__/IncidentTimelineEventCard.test.tsx
@@ -0,0 +1,52 @@
+import { afterEach, describe, expect, it } from 'vitest';
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { IncidentTimelineEventCard } from '../IncidentTimelineEventCard';
+import type { IncidentEvent } from '@/types/api';
+
+function makeEvent(overrides: Partial<IncidentEvent> = {}): IncidentEvent {
+ return {
+ id: 'event-1',
+ type: 'ai_analysis',
+ timestamp: '2026-03-18T12:00:00Z',
+ summary: 'Alert investigated',
+ details: {
+ note: 'updated thresholds',
+ command: 'systemctl restart alert',
+ output_excerpt: 'stdout: ok',
+ },
+ ...overrides,
+ };
+}
+
+describe('IncidentTimelineEventCard', () => {
+ afterEach(() => {
+ cleanup();
+ });
+
+ it('renders the shared event card content for the alt variant', () => {
+ const { container } = render(() => (
+ <IncidentTimelineEventCard event={makeEvent()} variant="alt" />
+ ));
+
+ expect(container.firstElementChild).toHaveClass('bg-surface-alt');
+ expect(screen.getByText('Alert investigated')).toBeInTheDocument();
+ expect(screen.getByText('updated thresholds')).toBeInTheDocument();
+ expect(screen.getByText('systemctl restart alert')).toBeInTheDocument();
+ expect(screen.getByText('stdout: ok')).toBeInTheDocument();
+ });
+
+ it('renders the surface variant without optional detail lines', () => {
+ const { container } = render(() => (
+ <IncidentTimelineEventCard
+ event={makeEvent({ details: undefined, summary: 'Incident event' })}
+ variant="surface"
+ />
+ ));
+
+ expect(container.firstElementChild).toHaveClass('bg-surface');
+ expect(screen.getByText('Incident event')).toBeInTheDocument();
+ expect(screen.queryByText('updated thresholds')).not.toBeInTheDocument();
+ expect(screen.queryByText('systemctl restart alert')).not.toBeInTheDocument();
+ expect(screen.queryByText('stdout: ok')).not.toBeInTheDocument();
+ });
+});
diff --git a/frontend-modern/src/features/alerts/OverviewTab.tsx b/frontend-modern/src/features/alerts/OverviewTab.tsx
index bfa1d62d39..14f48bd775 100644
--- a/frontend-modern/src/features/alerts/OverviewTab.tsx
+++ b/frontend-modern/src/features/alerts/OverviewTab.tsx
@@ -11,6 +11,7 @@ import { alertTypeDisplayLabel } from './helpers';
import { getCanonicalAlertId } from './identity';
import { Card } from '@/components/shared/Card';
import { SectionHeader } from '@/components/shared/SectionHeader';
+import { IncidentTimelineEventCard } from '@/components/Alerts/IncidentTimelineEventCard';
import { notificationStore } from '@/stores/notifications';
import { logger } from '@/utils/logger';
import {
@@ -33,14 +34,10 @@ import {
getAlertIncidentEventFilterChipClass,
getAlertIncidentEventFilterContainerClass,
getAlertIncidentEventFilterLabelClass,
- getAlertIncidentTimelineCommandClass,
- getAlertIncidentTimelineDetailClass,
getAlertIncidentNoteSaveButtonClass,
getAlertIncidentNoteTextareaClass,
- getAlertIncidentTimelineEventCardClass,
getAlertIncidentTimelineHeadingClass,
getAlertIncidentTimelineMetaRowClass,
- getAlertIncidentTimelineOutputClass,
getAlertResourceIncidentNotePlaceholder,
getAlertResourceIncidentSaveNoteLabel,
} from '@/utils/alertIncidentPresentation';
@@ -727,52 +724,7 @@ export function OverviewTab(props: {
<div class="space-y-2">
<For each={filteredEvents}>
{(event) => (
- <div
- class={getAlertIncidentTimelineEventCardClass('alt')}
- >
- <div class={getAlertIncidentTimelineMetaRowClass()}>
- <span class={getAlertIncidentTimelineHeadingClass()}>
- {event.summary}
- </span>
- <span>
- {new Date(event.timestamp).toLocaleString()}
- </span>
- </div>
- <Show
- when={
- event.details &&
- (event.details as { note?: string }).note
- }
- >
- <p class={getAlertIncidentTimelineDetailClass()}>
- {(event.details as { note?: string }).note}
- </p>
- </Show>
- <Show
- when={
- event.details &&
- (event.details as { command?: string }).command
- }
- >
- <p class={getAlertIncidentTimelineCommandClass()}>
- {(event.details as { command?: string }).command}
- </p>
- </Show>
- <Show
- when={
- event.details &&
- (event.details as { output_excerpt?: string })
- .output_excerpt
- }
- >
- <p class={getAlertIncidentTimelineOutputClass()}>
- {
- (event.details as { output_excerpt?: string })
- .output_excerpt
- }
- </p>
- </Show>
- </div>
+ <IncidentTimelineEventCard event={event} variant="alt" />
)}
</For>
</div>
diff --git a/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx b/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx
index d1aaf3aafc..df42271253 100644
--- a/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/OverviewTab.timelineerror.test.tsx
@@ -131,4 +131,39 @@ describe('OverviewTab incident timeline error state', () => {
expect(screen.queryByText('Failed to load timeline.')).not.toBeInTheDocument();
expect(screen.queryByText('Retry')).not.toBeInTheDocument();
});
+
+ it('renders the shared incident event card when the timeline loads successfully', async () => {
+ mockGetIncidentTimeline.mockResolvedValueOnce({
+ id: 'inc-1',
+ status: 'open',
+ acknowledged: false,
+ openedAt: '2026-01-01T00:00:00Z',
+ closedAt: null,
+ events: [
+ {
+ id: 'evt-1',
+ type: 'command',
+ timestamp: '2026-01-01T00:05:00Z',
+ summary: 'Command executed',
+ details: {
+ note: 'checked service health',
+ command: 'systemctl status pulse',
+ output_excerpt: 'Active: active (running)',
+ },
+ },
+ ],
+ });
+
+ render(() => <OverviewTab {...defaultProps()} />);
+
+ const timelineBtn = screen.getByText('Timeline');
+ fireEvent.click(timelineBtn);
+
+ await waitFor(() => {
+ expect(screen.getByText('Command executed')).toBeInTheDocument();
+ });
+ expect(screen.getByText('checked service health')).toBeInTheDocument();
+ expect(screen.getByText('systemctl status pulse')).toBeInTheDocument();
+ expect(screen.getByText('Active: active (running)')).toBeInTheDocument();
+ });
});
diff --git a/frontend-modern/src/pages/Alerts.tsx b/frontend-modern/src/pages/Alerts.tsx
index 42ed4d64b9..ede4f8e0a4 100644
--- a/frontend-modern/src/pages/Alerts.tsx
+++ b/frontend-modern/src/pages/Alerts.tsx
@@ -64,6 +64,7 @@ import type { EmailConfig, AppriseConfig } from '@/api/notifications';
import { pbsInstanceFromResource, pmgInstanceFromResource } from '@/utils/resourceStateAdapters';
import { isAppContainerDiscoveryResourceType } from '@/utils/discoveryTarget';
import { getActionableAgentIdFromResource, hasAgentFacet } from '@/utils/agentResources';
+import { IncidentTimelineEventCard } from '@/components/Alerts/IncidentTimelineEventCard';
import {
getAlertHistoryStatusPresentation,
getAlertIncidentAcknowledgedBadgeClass,
@@ -72,11 +73,8 @@ import {
getAlertIncidentEventFilterContainerClass,
getAlertIncidentEventFilterLabelClass,
getAlertIncidentLevelBadgeClass,
- getAlertIncidentTimelineCommandClass,
- getAlertIncidentTimelineDetailClass,
getAlertIncidentNoteSaveButtonClass,
getAlertIncidentNoteTextareaClass,
- getAlertIncidentTimelineEventCardClass,
getAlertIncidentTimelineHeadingClass,
getAlertIncidentTimelineMetaRowClass,
getAlertIncidentTimelineOutputClass,
@@ -5455,88 +5453,10 @@ function HistoryTab(props: {
<div class="space-y-2">
<For each={filteredEvents}>
{(event) => (
- <div
- class={getAlertIncidentTimelineEventCardClass(
- 'surface',
- )}
- >
- <div class={getAlertIncidentTimelineMetaRowClass()}>
- <span class={getAlertIncidentTimelineHeadingClass()}>
- {event.summary}
- </span>
- <span>
- {new Date(
- event.timestamp,
- ).toLocaleString()}
- </span>
- </div>
- <Show
- when={
- event.details &&
- (
- event.details as {
- note?: string;
- }
- ).note
- }
- >
- <p
- class={getAlertIncidentTimelineDetailClass()}
- >
- {
- (
- event.details as {
- note?: string;
- }
- ).note
- }
- </p>
- </Show>
- <Show
- when={
- event.details &&
- (
- event.details as {
- command?: string;
- }
- ).command
- }
- >
- <p
- class={getAlertIncidentTimelineCommandClass()}
- >
- {
- (
- event.details as {
- command?: string;
- }
- ).command
- }
- </p>
- </Show>
- <Show
- when={
- event.details &&
- (
- event.details as {
- output_excerpt?: string;
- }
- ).output_excerpt
- }
- >
- <p
- class={getAlertIncidentTimelineOutputClass()}
- >
- {
- (
- event.details as {
- output_excerpt?: string;
- }
- ).output_excerpt
- }
- </p>
- </Show>
- </div>
+ <IncidentTimelineEventCard
+ event={event}
+ variant="surface"
+ />
)}
</For>
</div>
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 064a7baa4a..8a8caeb59d 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -116,6 +116,7 @@ import useStorageAlertStateSource from '@/components/Storage/useStorageAlertStat
import temperatureUtilSource from '@/utils/temperature.ts?raw';
import pmgInstanceDrawerSource from '@/components/PMG/PMGInstanceDrawer.tsx?raw';
import serviceHealthPresentationSource from '@/utils/serviceHealthPresentation.ts?raw';
+import alertIncidentTimelineEventCardSource from '@/components/Alerts/IncidentTimelineEventCard.tsx?raw';
import swarmServicesDrawerSource from '@/components/Docker/SwarmServicesDrawer.tsx?raw';
import swarmPresentationSource from '@/utils/swarmPresentation.ts?raw';
import k8sDeploymentsDrawerSource from '@/components/Kubernetes/K8sDeploymentsDrawer.tsx?raw';
@@ -2056,14 +2057,14 @@ describe('frontend resource type boundaries', () => {
expect(alertsPageSource).toContain('getAlertIncidentEventFilterActionButtonClass');
expect(alertsPageSource).toContain('getAlertIncidentEventFilterChipClass');
expect(alertsPageSource).toContain('getAlertIncidentAcknowledgedBadgeClass');
- expect(alertsPageSource).toContain('getAlertIncidentTimelineEventCardClass');
expect(alertsPageSource).toContain('getAlertIncidentNoteTextareaClass');
expect(alertsPageSource).toContain('getAlertIncidentNoteSaveButtonClass');
expect(alertsPageSource).toContain('getAlertIncidentTimelineMetaRowClass');
expect(alertsPageSource).toContain('getAlertIncidentTimelineHeadingClass');
- expect(alertsPageSource).toContain('getAlertIncidentTimelineDetailClass');
- expect(alertsPageSource).toContain('getAlertIncidentTimelineCommandClass');
- expect(alertsPageSource).toContain('getAlertIncidentTimelineOutputClass');
+ expect(alertsPageSource).toContain('IncidentTimelineEventCard');
+ expect(alertsPageSource).not.toContain('getAlertIncidentTimelineEventCardClass');
+ expect(alertsPageSource).not.toContain('getAlertIncidentTimelineDetailClass');
+ expect(alertsPageSource).not.toContain('getAlertIncidentTimelineCommandClass');
expect(alertsPageSource).toContain('getAlertResourceIncidentCardClass');
expect(alertsPageSource).toContain('getAlertResourceIncidentSummaryRowClass');
expect(alertsPageSource).toContain('getAlertResourceIncidentToggleButtonClass');
@@ -2705,14 +2706,15 @@ describe('frontend resource type boundaries', () => {
expect(alertOverviewTabSource).toContain('getAlertIncidentEventFilterContainerClass');
expect(alertOverviewTabSource).toContain('getAlertIncidentEventFilterChipClass');
expect(alertOverviewTabSource).toContain('getAlertIncidentAcknowledgedBadgeClass');
- expect(alertOverviewTabSource).toContain('getAlertIncidentTimelineEventCardClass');
expect(alertOverviewTabSource).toContain('getAlertIncidentNoteTextareaClass');
expect(alertOverviewTabSource).toContain('getAlertIncidentNoteSaveButtonClass');
expect(alertOverviewTabSource).toContain('getAlertIncidentTimelineMetaRowClass');
expect(alertOverviewTabSource).toContain('getAlertIncidentTimelineHeadingClass');
- expect(alertOverviewTabSource).toContain('getAlertIncidentTimelineDetailClass');
- expect(alertOverviewTabSource).toContain('getAlertIncidentTimelineCommandClass');
- expect(alertOverviewTabSource).toContain('getAlertIncidentTimelineOutputClass');
+ expect(alertOverviewTabSource).toContain('IncidentTimelineEventCard');
+ expect(alertOverviewTabSource).not.toContain('getAlertIncidentTimelineEventCardClass');
+ 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');
@@ -2806,6 +2808,27 @@ describe('frontend resource type boundaries', () => {
expect(alertIncidentPresentationSource).toContain(
'export function getAlertResourceIncidentTruncatedEventsLabel',
);
+ expect(alertIncidentTimelineEventCardSource).toContain(
+ 'export function IncidentTimelineEventCard',
+ );
+ expect(alertIncidentTimelineEventCardSource).toContain(
+ 'getAlertIncidentTimelineEventCardClass',
+ );
+ expect(alertIncidentTimelineEventCardSource).toContain(
+ 'getAlertIncidentTimelineMetaRowClass',
+ );
+ expect(alertIncidentTimelineEventCardSource).toContain(
+ 'getAlertIncidentTimelineHeadingClass',
+ );
+ expect(alertIncidentTimelineEventCardSource).toContain(
+ 'getAlertIncidentTimelineDetailClass',
+ );
+ expect(alertIncidentTimelineEventCardSource).toContain(
+ 'getAlertIncidentTimelineCommandClass',
+ );
+ expect(alertIncidentTimelineEventCardSource).toContain(
+ 'getAlertIncidentTimelineOutputClass',
+ );
expect(alertOverviewPresentationSource).toContain(
'export function getAlertHistoryEmptyState',
);