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.

Color-code Proxmox backup ages

rcourtmana464d3cf6bcc
diff --git a/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx
index f54bb98928..b914cb7c1d 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxCoverageTable.tsx
@@ -13,7 +13,7 @@ import {
TableRow,
} from '@/components/shared/Table';
import { TableCard } from '@/components/shared/TableCard';
-import { formatBytes, formatRelativeTime } from '@/utils/format';
+import { formatBytes } from '@/utils/format';
import {
PLATFORM_TABLE_BODY_CLASS,
PLATFORM_TABLE_CARD_CLASS,
@@ -33,6 +33,7 @@ import {
ArtifactSourceBadge,
ArtifactStateBadge,
PROXMOX_BACKUP_COLUMN_LABELS,
+ ProxmoxBackupAgeText,
ProxmoxBackupWorkloadTypeBadge,
SortableHead,
artifactStateLabel,
@@ -294,9 +295,7 @@ export function ProxmoxCoverageTable(props: {
when={row.latestRecovery}
fallback={<span class="text-muted">No restore point</span>}
>
- {(artifact) =>
- formatRelativeTime(artifact().createdAt, { compact: true })
- }
+ {(artifact) => <ProxmoxBackupAgeText artifact={artifact()} />}
</Show>
</TableCell>
<Show when={props.showPbsColumn}>
@@ -309,9 +308,7 @@ export function ProxmoxCoverageTable(props: {
<span class="text-muted">{pbsSource.coverageFallbackLabel}</span>
}
>
- {(artifact) =>
- formatRelativeTime(artifact().createdAt, { compact: true })
- }
+ {(artifact) => <ProxmoxBackupAgeText artifact={artifact()} />}
</Show>
</TableCell>
</Show>
@@ -325,9 +322,7 @@ export function ProxmoxCoverageTable(props: {
<span class="text-muted">{archiveSource.coverageFallbackLabel}</span>
}
>
- {(artifact) =>
- formatRelativeTime(artifact().createdAt, { compact: true })
- }
+ {(artifact) => <ProxmoxBackupAgeText artifact={artifact()} />}
</Show>
</TableCell>
</Show>
@@ -341,9 +336,7 @@ export function ProxmoxCoverageTable(props: {
<span class="text-muted">{snapshotSource.coverageFallbackLabel}</span>
}
>
- {(artifact) =>
- formatRelativeTime(artifact().createdAt, { compact: true })
- }
+ {(artifact) => <ProxmoxBackupAgeText artifact={artifact()} />}
</Show>
</TableCell>
</Show>
@@ -433,9 +426,7 @@ export function ProxmoxCoverageTable(props: {
</span>
</td>
<td class="px-2 py-1 text-right text-base-content">
- {formatRelativeTime(artifact.createdAt, {
- compact: true,
- })}
+ <ProxmoxBackupAgeText artifact={artifact} />
</td>
<td class="px-2 py-1 text-right tabular-nums text-base-content">
<Show
diff --git a/frontend-modern/src/features/proxmox/ProxmoxRecoverableTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxRecoverableTable.tsx
index 8f7eb67bdc..19498f8ce0 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxRecoverableTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxRecoverableTable.tsx
@@ -11,7 +11,7 @@ import {
TableRow,
} from '@/components/shared/Table';
import { TableCard } from '@/components/shared/TableCard';
-import { formatBytes, formatRelativeTime } from '@/utils/format';
+import { formatBytes } from '@/utils/format';
import {
getRecoveryFullDateLabel,
recoveryDateKeyFromTimestamp,
@@ -30,6 +30,7 @@ import {
ArtifactSourceBadge,
ArtifactStateBadge,
PROXMOX_BACKUP_COLUMN_LABELS,
+ ProxmoxBackupAgeText,
ProxmoxBackupWorkloadTypeBadge,
RowMetricBar,
SortableHead,
@@ -111,7 +112,7 @@ export function ProxmoxRecoverableTable(props: {
</span>
</TableCell>
<TableCell class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content`}>
- {formatRelativeTime(artifact.createdAt, { compact: true })}
+ <ProxmoxBackupAgeText artifact={artifact} />
</TableCell>
<TableCell class={`${getPlatformTableCellClassForKind('metric-bar')} text-base-content`}>
<Show
diff --git a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts
index 8a5f73237f..ca204384b8 100644
--- a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts
+++ b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupRecoveryModel.test.ts
@@ -5,6 +5,7 @@ import type { Resource } from '@/types/resource';
import {
buildProxmoxBackupRecoveryModel,
coverageRowMatchesSearch,
+ getRecoveryAgeBand,
getWorkloadRecoveryPostureLabel,
recoverableArtifactMatchesSearch,
} from '../proxmoxBackupRecoveryModel';
@@ -83,6 +84,15 @@ const task = (overrides: Partial<BackupTask> = {}): BackupTask => ({
});
describe('proxmoxBackupRecoveryModel', () => {
+ it('classifies backup ages with the same thresholds used by coverage posture', () => {
+ const nowMs = Date.parse('2026-05-26T08:00:00Z');
+
+ expect(getRecoveryAgeBand(nowMs - 2 * 24 * 60 * 60 * 1000, nowMs)).toBe('current');
+ expect(getRecoveryAgeBand(nowMs - 14 * 24 * 60 * 60 * 1000, nowMs)).toBe('aging');
+ expect(getRecoveryAgeBand(nowMs - 45 * 24 * 60 * 60 * 1000, nowMs)).toBe('stale');
+ expect(getRecoveryAgeBand(undefined, nowMs)).toBe('unknown');
+ });
+
it('groups PBS, archive, snapshot, and task evidence under the resolved workload', () => {
const model = buildProxmoxBackupRecoveryModel({
workloads: [workload({})],
diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts b/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts
index c01073bf76..8192a3e5ae 100644
--- a/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts
+++ b/frontend-modern/src/features/proxmox/proxmoxBackupRecoveryModel.ts
@@ -107,8 +107,22 @@ interface WorkloadCandidate extends WorkloadReference {
type WorkloadRowDraft = Omit<WorkloadCoverageRow, 'posture' | 'postureRank' | 'isOrphaned'>;
const DAY_MS = 24 * 60 * 60 * 1000;
-const CURRENT_RECOVERY_MS = 7 * DAY_MS;
-const STALE_RECOVERY_MS = 30 * DAY_MS;
+export const CURRENT_RECOVERY_MS = 7 * DAY_MS;
+export const STALE_RECOVERY_MS = 30 * DAY_MS;
+
+export type RecoveryAgeBand = 'current' | 'aging' | 'stale' | 'unknown';
+
+export function getRecoveryAgeBand(
+ createdMs: number | undefined,
+ nowMs: number = Date.now(),
+): RecoveryAgeBand {
+ if (createdMs === undefined || !Number.isFinite(createdMs)) return 'unknown';
+ const ageMs = nowMs - createdMs;
+ if (!Number.isFinite(ageMs)) return 'unknown';
+ if (ageMs <= CURRENT_RECOVERY_MS) return 'current';
+ if (ageMs <= STALE_RECOVERY_MS) return 'aging';
+ return 'stale';
+}
function parseTimestampMs(value: string | undefined): number | undefined {
if (!value) return undefined;
@@ -380,12 +394,9 @@ function buildPosture(row: WorkloadRowDraft, nowMs: number) {
const hasExternalBackup = row.latestPBS !== undefined || row.latestArchive !== undefined;
if (!hasExternalBackup && row.latestSnapshot)
return { posture: 'snapshot-only' as const, rank: 3 };
- const ageMs =
- row.latestRecovery.createdMs === undefined
- ? Number.POSITIVE_INFINITY
- : nowMs - row.latestRecovery.createdMs;
- if (ageMs <= CURRENT_RECOVERY_MS) return { posture: 'current' as const, rank: 5 };
- if (ageMs <= STALE_RECOVERY_MS) return { posture: 'aging' as const, rank: 4 };
+ const ageBand = getRecoveryAgeBand(row.latestRecovery.createdMs, nowMs);
+ if (ageBand === 'current') return { posture: 'current' as const, rank: 5 };
+ if (ageBand === 'aging') return { posture: 'aging' as const, rank: 4 };
return { posture: 'stale' as const, rank: 2 };
}
diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx b/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx
index ea0d8af9c1..b6d0a171fe 100644
--- a/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx
+++ b/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx
@@ -6,8 +6,14 @@ import { type FilterOption } from '@/components/shared/FilterButtonGroup';
import { ProgressBar } from '@/components/shared/ProgressBar';
import { TableHead } from '@/components/shared/Table';
import { WorkloadTypeBadge as SharedWorkloadTypeBadge } from '@/components/shared/WorkloadTypeBadge';
+import { formatRelativeTime } from '@/utils/format';
-import type { RecoverableArtifact, WorkloadReference } from './proxmoxBackupRecoveryModel';
+import {
+ getRecoveryAgeBand,
+ type RecoverableArtifact,
+ type RecoveryAgeBand,
+ type WorkloadReference,
+} from './proxmoxBackupRecoveryModel';
import {
getProxmoxBackupSourcePresentation,
type ProxmoxBackupSourceKind,
@@ -32,6 +38,20 @@ export const PROXMOX_BACKUP_COLUMN_LABELS = {
details: 'Details',
} as const;
+const recoveryAgeClassByBand: Record<RecoveryAgeBand, string> = {
+ current: 'text-emerald-600 dark:text-emerald-300',
+ aging: 'text-amber-600 dark:text-amber-300',
+ stale: 'text-red-600 dark:text-red-300',
+ unknown: 'text-muted',
+};
+
+const recoveryAgeTitleByBand: Record<RecoveryAgeBand, string> = {
+ current: 'Current backup age',
+ aging: 'Aging backup age',
+ stale: 'Stale backup age',
+ unknown: 'Backup age unavailable',
+};
+
export const ARCHIVE_STATUS_FILTERS: FilterOption<
'all' | 'protected' | 'verified' | 'unverified'
>[] = [
@@ -144,6 +164,21 @@ export function RowMetricBar(props: {
);
}
+export function ProxmoxBackupAgeText(props: { artifact: RecoverableArtifact }) {
+ const band = () => getRecoveryAgeBand(props.artifact.createdMs);
+ const relative = () => formatRelativeTime(props.artifact.createdAt, { compact: true });
+ const title = () => {
+ const parts = [recoveryAgeTitleByBand[band()], props.artifact.createdAt].filter(Boolean);
+ return parts.join(' · ');
+ };
+
+ return (
+ <span class={`font-semibold tabular-nums ${recoveryAgeClassByBand[band()]}`} title={title()}>
+ {relative() || '—'}
+ </span>
+ );
+}
+
// Short state label for a recoverable artifact, paired with ArtifactStateBadge
// for colour. Snapshot and protected take precedence over verification state.
export function artifactStateLabel(artifact: RecoverableArtifact): string {