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.

feat(recovery): surface protected item coverage

rcourtman4c875e850388
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index e352ad9c51..7559561b6e 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -335,12 +335,13 @@ The summary remains additive to the inventory-first workflow rather than a
replacement for it: Proxmox-heavy operators still land on protected items by
default, but the first visible framing now reflects the whole multi-platform
recovery system instead of a single backup table metaphor.
-That same summary contract now also includes platform-coverage framing through
-`frontend-modern/src/utils/recoverySummaryPresentation.ts`, so the first
-visible recovery overview explicitly shows how many provider platforms are in
-scope, which provider families dominate the current protected set, and how
-many protected subjects already span multiple providers instead of leaving the
-multi-platform model implicit in row-level badges alone.
+That same summary contract now also includes platform- and item-coverage
+framing through `frontend-modern/src/utils/recoverySummaryPresentation.ts`, so
+the first visible recovery overview explicitly shows how many recovery
+platforms are in scope, which protected item types Pulse is covering, which
+platform families dominate the current protected set, and how many protected
+items already span multiple platforms instead of leaving the multi-platform
+model implicit in row-level badges alone.
The recovery table presentation helper now owns the canonical subject-type
label fallback for recovery rows and delegates its title-casing to the shared
`frontend-modern/src/utils/textPresentation.ts` helper rather than keeping a
diff --git a/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx b/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx
index 02da7653b3..8c201b9483 100644
--- a/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx
+++ b/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx
@@ -19,6 +19,7 @@ describe('RecoverySummary', () => {
lastOutcome: 'success',
lastSuccessAt: '2026-03-09T11:30:00Z',
providers: ['proxmox-pbs'],
+ display: { subjectType: 'proxmox-vm' },
},
{
rollupId: 'beta',
@@ -26,6 +27,7 @@ describe('RecoverySummary', () => {
lastAttemptAt: '2026-03-08T11:00:00Z',
lastSuccessAt: null,
providers: ['proxmox-pve'],
+ subjectRef: { type: 'truenas-dataset' },
},
]}
series={() => [
@@ -52,15 +54,17 @@ describe('RecoverySummary', () => {
expect(screen.getByTestId('recovery-summary')).toBeInTheDocument();
expect(screen.getByText('Recovery Posture')).toBeInTheDocument();
- expect(screen.getByText('Platform Coverage')).toBeInTheDocument();
+ expect(screen.getByText('Protected Footprint')).toBeInTheDocument();
expect(screen.getByText('Freshness')).toBeInTheDocument();
expect(screen.getByText('Recent History')).toBeInTheDocument();
expect(screen.getByText('Attention Queue')).toBeInTheDocument();
expect(screen.getByText('Recovery Points')).toBeInTheDocument();
expect(screen.getByText('Multi-platform')).toBeInTheDocument();
- expect(screen.getByText('Primary Platform')).toBeInTheDocument();
+ expect(screen.getAllByText('Item Types').length).toBeGreaterThan(0);
+ expect(screen.getByText('Primary Item')).toBeInTheDocument();
expect(screen.getByText('2 protected')).toBeInTheDocument();
expect(screen.getByText('2 platforms')).toBeInTheDocument();
+ expect(screen.getByText('2 item types')).toBeInTheDocument();
expect(screen.getByText('1 healthy')).toBeInTheDocument();
expect(screen.getByText('Never succeeded')).toBeInTheDocument();
});
diff --git a/frontend-modern/src/components/Recovery/RecoverySummary.tsx b/frontend-modern/src/components/Recovery/RecoverySummary.tsx
index 289318e5c7..827a388e35 100644
--- a/frontend-modern/src/components/Recovery/RecoverySummary.tsx
+++ b/frontend-modern/src/components/Recovery/RecoverySummary.tsx
@@ -5,6 +5,7 @@ import {
buildRecoveryActivitySummary,
buildRecoveryAttentionItems,
buildRecoveryFreshnessBuckets,
+ buildRecoveryItemCoverage,
buildRecoveryPlatformCoverage,
buildRecoveryPostureSegments,
buildRecoveryPostureSummary,
@@ -38,6 +39,7 @@ export const RecoverySummary: Component<RecoverySummaryProps> = (props) => {
const postureSummary = createMemo(() => buildRecoveryPostureSummary(props.rollups()));
const postureSegments = createMemo(() => buildRecoveryPostureSegments(props.rollups()));
const freshnessBuckets = createMemo(() => buildRecoveryFreshnessBuckets(props.rollups()));
+ const itemCoverage = createMemo(() => buildRecoveryItemCoverage(props.rollups()));
const platformCoverage = createMemo(() => buildRecoveryPlatformCoverage(props.rollups()));
const activity = createMemo(() => buildRecoveryActivitySummary(props.series()));
const attentionItems = createMemo(() => buildRecoveryAttentionItems(summary()));
@@ -56,6 +58,10 @@ export const RecoverySummary: Component<RecoverySummaryProps> = (props) => {
{platformCoverage().platformCount} platform
{platformCoverage().platformCount === 1 ? '' : 's'}
</span>
+ <span class="text-violet-300">
+ {itemCoverage().itemTypeCount} item type
+ {itemCoverage().itemTypeCount === 1 ? '' : 's'}
+ </span>
<span class="text-emerald-400">{healthyCount()} healthy</span>
<Show when={attentionCount() > 0}>
<span class="text-amber-300">{attentionCount()} attention</span>
@@ -132,41 +138,74 @@ export const RecoverySummary: Component<RecoverySummaryProps> = (props) => {
<section class="rounded-md border border-border bg-surface-hover/40 p-3">
<div class="text-[11px] font-semibold uppercase tracking-wide text-muted">
- Platform Coverage
+ Protected Footprint
</div>
- <div class="mt-3 grid gap-3 sm:grid-cols-3">
+ <div class="mt-3 grid gap-3 sm:grid-cols-2">
<div>
<div class="text-[10px] uppercase tracking-wide text-muted">Platforms</div>
<div class="mt-1 text-2xl font-semibold text-base-content">
{platformCoverage().platformCount}
</div>
</div>
+ <div>
+ <div class="text-[10px] uppercase tracking-wide text-muted">Item Types</div>
+ <div class="mt-1 text-2xl font-semibold text-base-content">
+ {itemCoverage().itemTypeCount}
+ </div>
+ </div>
<div>
<div class="text-[10px] uppercase tracking-wide text-muted">Multi-platform</div>
<div class="mt-1 text-2xl font-semibold text-base-content">
- {platformCoverage().mixedCount}
+ {platformCoverage().multiPlatformCount}
</div>
</div>
<div>
- <div class="text-[10px] uppercase tracking-wide text-muted">Primary Platform</div>
+ <div class="text-[10px] uppercase tracking-wide text-muted">Primary Item</div>
<div class="mt-1 text-xl font-semibold text-base-content">
- {platformCoverage().primaryLabel ?? 'n/a'}
+ {itemCoverage().primaryLabel ?? 'n/a'}
</div>
</div>
</div>
- <div class="mt-4 flex flex-wrap gap-2">
- <For each={platformCoverage().items.slice(0, 6)}>
- {(item) => (
- <div class="inline-flex items-center gap-2 rounded-md border border-border-subtle bg-surface/60 px-2.5 py-1.5 text-xs">
- <span class={`rounded px-1.5 py-0.5 text-[10px] font-medium ${item.toneClass}`}>
- {item.label}
- </span>
- <span class="tabular-nums text-base-content">{item.count}</span>
- <span class="text-muted">{item.percent}%</span>
+ <div class="mt-4 space-y-3">
+ <Show when={itemCoverage().items.length > 0}>
+ <div>
+ <div class="mb-2 text-[10px] font-semibold uppercase tracking-wide text-muted">
+ Item Types
</div>
- )}
- </For>
+ <div class="flex flex-wrap gap-2">
+ <For each={itemCoverage().items.slice(0, 6)}>
+ {(item) => (
+ <div class="inline-flex items-center gap-2 rounded-md border border-border-subtle bg-surface/60 px-2.5 py-1.5 text-xs">
+ <span class={`rounded px-1.5 py-0.5 text-[10px] font-medium ${item.toneClass}`}>
+ {item.label}
+ </span>
+ <span class="tabular-nums text-base-content">{item.count}</span>
+ <span class="text-muted">{item.percent}%</span>
+ </div>
+ )}
+ </For>
+ </div>
+ </div>
+ </Show>
+ <div>
+ <div class="mb-2 text-[10px] font-semibold uppercase tracking-wide text-muted">
+ Platforms
+ </div>
+ <div class="flex flex-wrap gap-2">
+ <For each={platformCoverage().items.slice(0, 6)}>
+ {(item) => (
+ <div class="inline-flex items-center gap-2 rounded-md border border-border-subtle bg-surface/60 px-2.5 py-1.5 text-xs">
+ <span class={`rounded px-1.5 py-0.5 text-[10px] font-medium ${item.toneClass}`}>
+ {item.label}
+ </span>
+ <span class="tabular-nums text-base-content">{item.count}</span>
+ <span class="text-muted">{item.percent}%</span>
+ </div>
+ )}
+ </For>
+ </div>
+ </div>
</div>
</section>
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index c4d3898d26..d66a9ef73e 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -23,6 +23,7 @@ const rollupsPayload = [
{
rollupId: 'res:vm-123',
subjectResourceId: 'vm-123',
+ display: { subjectType: 'proxmox-vm' },
lastAttemptAt: '2026-02-14T10:00:00.000Z',
lastSuccessAt: '2026-02-14T10:00:00.000Z',
lastOutcome: 'success',
@@ -283,6 +284,7 @@ describe('Recovery', () => {
render(() => <Recovery />);
expect(await screen.findByText('2 platforms')).toBeInTheDocument();
+ expect(screen.getByText('2 item types')).toBeInTheDocument();
expect(screen.getByText('Multi-platform')).toBeInTheDocument();
});
diff --git a/frontend-modern/src/utils/__tests__/recoverySummaryPresentation.test.ts b/frontend-modern/src/utils/__tests__/recoverySummaryPresentation.test.ts
index 1f70bbd934..c074c7d478 100644
--- a/frontend-modern/src/utils/__tests__/recoverySummaryPresentation.test.ts
+++ b/frontend-modern/src/utils/__tests__/recoverySummaryPresentation.test.ts
@@ -3,6 +3,7 @@ import {
buildRecoveryActivitySummary,
buildRecoveryAttentionItems,
buildRecoveryFreshnessBuckets,
+ buildRecoveryItemCoverage,
buildRecoveryOutcomeSegments,
buildRecoveryPlatformCoverage,
buildRecoveryPostureSegments,
@@ -98,7 +99,7 @@ describe('recoverySummaryPresentation', () => {
]);
});
- it('builds provider coverage from rollups and mixed-provider subjects', () => {
+ it('builds platform coverage from rollups and multi-platform protected items', () => {
const coverage = buildRecoveryPlatformCoverage([
{ rollupId: 'a', providers: ['proxmox-pbs'] },
{ rollupId: 'b', providers: ['proxmox-pve', 'kubernetes'] },
@@ -106,7 +107,7 @@ describe('recoverySummaryPresentation', () => {
]);
expect(coverage.platformCount).toBe(4);
- expect(coverage.mixedCount).toBe(1);
+ expect(coverage.multiPlatformCount).toBe(1);
expect(coverage.primaryLabel).toBe('K8s');
expect(coverage.items).toMatchObject([
{ key: 'kubernetes', label: 'K8s', count: 1, percent: 33 },
@@ -116,6 +117,23 @@ describe('recoverySummaryPresentation', () => {
]);
});
+ it('builds protected item coverage from normalized recovery subject types', () => {
+ const coverage = buildRecoveryItemCoverage([
+ { rollupId: 'a', display: { subjectType: 'proxmox-vm' } },
+ { rollupId: 'b', display: { subjectType: 'proxmox-vm-backup' } },
+ { rollupId: 'c', subjectRef: { type: 'truenas-dataset' } },
+ { rollupId: 'd', subjectRef: { type: 'k8s-pvc' } },
+ ]);
+
+ expect(coverage.itemTypeCount).toBe(3);
+ expect(coverage.primaryLabel).toBe('VM');
+ expect(coverage.items).toMatchObject([
+ { key: 'vm', label: 'VM', count: 2, percent: 50 },
+ { label: 'Dataset', count: 1, percent: 25 },
+ { label: 'PVC', count: 1, percent: 25 },
+ ]);
+ });
+
it('summarizes activity bars and headline metrics', () => {
const activity = buildRecoveryActivitySummary([
{ day: '2026-03-07', total: 0, snapshot: 0, local: 0, remote: 0 },
diff --git a/frontend-modern/src/utils/recoverySummaryPresentation.ts b/frontend-modern/src/utils/recoverySummaryPresentation.ts
index c50a4d19d8..541df7eb87 100644
--- a/frontend-modern/src/utils/recoverySummaryPresentation.ts
+++ b/frontend-modern/src/utils/recoverySummaryPresentation.ts
@@ -11,6 +11,12 @@ import {
getSourcePlatformPresentation,
normalizeSourcePlatformQueryValue,
} from '@/utils/sourcePlatforms';
+import { getResourceTypePresentation } from '@/utils/resourceTypePresentation';
+import {
+ getWorkloadTypePresentation,
+ normalizeWorkloadTypePresentationKey,
+} from '@/utils/workloadTypePresentation';
+import { titleCaseDelimitedLabel } from '@/utils/textPresentation';
export const RECOVERY_SUMMARY_TIME_RANGES = ['7d', '30d', '90d', '365d'] as const;
@@ -114,11 +120,25 @@ export interface RecoveryPlatformCoverageItem {
export interface RecoveryPlatformCoverageSummary {
platformCount: number;
- mixedCount: number;
+ multiPlatformCount: number;
primaryLabel: string | null;
items: RecoveryPlatformCoverageItem[];
}
+export interface RecoveryItemCoverageItem {
+ key: string;
+ label: string;
+ count: number;
+ percent: number;
+ toneClass: string;
+}
+
+export interface RecoveryItemCoverageSummary {
+ itemTypeCount: number;
+ primaryLabel: string | null;
+ items: RecoveryItemCoverageItem[];
+}
+
export function getRecoveryAttentionChipClass(
tone: RecoveryAttentionItem['tone'],
): string {
@@ -158,6 +178,77 @@ const formatShortDate = (value: string): string => {
return date.toLocaleDateString([], { month: 'short', day: 'numeric' });
};
+const DEFAULT_RECOVERY_ITEM_TONE =
+ 'bg-surface-alt text-base-content dark:bg-surface-alt dark:text-base-content';
+
+const normalizeRecoverySummarySubjectTypeKey = (value: string): string =>
+ value
+ .replace(/^k8s-/, '')
+ .replace(/^proxmox-/, '')
+ .replace(/^truenas-/, '');
+
+const normalizeRecoverySummaryWorkloadType = (
+ value: string,
+): Parameters<typeof getWorkloadTypePresentation>[0] => {
+ const normalized = normalizeRecoverySummarySubjectTypeKey(value.trim().toLowerCase());
+ switch (normalized) {
+ case 'lxc':
+ case 'ct':
+ case 'container':
+ return 'system-container';
+ case 'vm-backup':
+ return 'vm';
+ default:
+ return normalized;
+ }
+};
+
+const getRecoverySummarySubjectTypePresentation = (
+ value: string | null | undefined,
+): { key: string; label: string; toneClass: string } | null => {
+ const raw = String(value || '').trim().toLowerCase();
+ if (!raw) return null;
+
+ const workloadType = normalizeRecoverySummaryWorkloadType(raw);
+ if (normalizeWorkloadTypePresentationKey(workloadType)) {
+ const presentation = getWorkloadTypePresentation(workloadType);
+ return {
+ key: String(workloadType),
+ label: presentation.label,
+ toneClass: presentation.className,
+ };
+ }
+
+ const normalized = normalizeRecoverySummarySubjectTypeKey(raw);
+ const normalizedPresentation = normalized ? getResourceTypePresentation(normalized) : null;
+ if (normalizedPresentation && normalizedPresentation.label !== normalized) {
+ return {
+ key: normalized,
+ label: normalizedPresentation.label,
+ toneClass: normalizedPresentation.badgeClasses,
+ };
+ }
+
+ const rawPresentation = getResourceTypePresentation(raw);
+ if (rawPresentation && rawPresentation.label !== raw) {
+ return {
+ key: normalized || raw,
+ label: rawPresentation.label,
+ toneClass: rawPresentation.badgeClasses,
+ };
+ }
+
+ const fallbackKey = normalized || raw;
+ return {
+ key: fallbackKey,
+ label: titleCaseDelimitedLabel(fallbackKey, {
+ fallback: 'Unknown',
+ preserveShortAllCaps: true,
+ }),
+ toneClass: DEFAULT_RECOVERY_ITEM_TONE,
+ };
+};
+
const toPercent = (count: number, total: number): number =>
total > 0 ? Math.round((count / total) * 100) : 0;
@@ -351,7 +442,7 @@ export function buildRecoveryPlatformCoverage(
rollups: ProtectionRollup[],
): RecoveryPlatformCoverageSummary {
const counts = new Map<string, number>();
- let mixedCount = 0;
+ let multiPlatformCount = 0;
for (const rollup of rollups) {
const providers = Array.from(
@@ -362,7 +453,7 @@ export function buildRecoveryPlatformCoverage(
),
);
const resolvedProviders = providers.length > 0 ? providers : ['generic'];
- if (resolvedProviders.length > 1) mixedCount += 1;
+ if (resolvedProviders.length > 1) multiPlatformCount += 1;
for (const provider of resolvedProviders) {
counts.set(provider, (counts.get(provider) || 0) + 1);
@@ -388,7 +479,50 @@ export function buildRecoveryPlatformCoverage(
return {
platformCount: items.length,
- mixedCount,
+ multiPlatformCount,
+ primaryLabel: items[0]?.label || null,
+ items,
+ };
+}
+
+export function buildRecoveryItemCoverage(
+ rollups: ProtectionRollup[],
+): RecoveryItemCoverageSummary {
+ const counts = new Map<string, RecoveryItemCoverageItem>();
+
+ for (const rollup of rollups) {
+ const presentation =
+ getRecoverySummarySubjectTypePresentation(
+ String(rollup.display?.subjectType || rollup.subjectRef?.type || '').trim(),
+ ) || {
+ key: 'unknown',
+ label: 'Unknown',
+ toneClass: DEFAULT_RECOVERY_ITEM_TONE,
+ };
+
+ const existing = counts.get(presentation.key);
+ if (existing) {
+ existing.count += 1;
+ existing.percent = toPercent(existing.count, rollups.length);
+ continue;
+ }
+
+ counts.set(presentation.key, {
+ ...presentation,
+ count: 1,
+ percent: toPercent(1, rollups.length),
+ });
+ }
+
+ const items = Array.from(counts.values()).sort((left, right) => {
+ if (left.count !== right.count) return right.count - left.count;
+ if (left.key === 'unknown' && right.key !== 'unknown') return 1;
+ if (right.key === 'unknown' && left.key !== 'unknown') return -1;
+ return left.label.localeCompare(right.label);
+ });
+
+ return {
+ itemTypeCount: items.length,
primaryLabel: items[0]?.label || null,
items,
};