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.

Restore host backup coverage targets

rcourtman6140837dcf0b
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
index 0c6f0048dc..79d8331ad7 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
@@ -60,7 +60,7 @@ import { ProxmoxRecoverableTable } from './ProxmoxRecoverableTable';
// One backups surface, two operator views: a chronological recoverable-artifact
// feed for "what ran when", and a guest coverage table for "what is protected".
-type BackupView = 'date' | 'guest';
+type BackupView = 'date' | 'coverage';
async function fetchPVEBackups(): Promise<PVEBackupsPayload> {
const response = await apiFetch('/api/backups/pve');
@@ -138,8 +138,8 @@ export const ProxmoxBackupsTable: Component<{
const [expandedCoverageRows, setExpandedCoverageRows] = createSignal<ReadonlySet<string>>(
new Set<string>(),
);
- // Orphaned backups (records whose guest no longer exists in inventory) are
- // collapsed by default so the main table is the user's live guests, not a
+ // Orphaned backups (VM/CT records whose guest no longer exists in inventory)
+ // are collapsed by default so the main table is active backup targets, not a
// pile of nameless dead records sorted to the top.
const [showOrphaned, setShowOrphaned] = createSignal(false);
@@ -268,9 +268,10 @@ export const ProxmoxBackupsTable: Component<{
return list;
});
- // The main table is the user's live inventory guests; orphaned backup records
- // (guest no longer exists) are partitioned out into their own collapsed
- // section so they don't dominate the top of the list with nameless rows.
+ // The main table is the user's active backup targets: live inventory guests
+ // plus first-class host backups. Orphaned VM/CT backup records are partitioned
+ // out into their own collapsed section so they don't dominate the top of the
+ // list with nameless rows.
const liveCoverageRows = createMemo(() =>
filteredCoverageRows().filter((row) => !row.isOrphaned),
);
@@ -285,8 +286,8 @@ export const ProxmoxBackupsTable: Component<{
() => recoveryModel().coverageRows.filter((row) => row.isOrphaned).length,
);
- // Health strip counts live guests only — orphaned records are all stale and
- // would otherwise inflate the "attention" segment with dead data.
+ // Health strip counts active backup targets only — orphaned records are all
+ // stale and would otherwise inflate the "attention" segment with dead data.
const liveHealthSummary = createMemo(() => {
const live = recoveryModel().coverageRows.filter((row) => !row.isOrphaned);
return {
@@ -472,11 +473,11 @@ export const ProxmoxBackupsTable: Component<{
</Show>
<Show
- when={view() === 'guest'}
+ when={view() === 'coverage'}
fallback={
<div class="flex flex-wrap items-center gap-x-2 gap-y-1 px-1 text-[11px] text-muted">
<span class="font-semibold uppercase tracking-[0.18em]">Backup health</span>
- <span class="text-base-content tabular-nums">{liveTotalCount()} guests</span>
+ <span class="text-base-content tabular-nums">{liveTotalCount()} targets</span>
<span aria-hidden="true">·</span>
<span class="tabular-nums">
{recoveryModel().coverageSummary.recoverableArtifacts} restore points
@@ -498,7 +499,7 @@ export const ProxmoxBackupsTable: Component<{
title="Backup health"
tail={
<span>
- {liveTotalCount()} guests · {recoveryModel().coverageSummary.recoverableArtifacts}{' '}
+ {liveTotalCount()} targets · {recoveryModel().coverageSummary.recoverableArtifacts}{' '}
restore points
<Show when={recoveryModel().coverageSummary.withPBS > 0}>
{' · '}
@@ -551,12 +552,12 @@ export const ProxmoxBackupsTable: Component<{
</button>
<button
type="button"
- class={viewButtonClass(view() === 'guest')}
- aria-pressed={view() === 'guest'}
- onClick={() => setView('guest')}
+ class={viewButtonClass(view() === 'coverage')}
+ aria-pressed={view() === 'coverage'}
+ onClick={() => setView('coverage')}
>
<ShieldCheckIcon class="h-4 w-4" aria-hidden="true" />
- <span>By guest</span>
+ <span>Coverage</span>
</button>
</div>
@@ -612,9 +613,9 @@ export const ProxmoxBackupsTable: Component<{
fallback={
<Show
when={visibleLiveCount() !== liveTotalCount()}
- fallback={<>{liveTotalCount()} guests</>}
+ fallback={<>{liveTotalCount()} targets</>}
>
- {visibleLiveCount()} of {liveTotalCount()} guests
+ {visibleLiveCount()} of {liveTotalCount()} targets
</Show>
}
>
@@ -644,13 +645,13 @@ export const ProxmoxBackupsTable: Component<{
/>
</Show>
- <Show when={view() === 'guest'}>
+ <Show when={view() === 'coverage'}>
<ProxmoxCoverageTable
rows={liveCoverageRows()}
hasAnyRows={liveTotalCount() > 0}
emptyIcon={props.emptyIcon}
- emptyTitle="No workload coverage"
- emptyDescription="VM and container restore posture will appear here once backup data exists."
+ emptyTitle="No backup target coverage"
+ emptyDescription="VM, container, and host restore posture will appear here once backup data exists."
sortKey={coverageSortKey}
sortDirection={coverageSortDirection}
onSort={handleCoverageSort}
diff --git a/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx
index 670038c7e1..0fafac8467 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx
@@ -32,6 +32,7 @@ import {
ArtifactSourceBadge,
ArtifactStateBadge,
SortableHead,
+ WorkloadTypeBadge,
artifactStateLabel,
} from './proxmoxBackupsTableShared';
@@ -88,7 +89,8 @@ export function ProxmoxCoverageTable(props: {
// empty fleet-wide, and table-fixed re-normalizes the rest.
const visibleColumns = () => [
{ id: 'workload', weight: 17 },
- { id: 'vmid', weight: 7 },
+ { id: 'type', weight: 7 },
+ { id: 'id', weight: 9 },
{ id: 'node', weight: 11 },
{ id: 'posture', weight: 11 },
{ id: 'latest', weight: 13 },
@@ -139,7 +141,8 @@ export function ProxmoxCoverageTable(props: {
align="left"
headClass={getPlatformTableHeadClassForKind('name')}
/>
- <TableHead class={getPlatformTableHeadClassForKind('numeric-value')}>VMID</TableHead>
+ <TableHead class={getPlatformTableHeadClassForKind('text')}>Type</TableHead>
+ <TableHead class={getPlatformTableHeadClassForKind('text')}>ID</TableHead>
<TableHead class={getPlatformTableHeadClassForKind('text')}>Node</TableHead>
<SortableHead
label="Posture"
@@ -240,7 +243,15 @@ export function ProxmoxCoverageTable(props: {
</div>
</TableCell>
<TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} text-muted font-mono text-[11px] tabular-nums`}
+ class={`${getPlatformTableCellClassForKind('text')} text-base-content`}
+ >
+ <WorkloadTypeBadge
+ type={row.workload.type}
+ label={row.workload.typeLabel}
+ />
+ </TableCell>
+ <TableCell
+ class={`${getPlatformTableCellClassForKind('text')} text-muted font-mono text-[11px] tabular-nums`}
>
{row.workload.vmid || '—'}
</TableCell>
diff --git a/frontend-modern/src/features/proxmox/ProxmoxRecoverableTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxRecoverableTable.tsx
index d4a393dcac..7fa474506c 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxRecoverableTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxRecoverableTable.tsx
@@ -31,13 +31,14 @@ import {
ArtifactStateBadge,
RowMetricBar,
SortableHead,
+ WorkloadTypeBadge,
artifactStateLabel,
} from './proxmoxBackupsTableShared';
// Flat recoverable-artifact table. Parent state owns filtering, sorting, and
// date/source facets; optional day grouping is presentation only.
-const COLUMN_COUNT = 8;
+const COLUMN_COUNT = 9;
interface DayGroup {
key: string;
@@ -89,8 +90,11 @@ export function ProxmoxRecoverableTable(props: {
</div>
</div>
</TableCell>
+ <TableCell class={`${getPlatformTableCellClassForKind('text')} text-base-content`}>
+ <WorkloadTypeBadge type={artifact.workload.type} label={artifact.workload.typeLabel} />
+ </TableCell>
<TableCell
- class={`${getPlatformTableCellClassForKind('numeric-value')} text-muted font-mono text-[11px] tabular-nums`}
+ class={`${getPlatformTableCellClassForKind('text')} text-muted font-mono text-[11px] tabular-nums`}
>
{artifact.workload.vmid || '—'}
</TableCell>
@@ -155,17 +159,18 @@ export function ProxmoxRecoverableTable(props: {
}
>
<TableCard class={PLATFORM_TABLE_CARD_CLASS}>
- <Table class="min-w-[1000px] table-fixed text-xs">
+ <Table class="min-w-[1080px] table-fixed text-xs">
{/* Keep column widths stable; long locations/details truncate with title text. */}
<colgroup>
- <col style={{ width: '20%' }} />
+ <col style={{ width: '17%' }} />
<col style={{ width: '7%' }} />
<col style={{ width: '8%' }} />
- <col style={{ width: '15%' }} />
+ <col style={{ width: '8%' }} />
+ <col style={{ width: '14%' }} />
<col style={{ width: '11%' }} />
+ <col style={{ width: '13%' }} />
+ <col style={{ width: '8%' }} />
<col style={{ width: '14%' }} />
- <col style={{ width: '10%' }} />
- <col style={{ width: '15%' }} />
</colgroup>
<TableHeader>
<TableRow class={PLATFORM_TABLE_HEADER_ROW_CLASS}>
@@ -178,7 +183,8 @@ export function ProxmoxRecoverableTable(props: {
align="left"
headClass={getPlatformTableHeadClassForKind('name')}
/>
- <TableHead class={getPlatformTableHeadClassForKind('numeric-value')}>VMID</TableHead>
+ <TableHead class={getPlatformTableHeadClassForKind('text')}>Type</TableHead>
+ <TableHead class={getPlatformTableHeadClassForKind('text')}>ID</TableHead>
<SortableHead
label="Source"
sortKey="source"
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
index 86b990ec5c..f8d5e3d621 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupsTable.test.tsx
@@ -142,6 +142,7 @@ describe('ProxmoxBackupsTable', () => {
expect((await screen.findAllByText('pbs-docker')).length).toBeGreaterThan(1);
expect(screen.getByRole('columnheader', { name: /location/i })).toBeInTheDocument();
expect(screen.getByRole('columnheader', { name: /source/i })).toBeInTheDocument();
+ expect(screen.getByRole('columnheader', { name: /type/i })).toBeInTheDocument();
expect(screen.getAllByText('PBS').length).toBeGreaterThan(0);
expect(screen.getByText('main / minipc')).toBeInTheDocument();
expect(
@@ -153,7 +154,7 @@ describe('ProxmoxBackupsTable', () => {
expect(apiFetchMock).toHaveBeenCalledWith('/api/backups/pve');
});
- it('offers By date / By guest views and no legacy sub-tab tree', async () => {
+ it('offers By date / Coverage views and no legacy sub-tab tree', async () => {
mockBackupAPIs();
renderInRouter(() => (
@@ -164,14 +165,14 @@ describe('ProxmoxBackupsTable', () => {
// The two top-level views exist...
expect(screen.getByRole('button', { name: /by date/i })).toBeInTheDocument();
- expect(screen.getByRole('button', { name: /by guest/i })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: /coverage/i })).toBeInTheDocument();
// ...and the old four-tab + sub-tab tree does not.
expect(screen.queryByRole('button', { name: /source details/i })).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: /job history/i })).not.toBeInTheDocument();
expect(screen.queryByRole('button', { name: /pbs artifacts/i })).not.toBeInTheDocument();
});
- it('switches to By guest showing posture, and keeps per-source evidence in the row expansion', async () => {
+ it('switches to Coverage showing posture, and keeps per-source evidence in the row expansion', async () => {
mockBackupAPIs();
renderInRouter(() => (
@@ -179,9 +180,9 @@ describe('ProxmoxBackupsTable', () => {
));
await screen.findAllByText('pbs-docker');
- await fireEvent.click(screen.getByRole('button', { name: /by guest/i }));
+ await fireEvent.click(screen.getByRole('button', { name: /coverage/i }));
- // By guest is the coverage/posture view; the workload's recent backup reads
+ // Coverage is the posture view; the workload's recent backup reads
// "Current".
expect(screen.getByRole('columnheader', { name: /posture/i })).toBeInTheDocument();
expect(screen.getAllByText('Current').length).toBeGreaterThan(0);
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxCoverageTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxCoverageTable.test.tsx
index 7b174b8e63..dc5205e906 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxCoverageTable.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxCoverageTable.test.tsx
@@ -54,7 +54,8 @@ describe('ProxmoxCoverageTable column visibility', () => {
const headers = headerTexts();
// Always-on columns.
expect(headers).toContain('Workload');
- expect(headers).toContain('VMID');
+ expect(headers).toContain('Type');
+ expect(headers).toContain('ID');
expect(headers).toContain('Node');
// Source columns gate on their flags.
expect(headers).toContain('PBS');
diff --git a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts
index cfba6a94d7..02db1b8f36 100644
--- a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts
+++ b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts
@@ -173,7 +173,7 @@ describe('proxmoxBackupRecoveryModel', () => {
expect(orphan?.workload.label).toBe('CT 999');
});
- it('keeps host and zero-id artifacts out of guest coverage and orphan counts', () => {
+ it('keeps host backups in coverage without counting zero-id aggregate artifacts as guests', () => {
const model = buildProxmoxBackupRecoveryModel({
workloads: [],
pbsBackups: [
@@ -204,8 +204,14 @@ describe('proxmoxBackupRecoveryModel', () => {
});
expect(model.recoverableArtifacts).toHaveLength(3);
- expect(model.coverageRows).toHaveLength(0);
- expect(model.coverageSummary.totalWorkloads).toBe(0);
+ expect(model.coverageRows).toHaveLength(1);
+ expect(model.coverageSummary.totalWorkloads).toBe(1);
+ expect(model.coverageRows[0].isOrphaned).toBe(false);
+ expect(model.coverageRows[0].workload.type).toBe('host');
+ expect(model.coverageRows[0].workload.vmid).toBe('mail-gateway');
+ expect(model.coverageRows[0].workload.label).toBe('Host mail-gateway');
+ expect(model.coverageRows[0].pbsCount).toBe(1);
+ expect(model.coverageRows[0].archiveCount).toBe(1);
expect(model.recoverableArtifacts.map((artifact) => artifact.workload.label)).toEqual(
expect.arrayContaining(['CT backup', 'Host mail-gateway']),
);
diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts b/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts
index 53ec326b5e..41b3318e38 100644
--- a/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts
+++ b/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts
@@ -63,10 +63,9 @@ export interface WorkloadCoverageRow {
snapshotCount: number;
posture: WorkloadRecoveryPosture;
postureRank: number;
- // True when this row exists only because a backup/task referenced a VMID with
- // no matching live inventory guest — i.e. an orphaned backup for a guest that
- // no longer exists. Live guests carry a `resource:` key; orphans carry a
- // `backup:` key and have no real name (label falls back to "CT <vmid>").
+ // True only when a VM/CT row exists because a backup/task referenced a VMID
+ // with no matching live inventory guest. Host backups can also carry a
+ // `backup:` key, but they are first-class backup targets, not orphaned guests.
isOrphaned: boolean;
}
@@ -135,21 +134,31 @@ function typeLabel(type: WorkloadReference['type']): string {
return 'Guest';
}
-function workloadFallbackLabel(
+function firstHostHint(hints: readonly (string | undefined)[]): string | undefined {
+ return hints
+ .map((hint) => hint?.trim())
+ .find((hint) => hint && normalizeKey(hint) !== 'root' && normalizeKey(hint) !== '(root)');
+}
+
+function fallbackWorkloadId(
type: WorkloadReference['type'],
vmid: string,
- hints: readonly (string | undefined)[] = [],
+ hints: readonly (string | undefined)[],
): string {
- const label = typeLabel(type);
const cleanVmid = vmid.trim();
if (type === 'host') {
- if (cleanVmid && !isZeroWorkloadId(cleanVmid)) return `${label} ${cleanVmid}`;
- const hintLabel = hints
- .map((hint) => hint?.trim())
- .find((hint) => hint && normalizeKey(hint) !== 'root' && normalizeKey(hint) !== '(root)');
- return hintLabel ? `${label} ${hintLabel}` : 'Host backup';
+ if (cleanVmid && !isZeroWorkloadId(cleanVmid)) return cleanVmid;
+ return firstHostHint(hints) ?? '';
}
- if (cleanVmid && !isZeroWorkloadId(cleanVmid)) return `${label} ${cleanVmid}`;
+ if (cleanVmid && !isZeroWorkloadId(cleanVmid)) return cleanVmid;
+ return '';
+}
+
+function workloadFallbackLabel(type: WorkloadReference['type'], id: string): string {
+ const label = typeLabel(type);
+ const cleanId = id.trim();
+ if (cleanId) return `${label} ${cleanId}`;
+ if (type === 'host') return 'Host backup';
return type === 'unknown' ? label : `${label} backup`;
}
@@ -223,23 +232,24 @@ function fallbackWorkload(
vmid: string,
hints: readonly (string | undefined)[],
): WorkloadReference {
+ const id = fallbackWorkloadId(type, vmid, hints);
const scope = hints.map(normalizeKey).find(Boolean) || 'unknown';
+ const keyScope = type === 'host' && id ? 'host' : scope;
return {
- key: `backup:${type}:${vmid || 'unknown'}:${scope}`,
+ key: `backup:${type}:${id || 'unknown'}:${keyScope}`,
type,
typeLabel: typeLabel(type),
- vmid,
- label: workloadFallbackLabel(type, vmid, hints),
- node: hints.find((hint) => !!hint?.trim()),
+ vmid: id,
+ label: workloadFallbackLabel(type, id),
+ node: type === 'host' ? undefined : hints.find((hint) => !!hint?.trim()),
};
}
function isCoverageWorkload(workload: WorkloadReference): boolean {
- return (
- (workload.type === 'vm' || workload.type === 'ct') &&
- Boolean(workload.vmid.trim()) &&
- !isZeroWorkloadId(workload.vmid)
- );
+ if (workload.type === 'vm' || workload.type === 'ct') {
+ return Boolean(workload.vmid.trim()) && !isZeroWorkloadId(workload.vmid);
+ }
+ return workload.type === 'host' && Boolean(workload.vmid.trim());
}
function resolveWorkload(
@@ -534,7 +544,9 @@ export function buildProxmoxBackupRecoveryModel(
...row,
posture: posture.posture,
postureRank: posture.rank,
- isOrphaned: !row.key.startsWith('resource:'),
+ isOrphaned:
+ !row.key.startsWith('resource:') &&
+ (row.workload.type === 'vm' || row.workload.type === 'ct'),
};
});
diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx b/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx
index 7f3523600b..defce6bbef 100644
--- a/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx
+++ b/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx
@@ -6,7 +6,7 @@ import { type FilterOption } from '@/components/shared/FilterButtonGroup';
import { ProgressBar } from '@/components/shared/ProgressBar';
import { TableHead } from '@/components/shared/Table';
-import type { RecoverableArtifact } from './proxmoxBackupRecoveryModel';
+import type { RecoverableArtifact, WorkloadReference } from './proxmoxBackupRecoveryModel';
import type {
CoverageFilterValue,
RecoverableFilterValue,
@@ -175,6 +175,31 @@ export function ArtifactSourceBadge(props: { artifact: RecoverableArtifact }) {
);
}
+export function WorkloadTypeBadge(props: {
+ type: WorkloadReference['type'];
+ label: string;
+}) {
+ const badgeClass = () => {
+ if (props.type === 'host') {
+ return 'bg-slate-100 text-slate-700 dark:bg-slate-800 dark:text-slate-200';
+ }
+ if (props.type === 'vm') {
+ return 'bg-indigo-100 text-indigo-700 dark:bg-indigo-900/40 dark:text-indigo-200';
+ }
+ if (props.type === 'ct') {
+ return 'bg-teal-100 text-teal-700 dark:bg-teal-900/40 dark:text-teal-200';
+ }
+ return 'bg-surface-alt text-muted';
+ };
+ return (
+ <span
+ class={`inline-flex items-center rounded-sm px-1.5 py-0.5 text-[10px] font-semibold ${badgeClass()}`}
+ >
+ {props.label}
+ </span>
+ );
+}
+
// Sortable column header — matches Storage's pattern (StoragePoolsTable.tsx).
// Clicking an inactive column sorts it with the supplied default direction;
// clicking the active column flips direction. Renders the idle / asc / desc