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): default inventory to attention-first triage

rcourtman0fca1dd438c5
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 71eed7dc56..66c8bf8b61 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -781,6 +781,10 @@ scan pattern in its first column. Protected-item rows should lead with a clear
status cue, the primary item name, and compact badge-backed item/platform
context instead of relying on recovery-only rails or plain-text metadata lines
that make the table read like a report instead of an operational grid.
+That same triage rule applies to the default inventory sort. The protected
+items workspace should open with attention-state rollups first instead of
+defaulting to newest-successful backups, so operators land on failed,
+never-succeeded, stale, warning, and running items before the healthy catalog.
That same row contract should avoid duplicating context that already has a
dedicated column. When `Item Type` and `Platform` columns are visible, the
primary item cell should not restate those same badges on desktop; duplicate
diff --git a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
index e942eb5292..7796fd75af 100644
--- a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
@@ -32,9 +32,11 @@ import {
import {
getRecoveryArtifactColumnLabel,
getRecoveryArtifactMetadataTextClass,
+ getRecoveryRollupInventoryPriority,
getRecoveryRollupAgeTextClass,
getRecoveryProtectedSearchPlaceholder,
getRecoverySearchHistoryEmptyMessage,
+ getRecoveryRollupTimestampMs,
isRecoveryRollupStale,
} from '@/utils/recoveryTablePresentation';
import {
@@ -94,7 +96,7 @@ export const RecoveryProtectedInventorySection: Component<
> = (props) => {
const [protectedFiltersOpen, setProtectedFiltersOpen] = createSignal(false);
const [protectedPage, setProtectedPage] = createSignal(1);
- const [protectedSortCol, setProtectedSortCol] = createSignal<ProtectedSortCol>('lastBackup');
+ const [protectedSortCol, setProtectedSortCol] = createSignal<ProtectedSortCol>('outcome');
const [protectedSortDir, setProtectedSortDir] = createSignal<SortDir>('desc');
const toggleProtectedSort = (col: ProtectedSortCol) => {
@@ -152,9 +154,28 @@ export const RecoveryProtectedInventorySection: Component<
return multiplier * (leftSuccess - rightSuccess);
}
case 'outcome': {
+ const leftPriority = getRecoveryRollupInventoryPriority(left);
+ const rightPriority = getRecoveryRollupInventoryPriority(right);
+ if (leftPriority !== rightPriority) {
+ return multiplier * (leftPriority - rightPriority);
+ }
+
+ const leftTimestamp = getRecoveryRollupTimestampMs(left);
+ const rightTimestamp = getRecoveryRollupTimestampMs(right);
+ const naturalTieBreak =
+ leftPriority === 4
+ ? leftTimestamp - rightTimestamp
+ : rightTimestamp - leftTimestamp;
+ if (naturalTieBreak !== 0) return multiplier * naturalTieBreak;
+
const leftOutcome = normalizeRecoveryOutcome(left.lastOutcome);
const rightOutcome = normalizeRecoveryOutcome(right.lastOutcome);
- return multiplier * leftOutcome.localeCompare(rightOutcome);
+ const outcomeCmp = leftOutcome.localeCompare(rightOutcome);
+ if (outcomeCmp !== 0) return multiplier * outcomeCmp;
+
+ const leftLabel = getRecoveryRollupItemLabel(left, resourceIndex).toLowerCase();
+ const rightLabel = getRecoveryRollupItemLabel(right, resourceIndex).toLowerCase();
+ return multiplier * leftLabel.localeCompare(rightLabel);
}
default:
return 0;
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index 3643892056..a2cfbd2486 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -267,6 +267,10 @@ describe('Recovery', () => {
expect(within(inventoryTable).queryByText('PLATFORM')).not.toBeInTheDocument();
expect(inventoryBody?.className).toContain('divide-y');
expect(inventoryBody?.className).toContain('divide-border');
+ 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(inventoryTable).getAllByText('VM').length).toBeGreaterThan(0);
const vmRow = screen.getByText('VM 123').closest('tr');
expect(vmRow).not.toBeNull();
diff --git a/frontend-modern/src/utils/recoveryTablePresentation.ts b/frontend-modern/src/utils/recoveryTablePresentation.ts
index 92bc5ef962..8ce33dd282 100644
--- a/frontend-modern/src/utils/recoveryTablePresentation.ts
+++ b/frontend-modern/src/utils/recoveryTablePresentation.ts
@@ -157,6 +157,27 @@ export function getRecoveryRollupIssueTone(
return 'none';
}
+export function getRecoveryRollupInventoryPriority(
+ rollup: ProtectionRollup,
+ nowMs: number = Date.now(),
+): number {
+ 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;
+}
+
export function getRecoveryRollupAgeTextClass(
rollup: ProtectionRollup,
nowMs: number,