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.

alerts(history): restore v5 information density to the alerts surface

rcourtman5ba53f681d78
diff --git a/frontend-modern/src/features/alerts/AlertHistoryTableAlertRow.tsx b/frontend-modern/src/features/alerts/AlertHistoryTableAlertRow.tsx
index 3cce197328..55bbfbfaa1 100644
--- a/frontend-modern/src/features/alerts/AlertHistoryTableAlertRow.tsx
+++ b/frontend-modern/src/features/alerts/AlertHistoryTableAlertRow.tsx
@@ -4,10 +4,7 @@ import { IncidentTimelinePanel } from '@/components/Alerts/IncidentTimelinePanel
import { InvestigateAlertButton } from '@/components/Alerts/InvestigateAlertButton';
import { TableCell, TableRow } from '@/components/shared/Table';
import { getPlatformTableCellClassForKind } from '@/features/platformPage/sharedPlatformPage';
-import {
- getAlertHistoryResourceTypeBadgeClass,
- getAlertHistorySourcePresentation,
-} from '@/utils/alertHistoryPresentation';
+import { getAlertHistoryResourceTypeBadgeClass } from '@/utils/alertHistoryPresentation';
import {
getAlertHistoryStatusPresentation,
getAlertIncidentLevelBadgeClass,
@@ -26,7 +23,6 @@ interface AlertHistoryTableAlertRowProps {
export function AlertHistoryTableAlertRow(props: AlertHistoryTableAlertRowProps) {
const rowKey = () => props.state.getIncidentRowKey(props.alert);
const historyStatusPresentation = () => getAlertHistoryStatusPresentation(props.alert.status);
- const sourcePresentation = () => getAlertHistorySourcePresentation(props.alert.source);
return (
<>
@@ -42,10 +38,6 @@ export function AlertHistoryTableAlertRow(props: AlertHistoryTableAlertRowProps)
})}
</TableCell>
- <TableCell class={getPlatformTableCellClassForKind('badge')}>
- <span class={sourcePresentation().className}>{sourcePresentation().label}</span>
- </TableCell>
-
<TableCell
class={`${getPlatformTableCellClassForKind('name')} max-w-[150px] truncate font-medium text-base-content`}
title={props.alert.resourceName}
@@ -54,8 +46,11 @@ export function AlertHistoryTableAlertRow(props: AlertHistoryTableAlertRowProps)
</TableCell>
<TableCell class={getPlatformTableCellClassForKind('badge')}>
- <span class={getAlertHistoryResourceTypeBadgeClass(props.alert.resourceType)}>
- {props.alert.resourceType}
+ <span
+ class={getAlertHistoryResourceTypeBadgeClass(props.alert.resourceType)}
+ title={props.alert.resourceType}
+ >
+ {props.alert.title}
</span>
</TableCell>
@@ -72,20 +67,18 @@ export function AlertHistoryTableAlertRow(props: AlertHistoryTableAlertRowProps)
{props.alert.description}
</TableCell>
- <TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} hidden text-muted lg:table-cell`}
- >
+ <TableCell class={`${getPlatformTableCellClassForKind('numeric-value')} text-muted`}>
{props.alert.duration}
</TableCell>
- <TableCell class={`${getPlatformTableCellClassForKind('badge')} hidden lg:table-cell`}>
+ <TableCell class={getPlatformTableCellClassForKind('badge')}>
<span class={historyStatusPresentation().className}>
{historyStatusPresentation().label}
</span>
</TableCell>
<TableCell
- class={`${getPlatformTableCellClassForKind('text')} hidden truncate text-muted lg:table-cell`}
+ class={`${getPlatformTableCellClassForKind('text')} truncate text-muted`}
title={props.alert.nodeDisplayName || props.alert.node || ''}
>
{props.alert.nodeDisplayName || props.alert.node || '—'}
@@ -157,7 +150,7 @@ export function AlertHistoryTableAlertRow(props: AlertHistoryTableAlertRowProps)
<Show when={props.alert.source === 'alert' && props.state.expandedIncidents().has(rowKey())}>
<TableRow class="border-b border-border bg-surface-alt">
- <TableCell colspan={11} class="p-3">
+ <TableCell colspan={9} class="p-3">
<IncidentTimelinePanel
loading={props.state.incidentLoading()[rowKey()]}
error={props.state.incidentErrors()[rowKey()]}
diff --git a/frontend-modern/src/features/alerts/AlertHistoryTableGroupRow.tsx b/frontend-modern/src/features/alerts/AlertHistoryTableGroupRow.tsx
index 04b48bfc8b..ecbf15c0d1 100644
--- a/frontend-modern/src/features/alerts/AlertHistoryTableGroupRow.tsx
+++ b/frontend-modern/src/features/alerts/AlertHistoryTableGroupRow.tsx
@@ -33,7 +33,7 @@ function getGroupSummaryLabel(group: AlertHistoryGroup) {
export function AlertHistoryTableGroupRow(props: AlertHistoryTableGroupRowProps) {
return (
<TableRow class={getGroupedTableRowClass()}>
- <TableCell colspan={10} class={getGroupedTableRowCellClass()}>
+ <TableCell colspan={9} class={getGroupedTableRowCellClass()}>
<div class="flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between sm:gap-3">
<span class="truncate" title={props.group.fullLabel}>
{props.group.label}
diff --git a/frontend-modern/src/features/alerts/AlertHistoryTableSection.tsx b/frontend-modern/src/features/alerts/AlertHistoryTableSection.tsx
index 5ad1a23f4a..a306db99c2 100644
--- a/frontend-modern/src/features/alerts/AlertHistoryTableSection.tsx
+++ b/frontend-modern/src/features/alerts/AlertHistoryTableSection.tsx
@@ -32,7 +32,7 @@ export function AlertHistoryTableSection(props: AlertHistoryTableSectionProps) {
}
>
<TableCard class="mb-2">
- <Table class="w-full text-[11px] sm:text-sm">
+ <Table class="w-full min-w-[800px] text-[11px] sm:text-sm">
<TableHeader>
<TableRow class="border-b border-border bg-surface-hover text-muted">
<TableHead
@@ -40,11 +40,6 @@ export function AlertHistoryTableSection(props: AlertHistoryTableSectionProps) {
>
Timestamp
</TableHead>
- <TableHead
- class={`${getPlatformTableHeadClassForKind('badge')} text-[10px] font-medium uppercase tracking-wider sm:text-xs`}
- >
- Source
- </TableHead>
<TableHead
class={`${getPlatformTableHeadClassForKind('name')} text-[10px] font-medium uppercase tracking-wider sm:text-xs`}
>
@@ -66,17 +61,17 @@ export function AlertHistoryTableSection(props: AlertHistoryTableSectionProps) {
Message
</TableHead>
<TableHead
- class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden text-[10px] font-medium uppercase tracking-wider lg:table-cell sm:text-xs`}
+ class={`${getPlatformTableHeadClassForKind('numeric-value')} text-[10px] font-medium uppercase tracking-wider sm:text-xs`}
>
Duration
</TableHead>
<TableHead
- class={`${getPlatformTableHeadClassForKind('badge')} hidden text-[10px] font-medium uppercase tracking-wider lg:table-cell sm:text-xs`}
+ class={`${getPlatformTableHeadClassForKind('badge')} text-[10px] font-medium uppercase tracking-wider sm:text-xs`}
>
Status
</TableHead>
<TableHead
- class={`${getPlatformTableHeadClassForKind('text')} hidden text-[10px] font-medium uppercase tracking-wider lg:table-cell sm:text-xs`}
+ class={`${getPlatformTableHeadClassForKind('text')} text-[10px] font-medium uppercase tracking-wider sm:text-xs`}
>
Node
</TableHead>
diff --git a/frontend-modern/src/features/alerts/__tests__/alertHistoryModel.test.ts b/frontend-modern/src/features/alerts/__tests__/alertHistoryModel.test.ts
index 1fc897dce8..0a9bc19072 100644
--- a/frontend-modern/src/features/alerts/__tests__/alertHistoryModel.test.ts
+++ b/frontend-modern/src/features/alerts/__tests__/alertHistoryModel.test.ts
@@ -4,12 +4,14 @@ import type { Alert } from '@/types/api';
import type { Resource } from '@/types/resource';
import {
+ applyAlertHistoryWindow,
buildAlertHistoryItems,
buildAlertHistoryParams,
buildAlertTrends,
buildSelectedBucketDetails,
formatAlertHistoryDuration,
getAlertBucketDurationLabel,
+ type HistoryItem,
} from '../alertHistoryModel';
describe('alertHistoryModel', () => {
@@ -95,4 +97,26 @@ describe('alertHistoryModel', () => {
expect(details).not.toBeNull();
expect(details?.rangeLabel).toContain('Mar');
});
+
+ it('keeps a stable id order for alerts sharing a startTime (#1218)', () => {
+ const sharedStart = '2026-03-22T09:00:00.000Z';
+ const items = [
+ { id: 'zeta', startTime: sharedStart },
+ { id: 'alpha', startTime: sharedStart },
+ { id: 'newest', startTime: '2026-03-22T09:30:00.000Z' },
+ { id: 'mid', startTime: sharedStart },
+ ] as HistoryItem[];
+ const now = Date.UTC(2026, 2, 22, 10, 0, 0);
+ const trends = buildAlertTrends(items, '24h', now);
+
+ const sorted = applyAlertHistoryWindow({
+ filteredItems: items,
+ timeFilter: '24h',
+ selectedBarIndex: null,
+ trends,
+ now,
+ });
+
+ expect(sorted.map((item) => item.id)).toEqual(['newest', 'alpha', 'mid', 'zeta']);
+ });
});
diff --git a/frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx b/frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx
index 8ee138ac75..8248c82b27 100644
--- a/frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx
+++ b/frontend-modern/src/features/alerts/__tests__/useAlertOverviewState.test.tsx
@@ -116,4 +116,24 @@ describe('useAlertOverviewState', () => {
);
expect(notificationStore.error).toHaveBeenCalledWith('Failed to acknowledge 1 alert.');
});
+
+ it('keeps a stable id order for alerts sharing a startTime (#1218)', () => {
+ const sharedStart = new Date(Date.now() - 60_000).toISOString();
+ const [activeAlerts] = createSignal<Record<string, Alert>>({
+ zeta: makeAlert('zeta', sharedStart),
+ alpha: makeAlert('alpha', sharedStart),
+ mid: makeAlert('mid', sharedStart),
+ });
+
+ const { result } = renderHook(() =>
+ useAlertOverviewState({
+ activeAlerts,
+ overrides: () => [],
+ showAcknowledged: () => true,
+ updateAlert: vi.fn(),
+ }),
+ );
+
+ expect(result.filteredAlerts().map((alert) => alert.id)).toEqual(['alpha', 'mid', 'zeta']);
+ });
});
diff --git a/frontend-modern/src/features/alerts/alertHistoryModel.ts b/frontend-modern/src/features/alerts/alertHistoryModel.ts
index cab1e1dfb7..193b1d9707 100644
--- a/frontend-modern/src/features/alerts/alertHistoryModel.ts
+++ b/frontend-modern/src/features/alerts/alertHistoryModel.ts
@@ -375,9 +375,13 @@ export function applyAlertHistoryWindow({
}
}
- return [...filtered].sort(
- (a, b) => new Date(b.startTime).getTime() - new Date(a.startTime).getTime(),
- );
+ // Stable id tiebreaker: alerts fired in the same polling cycle share a
+ // startTime and would otherwise scramble visually on re-render (#1218).
+ return [...filtered].sort((a, b) => {
+ const timeDiff = new Date(b.startTime).getTime() - new Date(a.startTime).getTime();
+ if (timeDiff !== 0) return timeDiff;
+ return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
+ });
}
const MONTH_NAMES = [
diff --git a/frontend-modern/src/features/alerts/useAlertOverviewState.ts b/frontend-modern/src/features/alerts/useAlertOverviewState.ts
index 7dae9ff4c1..d9092ac289 100644
--- a/frontend-modern/src/features/alerts/useAlertOverviewState.ts
+++ b/frontend-modern/src/features/alerts/useAlertOverviewState.ts
@@ -53,7 +53,11 @@ export function useAlertOverviewState(props: UseAlertOverviewStateProps) {
if (a.acknowledged !== b.acknowledged) {
return a.acknowledged ? 1 : -1;
}
- return new Date(b.startTime).getTime() - new Date(a.startTime).getTime();
+ const timeDiff = new Date(b.startTime).getTime() - new Date(a.startTime).getTime();
+ if (timeDiff !== 0) return timeDiff;
+ // Stable id tiebreaker: alerts fired in the same polling cycle share a
+ // startTime and would otherwise scramble visually on re-render (#1218).
+ return a.id < b.id ? -1 : a.id > b.id ? 1 : 0;
}),
);
diff --git a/frontend-modern/src/utils/__tests__/alertHistoryPresentation.test.ts b/frontend-modern/src/utils/__tests__/alertHistoryPresentation.test.ts
index a65a3415c6..7c6aad1b64 100644
--- a/frontend-modern/src/utils/__tests__/alertHistoryPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/alertHistoryPresentation.test.ts
@@ -1,29 +1,13 @@
import { describe, expect, it } from 'vitest';
-import {
- getAlertHistoryResourceTypeBadgeClass,
- getAlertHistorySourcePresentation,
-} from '@/utils/alertHistoryPresentation';
+import { getAlertHistoryResourceTypeBadgeClass } from '@/utils/alertHistoryPresentation';
describe('alertHistoryPresentation', () => {
- it('returns canonical alert history source presentation', () => {
- expect(getAlertHistorySourcePresentation('ai')).toEqual({
- label: 'Patrol',
- className:
- 'text-[10px] px-1.5 py-0.5 rounded font-medium bg-indigo-100 dark:bg-indigo-900 text-indigo-700 dark:text-indigo-300',
- });
-
- expect(getAlertHistorySourcePresentation('alert')).toEqual({
- label: 'Alert',
- className:
- 'text-[10px] px-1.5 py-0.5 rounded font-medium bg-sky-100 dark:bg-sky-900 text-sky-700 dark:text-sky-300',
- });
- });
-
it('returns canonical resource type badge classes for alert history rows', () => {
expect(getAlertHistoryResourceTypeBadgeClass('VM')).toContain('bg-blue-100');
expect(getAlertHistoryResourceTypeBadgeClass('Node')).toContain('bg-blue-100');
expect(getAlertHistoryResourceTypeBadgeClass('Container')).toContain('bg-green-100');
expect(getAlertHistoryResourceTypeBadgeClass('CT')).toContain('bg-green-100');
+ expect(getAlertHistoryResourceTypeBadgeClass('LXC')).toContain('bg-green-100');
expect(getAlertHistoryResourceTypeBadgeClass('Storage')).toContain('bg-orange-100');
expect(getAlertHistoryResourceTypeBadgeClass('Unknown')).toContain('bg-surface-hover');
});
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 37c0c7c578..9c82375c91 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -2823,7 +2823,6 @@ describe('frontend resource type boundaries', () => {
expect(alertHistoryTableSectionSource).not.toContain('InvestigateAlertButton');
expect(alertHistoryTableGroupRowSource).toContain('getGroupSummaryLabel');
expect(alertHistoryTableAlertRowSource).toContain('getAlertHistoryStatusPresentation');
- expect(alertHistoryTableAlertRowSource).toContain('getAlertHistorySourcePresentation');
expect(alertHistoryTableAlertRowSource).toContain('getAlertHistoryResourceTypeBadgeClass');
expect(alertHistoryTableAlertRowSource).toContain('IncidentTimelinePanel');
expect(alertHistoryTableAlertRowSource).toContain('InvestigateAlertButton');
@@ -3212,9 +3211,6 @@ describe('frontend resource type boundaries', () => {
expect(alertIncidentPresentationSource).toContain(
'export function getAlertHistoryStatusPresentation',
);
- expect(alertHistoryPresentationSource).toContain(
- 'export function getAlertHistorySourcePresentation',
- );
expect(alertHistoryPresentationSource).toContain(
'export function getAlertHistoryResourceTypeBadgeClass',
);
diff --git a/frontend-modern/src/utils/alertHistoryPresentation.ts b/frontend-modern/src/utils/alertHistoryPresentation.ts
index de0e33cea8..99f5187e42 100644
--- a/frontend-modern/src/utils/alertHistoryPresentation.ts
+++ b/frontend-modern/src/utils/alertHistoryPresentation.ts
@@ -1,25 +1,3 @@
-export interface AlertHistorySourcePresentation {
- label: string;
- className: string;
-}
-
-export function getAlertHistorySourcePresentation(source?: string | null): AlertHistorySourcePresentation {
- const normalized = (source ?? '').trim().toLowerCase();
- if (normalized === 'ai') {
- return {
- label: 'Patrol',
- className:
- 'text-[10px] px-1.5 py-0.5 rounded font-medium bg-indigo-100 dark:bg-indigo-900 text-indigo-700 dark:text-indigo-300',
- };
- }
-
- return {
- label: 'Alert',
- className:
- 'text-[10px] px-1.5 py-0.5 rounded font-medium bg-sky-100 dark:bg-sky-900 text-sky-700 dark:text-sky-300',
- };
-}
-
export function getAlertHistoryResourceTypeBadgeClass(resourceType?: string | null): string {
const normalized = (resourceType ?? '').trim().toLowerCase();
@@ -27,7 +5,7 @@ export function getAlertHistoryResourceTypeBadgeClass(resourceType?: string | nu
return 'text-xs px-1 py-0.5 rounded bg-blue-100 dark:bg-blue-900 text-blue-700 dark:text-blue-300';
}
- if (normalized === 'container' || normalized === 'ct') {
+ if (normalized === 'container' || normalized === 'ct' || normalized === 'lxc') {
return 'text-xs px-1 py-0.5 rounded bg-green-100 dark:bg-green-900 text-green-700 dark:text-green-300';
}