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.

refactor(recovery): surface protected inventory health status

rcourtmanaee0cba8b0a7
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 69265f4365..c9a337cf04 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -179,6 +179,11 @@ The governed default remains inventory-first so Proxmox-oriented operators land
on the familiar protected-items view, but drill-in actions such as selecting a
subject or a timeline day must switch the primary workspace to recovery events
instead of leaving two competing table surfaces visible at once.
+That same operator-facing workspace must lead with current protection status
+rather than only the latest backup outcome. Protected items should surface
+stale, never-succeeded, failed, warning, and running rollups as the primary
+monitoring status so an item with an old successful point does not scan as
+healthy when it still needs operator attention.
That same workspace contract also keeps Pulse's provider-neutral recovery model
explicit in the page language: recovery sections should talk about protected
items, recovery events, and latest points so PBS backups, TrueNAS snapshots,
diff --git a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
index 7796fd75af..2c3d1df381 100644
--- a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
@@ -15,8 +15,9 @@ import type { ProtectionRollup, RecoveryOutcome } from '@/types/recovery';
import type { Resource } from '@/types/resource';
import {
getRecoveryProtectedToggleClass,
- getRecoveryRollupStatusPillClass,
- getRecoveryRollupStatusPillLabel,
+ getRecoveryRollupInventoryStatusLabel,
+ getRecoveryRollupInventoryStatusTextClass,
+ getRecoveryRollupInventoryStatusVariant,
getRecoverySpecialOutcomeTextClass,
} from '@/utils/recoveryStatusPresentation';
import {
@@ -31,17 +32,14 @@ import {
} from '@/utils/recoveryItemTypePresentation';
import {
getRecoveryArtifactColumnLabel,
- getRecoveryArtifactMetadataTextClass,
+ getRecoveryRollupInventoryStatus,
getRecoveryRollupInventoryPriority,
getRecoveryRollupAgeTextClass,
getRecoveryProtectedSearchPlaceholder,
getRecoverySearchHistoryEmptyMessage,
getRecoveryRollupTimestampMs,
- isRecoveryRollupStale,
} from '@/utils/recoveryTablePresentation';
import {
- getRecoveryOutcomeTextClass,
- getRecoveryOutcomeLabel,
normalizeRecoveryOutcome,
} from '@/utils/recoveryOutcomePresentation';
import { getRecoveryRollupPlatforms } from '@/utils/recoveryPlatformModel';
@@ -380,7 +378,7 @@ export const RecoveryProtectedInventorySection: Component<
['type', 'Item Type'],
['platform', getRecoveryArtifactColumnLabel('platform', 'Platform')],
['lastBackup', 'Latest Point'],
- ['outcome', 'Outcome'],
+ ['outcome', 'Status'],
] as const
).map(([column, label]) => (
<TableHead
@@ -421,7 +419,8 @@ export const RecoveryProtectedInventorySection: Component<
const secondaryLabel = getRecoveryRollupItemSecondaryLabel(rollup);
const attemptMs = rollup.lastAttemptAt ? Date.parse(rollup.lastAttemptAt) : 0;
const successMs = rollup.lastSuccessAt ? Date.parse(rollup.lastSuccessAt) : 0;
- const outcome = normalizeRecoveryOutcome(rollup.lastOutcome);
+ const inventoryStatus = getRecoveryRollupInventoryStatus(rollup);
+ const inventoryStatusLabel = getRecoveryRollupInventoryStatusLabel(inventoryStatus);
const platforms = getRecoveryRollupPlatforms(rollup)
.map((platform) => String(platform || '').trim())
.filter(Boolean)
@@ -431,23 +430,7 @@ export const RecoveryProtectedInventorySection: Component<
const itemTypePresentation =
getRecoveryItemTypePresentation(getRecoveryRollupItemTypeKey(rollup)) || null;
const nowMs = Date.now();
- const stale = isRecoveryRollupStale(rollup, nowMs);
- const neverSucceeded =
- (!Number.isFinite(successMs) || successMs <= 0) &&
- Number.isFinite(attemptMs) &&
- attemptMs > 0;
- const outcomeVariant = (() => {
- switch (outcome) {
- case 'success':
- return 'success' as const;
- case 'warning':
- return 'warning' as const;
- case 'failed':
- return 'danger' as const;
- default:
- return 'muted' as const;
- }
- })();
+ const neverSucceeded = inventoryStatus === 'never-succeeded';
return (
<TableRow
@@ -461,11 +444,11 @@ export const RecoveryProtectedInventorySection: Component<
<div class="flex min-w-0 flex-col gap-1">
<div class="flex min-w-0 items-center gap-2">
<StatusDot
- variant={outcomeVariant}
+ variant={getRecoveryRollupInventoryStatusVariant(inventoryStatus)}
size="xs"
- pulse={outcome === 'running'}
- title={getRecoveryOutcomeLabel(outcome)}
- ariaLabel={getRecoveryOutcomeLabel(outcome)}
+ pulse={inventoryStatus === 'running'}
+ title={inventoryStatusLabel}
+ ariaLabel={inventoryStatusLabel}
/>
<div class="flex min-w-0 items-baseline gap-1.5">
<span class="truncate text-[13px] font-medium">{label}</span>
@@ -475,16 +458,6 @@ export const RecoveryProtectedInventorySection: Component<
</span>
</Show>
</div>
- <Show when={neverSucceeded}>
- <span class={getRecoveryRollupStatusPillClass('never-succeeded')}>
- {getRecoveryRollupStatusPillLabel('never-succeeded')}
- </span>
- </Show>
- <Show when={!neverSucceeded && stale}>
- <span class={getRecoveryRollupStatusPillClass('stale')}>
- {getRecoveryRollupStatusPillLabel('stale')}
- </span>
- </Show>
</div>
<div class="flex flex-wrap items-center gap-1.5 text-[10px] md:hidden">
<Show when={itemTypePresentation?.label}>
@@ -557,8 +530,12 @@ export const RecoveryProtectedInventorySection: Component<
</TableCell>
<TableCell class="whitespace-nowrap px-3 py-1.5">
- <span class={`text-[11px] font-medium ${getRecoveryOutcomeTextClass(outcome)}`}>
- {titleCaseDelimitedLabel(outcome)}
+ <span
+ class={`text-[11px] font-medium ${getRecoveryRollupInventoryStatusTextClass(
+ inventoryStatus,
+ )}`}
+ >
+ {inventoryStatusLabel}
</span>
</TableCell>
</TableRow>
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index a2cfbd2486..abe1c09bd7 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -263,6 +263,7 @@ describe('Recovery', () => {
expect(within(inventoryTable).getByText('Item')).toBeInTheDocument();
expect(within(inventoryTable).getByText('Item Type')).toBeInTheDocument();
expect(within(inventoryTable).getByText('Platform')).toBeInTheDocument();
+ expect(within(inventoryTable).getByText('Status')).toBeInTheDocument();
expect(within(inventoryTable).queryByText('ITEM TYPE')).not.toBeInTheDocument();
expect(within(inventoryTable).queryByText('PLATFORM')).not.toBeInTheDocument();
expect(inventoryBody?.className).toContain('divide-y');
@@ -270,11 +271,11 @@ describe('Recovery', () => {
const inventoryRows = inventoryBody ? Array.from(inventoryBody.querySelectorAll('tr')) : [];
expect(inventoryRows.length).toBeGreaterThan(1);
expect(within(inventoryRows[0]!).getByText('tank/apps')).toBeInTheDocument();
- expect(within(inventoryRows[0]!).getByText('Failed')).toBeInTheDocument();
+ expect(within(inventoryRows[0]!).getByText('Never succeeded')).toBeInTheDocument();
expect(within(inventoryTable).getAllByText('VM').length).toBeGreaterThan(0);
const vmRow = screen.getByText('VM 123').closest('tr');
expect(vmRow).not.toBeNull();
- expect(within(vmRow!).getByLabelText('Healthy')).toBeInTheDocument();
+ expect(within(vmRow!).getByLabelText('Stale')).toBeInTheDocument();
expect(within(vmRow!).getAllByText('PVE').length).toBeGreaterThan(0);
expect(within(vmRow!).getAllByText('VM').length).toBeGreaterThan(0);
expect(within(vmRow!).getByText('VMID 123')).toBeInTheDocument();
@@ -284,7 +285,7 @@ describe('Recovery', () => {
expect(within(vmRow!).getAllByText('VM')[0].className).toContain('bg-');
expect(within(vmRow!).getAllByText('VM')[0].className).toContain('rounded');
expect(within(vmRow!).getAllByText('VM')[0].className).toContain('px-1 py-0.5');
- expect(within(vmRow!).getByText('Success').className).not.toContain('rounded');
+ expect(within(vmRow!).getByText('Stale').className).not.toContain('rounded');
expect(screen.queryByText('Backups By Date')).not.toBeInTheDocument();
expect(screen.queryByText('Recovery Activity')).not.toBeInTheDocument();
@@ -519,6 +520,30 @@ describe('Recovery', () => {
}
});
+ it('surfaces stale protected inventory health even when the latest outcome was successful', async () => {
+ rollupsPayload.push({
+ rollupId: 'res:vm-stale',
+ itemResourceId: 'vm-stale',
+ display: { itemLabel: 'Stale VM', itemType: 'vm', entityIdLabel: '999' },
+ lastAttemptAt: '2026-02-01T10:00:00.000Z',
+ lastSuccessAt: '2026-02-01T10:00:00.000Z',
+ lastOutcome: 'success',
+ platforms: ['proxmox-pve'],
+ });
+
+ try {
+ render(() => <Recovery />);
+
+ const staleRow = (await screen.findByText('Stale VM')).closest('tr');
+ expect(staleRow).not.toBeNull();
+ expect(within(staleRow!).getByLabelText('Stale')).toBeInTheDocument();
+ expect(within(staleRow!).getByText('Stale')).toBeInTheDocument();
+ expect(within(staleRow!).queryByText('Success')).not.toBeInTheDocument();
+ } finally {
+ rollupsPayload.pop();
+ }
+ });
+
it('derives canonical item types from shared fallback fields when itemType is absent', async () => {
const originalRollupDisplay = rollupsPayload[0].display;
const originalPointDisplay = pointsByRollupId['res:vm-123'][0].display;
diff --git a/frontend-modern/src/utils/__tests__/recoveryStatusPresentation.test.ts b/frontend-modern/src/utils/__tests__/recoveryStatusPresentation.test.ts
index a537246585..f2f0c1ab86 100644
--- a/frontend-modern/src/utils/__tests__/recoveryStatusPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/recoveryStatusPresentation.test.ts
@@ -1,6 +1,9 @@
import { describe, expect, it } from 'vitest';
import {
getRecoveryProtectedToggleClass,
+ getRecoveryRollupInventoryStatusLabel,
+ getRecoveryRollupInventoryStatusTextClass,
+ getRecoveryRollupInventoryStatusVariant,
getRecoveryRollupStatusPillClass,
getRecoveryRollupStatusPillLabel,
getRecoverySpecialOutcomeTextClass,
@@ -21,6 +24,18 @@ describe('recoveryStatusPresentation', () => {
expect(getRecoveryRollupStatusPillClass('never-succeeded')).toContain('text-rose-700');
});
+ it('derives inventory status labels, tones, and dot variants', () => {
+ expect(getRecoveryRollupInventoryStatusLabel('healthy')).toBe('Healthy');
+ expect(getRecoveryRollupInventoryStatusLabel('stale')).toBe('Stale');
+ expect(getRecoveryRollupInventoryStatusLabel('never-succeeded')).toBe('Never succeeded');
+ expect(getRecoveryRollupInventoryStatusTextClass('stale')).toContain('text-amber-600');
+ expect(getRecoveryRollupInventoryStatusTextClass('failed')).toContain('text-red-600');
+ expect(getRecoveryRollupInventoryStatusTextClass('running')).toContain('text-blue-600');
+ expect(getRecoveryRollupInventoryStatusVariant('healthy')).toBe('success');
+ expect(getRecoveryRollupInventoryStatusVariant('stale')).toBe('warning');
+ expect(getRecoveryRollupInventoryStatusVariant('never-succeeded')).toBe('danger');
+ });
+
it('derives special outcome text classes', () => {
expect(getRecoverySpecialOutcomeTextClass('never')).toContain('text-amber-600');
});
diff --git a/frontend-modern/src/utils/__tests__/recoveryTablePresentation.test.ts b/frontend-modern/src/utils/__tests__/recoveryTablePresentation.test.ts
index 42b0b0934d..13a7d3c0b0 100644
--- a/frontend-modern/src/utils/__tests__/recoveryTablePresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/recoveryTablePresentation.test.ts
@@ -12,6 +12,7 @@ import {
getRecoveryPointItemTypeLabel,
getRecoveryProtectedSearchPlaceholder,
getRecoveryRollupAgeTextClass,
+ getRecoveryRollupInventoryStatus,
getRecoveryRollupIssueTone,
getRecoverySearchHistoryEmptyMessage,
isRecoveryRollupStale,
@@ -147,6 +148,9 @@ describe('recoveryTablePresentation', () => {
expect(getRecoveryRollupIssueTone(failed, now)).toBe('rose');
expect(getRecoveryRollupIssueTone(stale, now)).toBe('amber');
+ expect(getRecoveryRollupInventoryStatus(failed, now)).toBe('failed');
+ expect(getRecoveryRollupInventoryStatus(stale, now)).toBe('stale');
+ expect(getRecoveryRollupInventoryStatus(aging, now)).toBe('healthy');
expect(isRecoveryRollupStale(stale, now)).toBe(true);
expect(getRecoveryRollupAgeTextClass(stale, now)).toContain('text-rose-700');
expect(getRecoveryRollupAgeTextClass(aging, now)).toContain('text-amber-700');
diff --git a/frontend-modern/src/utils/recoveryStatusPresentation.ts b/frontend-modern/src/utils/recoveryStatusPresentation.ts
index e742363dae..5e0fd5404b 100644
--- a/frontend-modern/src/utils/recoveryStatusPresentation.ts
+++ b/frontend-modern/src/utils/recoveryStatusPresentation.ts
@@ -1,3 +1,5 @@
+import type { RecoveryRollupInventoryStatus } from '@/utils/recoveryTablePresentation';
+
export type RecoveryRollupStatusPill = 'stale' | 'never-succeeded' | 'recent';
export function getRecoveryProtectedToggleClass(active: boolean): string {
@@ -28,6 +30,63 @@ export function getRecoveryRollupStatusPillLabel(kind: RecoveryRollupStatusPill)
}
}
+export function getRecoveryRollupInventoryStatusLabel(
+ status: RecoveryRollupInventoryStatus,
+): string {
+ switch (status) {
+ case 'healthy':
+ return 'Healthy';
+ case 'warning':
+ return 'Warning';
+ case 'failed':
+ return 'Failed';
+ case 'running':
+ return 'Running';
+ case 'stale':
+ return 'Stale';
+ case 'never-succeeded':
+ return 'Never succeeded';
+ default:
+ return 'Unknown';
+ }
+}
+
+export function getRecoveryRollupInventoryStatusTextClass(
+ status: RecoveryRollupInventoryStatus,
+): string {
+ switch (status) {
+ case 'healthy':
+ return 'text-emerald-600 dark:text-emerald-400';
+ case 'warning':
+ case 'stale':
+ return 'text-amber-600 dark:text-amber-400';
+ case 'failed':
+ case 'never-succeeded':
+ return 'text-red-600 dark:text-red-400';
+ case 'running':
+ return 'text-blue-600 dark:text-blue-400';
+ default:
+ return 'text-muted';
+ }
+}
+
+export function getRecoveryRollupInventoryStatusVariant(
+ status: RecoveryRollupInventoryStatus,
+): 'success' | 'warning' | 'danger' | 'muted' {
+ switch (status) {
+ case 'healthy':
+ return 'success';
+ case 'warning':
+ case 'stale':
+ return 'warning';
+ case 'failed':
+ case 'never-succeeded':
+ return 'danger';
+ default:
+ return 'muted';
+ }
+}
+
export function getRecoverySpecialOutcomeTextClass(kind: 'never'): string {
if (kind === 'never') return 'text-amber-600 dark:text-amber-400';
return 'text-muted';
diff --git a/frontend-modern/src/utils/recoveryTablePresentation.ts b/frontend-modern/src/utils/recoveryTablePresentation.ts
index 8ce33dd282..2acd8d0161 100644
--- a/frontend-modern/src/utils/recoveryTablePresentation.ts
+++ b/frontend-modern/src/utils/recoveryTablePresentation.ts
@@ -35,6 +35,15 @@ export const RECOVERY_ARTIFACT_COLUMN_LABELS: Record<string, string> = {
platform: 'Platform',
};
+export type RecoveryRollupInventoryStatus =
+ | 'healthy'
+ | 'warning'
+ | 'failed'
+ | 'running'
+ | 'stale'
+ | 'never-succeeded'
+ | 'unknown';
+
const RECOVERY_ARTIFACT_COLUMN_SPECS: Record<string, { headerClass: string; minWidthPx: number }> = {
time: { headerClass: 'w-[76px] text-right', minWidthPx: 76 },
type: { headerClass: 'w-[96px] text-center', minWidthPx: 96 },
@@ -150,32 +159,54 @@ export function getRecoveryRollupIssueTone(
rollup: ProtectionRollup,
nowMs: number,
): RecoveryIssueTone {
- const outcome: RecoveryOutcome = normalizeRecoveryOutcome(rollup.lastOutcome);
- if (outcome === 'failed') return 'rose';
- if (outcome === 'running') return 'blue';
- if (outcome === 'warning' || isRecoveryRollupStale(rollup, nowMs)) return 'amber';
+ const status = getRecoveryRollupInventoryStatus(rollup, nowMs);
+ if (status === 'failed' || status === 'never-succeeded') return 'rose';
+ if (status === 'running') return 'blue';
+ if (status === 'warning' || status === 'stale') return 'amber';
return 'none';
}
-export function getRecoveryRollupInventoryPriority(
+export function getRecoveryRollupInventoryStatus(
rollup: ProtectionRollup,
nowMs: number = Date.now(),
-): number {
+): RecoveryRollupInventoryStatus {
const successMs = rollup.lastSuccessAt ? Date.parse(rollup.lastSuccessAt) : 0;
const attemptMs = rollup.lastAttemptAt ? Date.parse(rollup.lastAttemptAt) : 0;
const neverSucceeded =
(!Number.isFinite(successMs) || successMs <= 0) &&
Number.isFinite(attemptMs) &&
attemptMs > 0;
- const outcome = normalizeRecoveryOutcome(rollup.lastOutcome);
-
- if (neverSucceeded) return 6;
- if (outcome === 'failed') return 5;
- if (isRecoveryRollupStale(rollup, nowMs)) return 4;
- if (outcome === 'warning') return 3;
- if (outcome === 'running') return 2;
- if (outcome === 'success') return 1;
- return 0;
+ const outcome: RecoveryOutcome = normalizeRecoveryOutcome(rollup.lastOutcome);
+
+ if (neverSucceeded) return 'never-succeeded';
+ if (outcome === 'failed') return 'failed';
+ if (isRecoveryRollupStale(rollup, nowMs)) return 'stale';
+ if (outcome === 'warning') return 'warning';
+ if (outcome === 'running') return 'running';
+ if (outcome === 'success') return 'healthy';
+ return 'unknown';
+}
+
+export function getRecoveryRollupInventoryPriority(
+ rollup: ProtectionRollup,
+ nowMs: number = Date.now(),
+): number {
+ switch (getRecoveryRollupInventoryStatus(rollup, nowMs)) {
+ case 'never-succeeded':
+ return 6;
+ case 'failed':
+ return 5;
+ case 'stale':
+ return 4;
+ case 'warning':
+ return 3;
+ case 'running':
+ return 2;
+ case 'healthy':
+ return 1;
+ default:
+ return 0;
+ }
}
export function getRecoveryRollupAgeTextClass(