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.

Show when each PBS datastore fills on the Backups page

rcourtman133f2eb8419d
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 464949c378..ff35079f22 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -508,6 +508,20 @@ desktop/narrow browser journeys cover the shared filter rail, keyboard/touch
day selection, metric switching, empty matches and recovery. No shared-filter,
route, navigation, access or backup operation changes.
+### Datastore fill forecast stays on one row line (2 November 2026)
+
+`ProxmoxBackupServersTable` shows a PBS datastore's fill forecast as the
+shared count-pill style in the Used cell, replacing the secondary used/total
+bytes so the row keeps its single line. In the compact layout the pill would
+crowd the percentage, so the forecast moves to the State cell as tinted text,
+the slot the compact layout already gives a job problem. Its label comes from
+`describeStorageAlertHeadline`, the Storage page's wording, and the drawer's
+`DetailSectionTable` gains a toned "Fill forecast" row.
+`ProxmoxBackupServersTable.forecast.test.tsx` and
+`proxmoxBackupServerForecast.test.ts` cover both layouts, the drawer, live
+alert changes, the unreadable store, the cross-connection id collision and the
+job-problem precedence.
+
### Backup jobs card composes the overview primitives (2 November 2026)
`ProxmoxBackupJobsCard` is a `TableCard` with a `TableCardHeader` strip, like
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 32a4cf68a7..32eb6391a7 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -5041,6 +5041,32 @@ read "0 protected, 38 attention", which left the operator counting rows to
find the cause; on the 932-guest mock it now reads as five lines. No posture,
freshness or protection evaluation changes.
+### Backup servers show the datastore fill forecast (2 November 2026)
+
+A PBS datastore row in the Backup servers table says when the store fills
+("Full in ~4d", red within a day) while its active capacity alert carries
+`forecastDaysToFull`. That alert is the existing storage capacity forecast the
+PBS poller evaluates for storage `<instance id>-<store>` (alias
+`<instance id>/<store>`), with its own trigger, latch and recovery lifecycle;
+the Backups page never estimates a runway of its own. The dashed storage id is
+ambiguous across connections (`main` + `daily-tank` and `main-daily` + `tank`),
+so a row takes an alert only when its policy aliases name the exact
+`<instance id>/<store>`, or, without aliases, its instance and store name match.
+The resource name can be the PBS hostname, so it is never used. No countdown
+does not mean the runway is safe: a store over the usage threshold alerts on
+usage instead (the percentage already shows it) and a young trend is not yet
+trusted. An unreadable store keeps "Unavailable" rather than a forecast.
+Acknowledging the alert does not change when the store fills, so an
+acknowledged forecast still shows.
+
+On desktop the forecast pill takes the used/total bytes' place in Used (they
+stay in its title and the drawer). On phones it takes State, as a job problem
+does, and the percentage stays whole; a critical job problem keeps State over a
+warning forecast. The datastore drawer adds a "Fill forecast" line with the
+observed daily growth. The page owns the live alert store and passes a lookup
+through `ProxmoxBackupsTable`'s `datastoreAlerts`, so the table renders without
+an alerts provider and shows no forecast when none is given.
+
### Backup jobs show 14 days of retained outcomes beside Backup health (2 November 2026)
A Backup jobs card answers "did last night's backups run, and is that
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index d8049734f0..17c05a88c1 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -194,6 +194,20 @@ narrow browser proof exercises the same producer through the inventory consumer
with native interactions and inspected pixels. No API, provider, guest, polling,
auth, resource identity or protection-policy change, nor installed recovery claim.
+### PBS datastore alerts join by instance id, not display name (2 November 2026)
+
+The Backup servers table finds a datastore's capacity alert from the unified
+PBS resource's `pbs.instanceId` ("pbs-<connection>"), which the poller also uses
+for that datastore's storage id (`<instance id>-<store>`) and alias
+(`<instance id>/<store>`). The resource `name` can be the PBS hostname rather
+than the connection name, so it is never part of the join. Because the dashed
+storage id is ambiguous across connections, an alert counts for a row only when
+its policy aliases contain that exact alias, or, without aliases, its instance
+and store name match. The forecast adds no identity: it decorates the existing
+datastore row and never creates, merges or retires one.
+`proxmoxBackupServerForecast.test.ts` covers the hostname-named resource and
+the cross-connection collision.
+
### Coverage duration requires observed task timing
The existing Coverage task disclosure derives a duration only from positive,
diff --git a/frontend-modern/browser-verification/58f659fbd6e36703.json b/frontend-modern/browser-verification/58f659fbd6e36703.json
new file mode 100644
index 0000000000..893f597c12
--- /dev/null
+++ b/frontend-modern/browser-verification/58f659fbd6e36703.json
@@ -0,0 +1,46 @@
+{
+ "version": 1,
+ "base_sha": "3a57ee56d97e1c616a79a409aa15d5e3c71d60c3",
+ "verified_at": "2026-11-02T10:19:48Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx",
+ "frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx",
+ "frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx",
+ "frontend-modern/src/features/proxmox/proxmoxBackupServerForecast.ts",
+ "frontend-modern/src/features/storageBackups/storageRowAlertPresentation.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx": "f522139d4efcdd7ecc7a2df80539f806af84063f266dac37280c74adabbfc5be",
+ "frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx": "56ae74fd990c09cb510de62fda9e6ef55d0b706a11c67c2ecaca4004b2722f8a",
+ "frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx": "b0e6fc3dd407405cef2f9e439c30ecff6c62e221650e921ae554062ea0b145e4",
+ "frontend-modern/src/features/proxmox/proxmoxBackupServerForecast.ts": "284b5424c7a3b8a61df4ae073dd147a853f45f731a3dcd85d07761a525872eae",
+ "frontend-modern/src/features/storageBackups/storageRowAlertPresentation.ts": "2ed1961c84ec8827c6f38eb024eb6ae731d8dcff5d33557c1a31fb107be5f5ec"
+ },
+ "routes": [
+ "/proxmox/backups"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 1000
+ },
+ {
+ "width": 375,
+ "height": 812
+ }
+ ],
+ "states": [
+ "private mock-mode backend built from this branch on pulse-dev with one injected PBS datastore forecast alert",
+ "warning and critical forecasts in the Backup servers table and the datastore drawer",
+ "dark theme, desktop and phone layouts"
+ ],
+ "interactions": [
+ "signed in to the private mock backend and opened Proxmox > Backups at 1440x1000 and 375x812",
+ "mock mode raises no PBS forecast alert (it needs a week of usage trend), so injected one for pbs-main / primary-vault into the websocket activeAlerts payload and /api/alerts/active",
+ "desktop: the primary-vault row read 23.9% with a 'Full in ~4d' amber pill in place of the used/total bytes; a critical alert read 'Full <1d' in red; rows without a forecast kept their bytes",
+ "phone: the forecast moved to State as 'Full in ~4d' and the percentage stayed whole (the first attempt placed the pill beside it and clipped 23.9% to 3.9%, which this fixed)",
+ "opened the primary-vault drawer at both widths: Fill forecast 'Full in ~4 days, growing 4.1% a day' between Capacity and Jobs",
+ "every row stayed 32-33 px and single-line; only datastore names truncate on phone, as rows without a forecast already do; no horizontal page overflow"
+ ]
+}
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx
index 1d25613e8e..17516aefcd 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupServersTable.tsx
@@ -24,7 +24,7 @@ import {
PlatformResourceDetailTableRow,
PlatformResourceDetailToggleButton,
} from '@/features/platformPage/PlatformResourceDetailTableRow';
-import type { PBSBackup } from '@/types/api';
+import type { Alert, PBSBackup } from '@/types/api';
import type { Resource, ResourcePBSDatastore } from '@/types/resource';
import { getPlatformAgentRecord } from '@/utils/agentResources';
import {
@@ -46,6 +46,12 @@ import {
type DatastoreJobState,
type DatastoreJobSummary,
} from './proxmoxBackupServerJobs';
+import {
+ backupServerDatastoreAlertIds,
+ getDatastoreFillForecast,
+ isBackupServerDatastoreAlert,
+ type DatastoreFillForecast,
+} from './proxmoxBackupServerForecast';
// "Backup servers" answers the two questions the coverage table can't: is my
// PBS reachable, and is its datastore about to fill? Datastore fill is the
@@ -166,6 +172,19 @@ function jobToneClass(state: DatastoreJobState): string {
const jobDetailTone = (state: DatastoreJobState): DetailValueTone | undefined =>
state === 'critical' ? 'danger' : state === 'warning' ? 'warning' : undefined;
+const forecastDetailTone = (forecast: DatastoreFillForecast): DetailValueTone =>
+ forecast.level === 'critical' ? 'danger' : 'warning';
+
+const forecastToneClass = (forecast: DatastoreFillForecast): string =>
+ forecast.level === 'critical'
+ ? 'text-red-600 dark:text-red-300'
+ : 'text-amber-600 dark:text-amber-300';
+
+const FORECAST_PILL_CLASS: Record<DatastoreFillForecast['level'], string> = {
+ critical: 'bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300',
+ warning: 'bg-amber-100 text-amber-800 dark:bg-amber-900/40 dark:text-amber-300',
+};
+
function usageToneClass(pct: number | undefined): string {
if (pct === undefined) return 'text-muted';
if (pct >= 90) return 'text-red-600 dark:text-red-300';
@@ -180,6 +199,7 @@ function usageToneClass(pct: number | undefined): string {
function BackupServerDatastoreContext(props: {
row: BackupServerRow;
inventoryState?: 'available' | 'loading' | 'unavailable';
+ forecast?: DatastoreFillForecast | null;
}) {
const capacityText = () => {
const datastore = props.row.datastore;
@@ -224,6 +244,16 @@ function BackupServerDatastoreContext(props: {
layout: 'stacked',
tone: capacityTone(),
},
+ ...(props.forecast
+ ? [
+ {
+ label: 'Fill forecast',
+ value: props.forecast.detail,
+ layout: 'stacked' as const,
+ tone: forecastDetailTone(props.forecast),
+ },
+ ]
+ : []),
{
label: 'Jobs',
value: describeDatastoreJobs(props.row.jobs),
@@ -555,6 +585,9 @@ export function ProxmoxBackupServersTable(props: {
backupInventoryState?: 'available' | 'loading' | 'unavailable';
emptyIcon?: JSX.Element;
layoutWidth?: Accessor<number | null | undefined>;
+ // Open alerts for a datastore's alert keys. The page owns the live alert
+ // store; without it the table shows no fill forecast.
+ datastoreAlerts?: (resourceIds: string[]) => Alert[];
}) {
const retention = createPbsCorrelationRetention();
const rows = createMemo(() =>
@@ -665,6 +698,32 @@ export function ProxmoxBackupServersTable(props: {
// Read admission is not a generic storage-adapter capacity snapshot.
const capacityEvidence = () => datastoreCapacity(row.datastore, row.online);
const pct = () => capacityEvidence().percent;
+ // Only a readable store can be forecast; Unavailable stays the answer.
+ const forecast = createMemo(() => {
+ const datastore = row.datastore;
+ const lookup = props.datastoreAlerts;
+ if (!datastore || !lookup || capacityEvidence().state !== 'available') {
+ return null;
+ }
+ return getDatastoreFillForecast(
+ lookup(backupServerDatastoreAlertIds(row.resource, datastore.name)).filter(
+ (alert) =>
+ isBackupServerDatastoreAlert(alert, row.resource, datastore.name),
+ ),
+ );
+ });
+ // Phones have no room beside the percentage, so the forecast takes
+ // State like a job problem does. A full store stops every future
+ // backup, so it outranks a job problem unless only the job is critical.
+ const showForecastAsState = () => {
+ const fill = forecast();
+ if (!fill || layoutMode() !== 'compact') return false;
+ return !(
+ showJobProblemAsState(row) &&
+ row.jobs.state === 'critical' &&
+ fill.level !== 'critical'
+ );
+ };
const capacityNotice = () =>
capacityEvidence().state === 'unavailable'
? 'Datastore capacity is unavailable. This does not mean the datastore is empty.'
@@ -707,35 +766,50 @@ export function ProxmoxBackupServersTable(props: {
</TableCell>
<TableCell class={getPlatformTableCellClassForKind('text')}>
<Show
- when={!showJobProblemAsState(row)}
+ when={showForecastAsState() ? forecast() : null}
fallback={
- <span
- class={`block truncate text-[11px] ${jobToneClass(row.jobs.state)}`}
- title={describeDatastoreJobs(row.jobs)}
- data-backup-server-jobs={row.jobs.state}
+ <Show
+ when={!showJobProblemAsState(row)}
+ fallback={
+ <span
+ class={`block truncate text-[11px] ${jobToneClass(row.jobs.state)}`}
+ title={describeDatastoreJobs(row.jobs)}
+ data-backup-server-jobs={row.jobs.state}
+ >
+ {row.jobs.label}
+ </span>
+ }
>
- {row.jobs.label}
- </span>
+ <Show when={!row.continuesServer}>
+ <div class="flex items-center gap-2">
+ <Show when={layoutMode() !== 'compact'}>
+ <StatusDot
+ size="sm"
+ variant={row.online ? 'success' : 'danger'}
+ title={row.connectionLabel}
+ ariaHidden
+ />
+ </Show>
+ <span
+ class="truncate text-[11px] text-base-content"
+ title={row.connectionLabel}
+ >
+ {row.connectionLabel}
+ </span>
+ </div>
+ </Show>
+ </Show>
}
>
- <Show when={!row.continuesServer}>
- <div class="flex items-center gap-2">
- <Show when={layoutMode() !== 'compact'}>
- <StatusDot
- size="sm"
- variant={row.online ? 'success' : 'danger'}
- title={row.connectionLabel}
- ariaHidden
- />
- </Show>
- <span
- class="truncate text-[11px] text-base-content"
- title={row.connectionLabel}
- >
- {row.connectionLabel}
- </span>
- </div>
- </Show>
+ {(fill) => (
+ <span
+ class={`block truncate text-[11px] font-medium ${forecastToneClass(fill())}`}
+ title={fill().detail}
+ data-backup-server-forecast={fill().level}
+ >
+ {fill().shortLabel}
+ </span>
+ )}
</Show>
</TableCell>
<Show when={columnVisible('version')}>
@@ -872,11 +946,30 @@ export function ProxmoxBackupServersTable(props: {
<span class={`tabular-nums font-medium ${usageToneClass(pct())}`}>
<PlatformTablePercentValue value={pct()} />
</span>
- <Show when={layoutMode() !== 'compact'}>
- <span class="truncate text-[10px] text-muted tabular-nums">
- {formatPlatformTableBytesValue(datastore().used, '0 B')} /{' '}
- {formatPlatformTableBytesValue(datastore().total)}
- </span>
+ {/* A fill forecast is the more urgent answer, so it
+ takes the bytes' place; they stay in the title
+ and the drawer, and the row stays one line. */}
+ <Show
+ when={layoutMode() !== 'compact' && forecast()}
+ fallback={
+ <Show when={layoutMode() !== 'compact'}>
+ <span class="truncate text-[10px] text-muted tabular-nums">
+ {formatPlatformTableBytesValue(datastore().used, '0 B')} /{' '}
+ {formatPlatformTableBytesValue(datastore().total)}
+ </span>
+ </Show>
+ }
+ >
+ {(fill) => (
+ <span
+ class={`inline-flex items-center whitespace-nowrap rounded-md px-1.5 py-0.5 text-[11px] font-semibold tabular-nums ${FORECAST_PILL_CLASS[fill().level]}`}
+ title={`${fill().detail}. ${formatPlatformTableBytesValue(datastore().used, '0 B')} / ${formatPlatformTableBytesValue(datastore().total)} used.`}
+ data-backup-server-forecast={fill().level}
+ >
+ <span aria-hidden="true">{fill().shortLabel}</span>
+ <span class="sr-only">{fill().label}</span>
+ </span>
+ )}
</Show>
</div>
</Show>
@@ -952,6 +1045,7 @@ export function ProxmoxBackupServersTable(props: {
<BackupServerDatastoreContext
row={row}
inventoryState={props.backupInventoryState}
+ forecast={forecast()}
/>
}
initialShowHostDetails
diff --git a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
index 02f0f81600..d8d5c5f95d 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxBackupsTable.tsx
@@ -35,6 +35,7 @@ import {
recoveryDateKeyFromTimestamp,
} from '@/utils/recoveryDatePresentation';
import type {
+ Alert,
BackupTask,
GuestSnapshot,
PBSBackup,
@@ -144,6 +145,8 @@ export const ProxmoxBackupsTable: Component<{
// A page-owned summary beside Backup health (the backup jobs card). It owns
// its own read, so the table's inventory reads stay PVE plus PBS.
summaryAside?: JSX.Element;
+ // Page-owned live alert lookup, for the backup servers' fill forecast.
+ datastoreAlerts?: (resourceIds: string[]) => Alert[];
}> = (props) => {
let inspection: HTMLDivElement | undefined;
// Recovering a read removes its notice (or the whole-inventory error).
@@ -832,6 +835,7 @@ export const ProxmoxBackupsTable: Component<{
<ProxmoxBackupServersTable
servers={props.servers ?? []}
backups={pbsArtifacts()}
+ datastoreAlerts={props.datastoreAlerts}
backupInventoryState={
pbsBackups.error() ? 'unavailable' : pbsBackups.resolvedOnce() ? 'available' : 'loading'
}
diff --git a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
index ce0f9cc738..99c5e7b7fe 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
@@ -57,6 +57,9 @@ import { ProxmoxReplicationTable, fetchReplicationJobs } from './ProxmoxReplicat
import { createNonSuspendingQuery } from '@/hooks/createNonSuspendingQuery';
import { getAPIReadAccessErrorMessage } from '@/utils/apiAccessError';
import { useUnifiedResources } from '@/hooks/useUnifiedResources';
+import { useWebSocket } from '@/contexts/appRuntime';
+import { useAlertsActivation } from '@/stores/alertsActivation';
+import { getAlertsForResource } from '@/utils/alerts';
import type { ReplicationJob } from '@/types/api';
import type { Resource } from '@/types/resource';
import { updateStore } from '@/stores/updates';
@@ -100,6 +103,8 @@ const EMPTY_PROXMOX_PAGE_MODEL = buildProxmoxPageModel([]);
export function ProxmoxPageSurface() {
const location = useLocation();
+ const { activeAlerts } = useWebSocket();
+ const alertsActivation = useAlertsActivation();
const phoneViewport = typeof window !== 'undefined' && window.innerWidth < 640;
const requestedTab = createMemo<ProxmoxPageTabId>(() => {
const segment = location.pathname.split('/').filter(Boolean)[1] as ProxmoxPageTabId | undefined;
@@ -436,6 +441,9 @@ export function ProxmoxPageSurface() {
workloads={model().guests}
servers={model().resources}
summaryAside={<ProxmoxBackupJobsSection />}
+ datastoreAlerts={(ids) =>
+ getAlertsForResource(ids, activeAlerts, alertsActivation.detectionEnabled())
+ }
/>
</Show>
<Show when={activeTab() === 'ceph'}>
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupServersTable.forecast.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupServersTable.forecast.test.tsx
new file mode 100644
index 0000000000..9292124387
--- /dev/null
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxBackupServersTable.forecast.test.tsx
@@ -0,0 +1,165 @@
+import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-library';
+import { createStore, produce } from 'solid-js/store';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+import type { Alert } from '@/types/api';
+import type { Resource } from '@/types/resource';
+import { ProxmoxBackupServersTable } from '../ProxmoxBackupServersTable';
+
+vi.mock('@/components/Infrastructure/ResourceDetailDrawer', () => ({
+ ResourceDetailDrawer: () => <div>Details</div>,
+}));
+
+afterEach(cleanup);
+
+const server = (status = 'available'): Resource => ({
+ id: 'pbs-main',
+ type: 'pbs',
+ name: 'main',
+ displayName: 'main',
+ status: 'online',
+ platformId: 'pbs-main',
+ platformType: 'proxmox-pbs',
+ sourceType: 'api',
+ lastSeen: 1_790_000_000_000,
+ pbs: {
+ instanceId: 'pbs-main',
+ connectionHealth: 'healthy',
+ datastores: [{ name: 'tank', total: 1000, used: 820, available: 180, status }],
+ },
+});
+
+const forecastAlert = {
+ id: 'pbs-main-tank-usage',
+ type: 'usage',
+ level: 'warning',
+ resourceId: 'pbs-main-tank',
+ resourceName: 'tank',
+ instance: 'pbs-main',
+ message: 'Storage projected to fill in 4 days',
+ startTime: '2026-11-02T08:00:00Z',
+ acknowledged: false,
+ metadata: {
+ forecastDaysToFull: 4.2,
+ forecastDailyChangePct: 4.1,
+ storagePolicyAliases: ['pbs-main/tank'],
+ },
+} as unknown as Alert;
+
+const lookup = (alerts: Alert[]) => (ids: string[]) =>
+ alerts.filter((alert) => ids.includes(alert.resourceId));
+
+describe('PBS datastore fill forecast', () => {
+ it('puts the forecast in the Used cell and the drawer', async () => {
+ const { container } = render(() => (
+ <ProxmoxBackupServersTable
+ servers={[server()]}
+ layoutWidth={() => 1400}
+ datastoreAlerts={lookup([forecastAlert])}
+ />
+ ));
+ const pill = container.querySelector('[data-backup-server-forecast]')!;
+ expect(pill).toHaveAttribute('data-backup-server-forecast', 'warning');
+ expect(pill).toHaveTextContent('Full in ~4d');
+ expect(pill).toHaveAttribute('title', expect.stringContaining('growing 4.1% a day'));
+ // The forecast takes the bytes' place, so the row stays one line.
+ expect(pill.closest('td')).not.toHaveTextContent('820 B /');
+
+ await fireEvent.click(
+ screen.getByRole('button', { name: 'Expand details for main · datastore tank' }),
+ );
+ const drawer = screen.getByRole('region', { name: 'Selected PBS datastore' });
+ expect(drawer).toHaveTextContent('Fill forecast');
+ expect(drawer).toHaveTextContent('Full in ~4 days, growing 4.1% a day');
+ });
+
+ it('follows the live alert store as a forecast appears, changes and clears', async () => {
+ const [alerts, setAlerts] = createStore<Record<string, Alert>>({});
+ const { container } = render(() => (
+ <ProxmoxBackupServersTable
+ servers={[server()]}
+ layoutWidth={() => 1400}
+ datastoreAlerts={(ids) => Object.values(alerts).filter((a) => ids.includes(a.resourceId))}
+ />
+ ));
+ const pill = () => container.querySelector('[data-backup-server-forecast]');
+ expect(pill()).toBeNull();
+
+ setAlerts(forecastAlert.id, structuredClone(forecastAlert));
+ await waitFor(() => expect(pill()).toHaveTextContent('Full in ~4d'));
+
+ setAlerts(
+ produce((draft) => {
+ draft[forecastAlert.id].level = 'critical';
+ draft[forecastAlert.id].metadata!.forecastDaysToFull = 0.4;
+ }),
+ );
+ await waitFor(() => expect(pill()).toHaveTextContent('Full <1d'));
+ expect(pill()).toHaveAttribute('data-backup-server-forecast', 'critical');
+
+ setAlerts(forecastAlert.id, undefined as unknown as Alert);
+ await waitFor(() => expect(pill()).toBeNull());
+ expect(container).toHaveTextContent('820 B /');
+ });
+
+ it('names the forecast in State on phones and keeps the percentage whole', () => {
+ const { container } = render(() => (
+ <ProxmoxBackupServersTable
+ servers={[server()]}
+ layoutWidth={() => 375}
+ datastoreAlerts={lookup([forecastAlert])}
+ />
+ ));
+ const forecasts = container.querySelectorAll('[data-backup-server-forecast]');
+ expect(forecasts).toHaveLength(1);
+ expect(forecasts[0]).toHaveTextContent('Full in ~4d');
+ expect(forecasts[0].closest('td')).not.toHaveTextContent('82');
+ expect(container).toHaveTextContent('82.0%');
+ });
+
+ it('lets only a critical job problem keep State on phones over a warning forecast', () => {
+ const critical = server();
+ critical.pbs!.jobHealthEvidence = [
+ {
+ id: 'sync-tank',
+ family: 'sync',
+ store: 'tank',
+ enabled: true,
+ confidence: 'config-last-run',
+ posture: 'critical',
+ postureReason: 'last-run-failed',
+ },
+ ];
+ const { container } = render(() => (
+ <ProxmoxBackupServersTable
+ servers={[critical]}
+ layoutWidth={() => 375}
+ datastoreAlerts={lookup([forecastAlert])}
+ />
+ ));
+ expect(container.querySelector('[data-backup-server-forecast]')).toBeNull();
+ expect(container.querySelector('[data-backup-server-jobs="critical"]')).not.toBeNull();
+ });
+
+ it('shows no forecast without one, or for a store it cannot read', () => {
+ const { container, unmount } = render(() => (
+ <ProxmoxBackupServersTable
+ servers={[server()]}
+ layoutWidth={() => 1400}
+ datastoreAlerts={lookup([])}
+ />
+ ));
+ expect(container.querySelector('[data-backup-server-forecast]')).toBeNull();
+ expect(container).toHaveTextContent('820 B /');
+ unmount();
+
+ const unreadable = render(() => (
+ <ProxmoxBackupServersTable
+ servers={[server('unavailable')]}
+ layoutWidth={() => 1400}
+ datastoreAlerts={lookup([forecastAlert])}
+ />
+ ));
+ expect(unreadable.container.querySelector('[data-backup-server-forecast]')).toBeNull();
+ expect(unreadable.container).toHaveTextContent('Unavailable');
+ });
+});
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
index b8b50664c7..7fd2767e7e 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
@@ -25,6 +25,7 @@ const mockWorkloadsOptions = vi.hoisted(() => vi.fn());
const mockWorkloadsSurfaceProps = vi.hoisted(() => vi.fn());
const mockWorkloadsStateRef = vi.hoisted(() => ({ current: undefined as unknown }));
const mockWorkloadsReady = vi.hoisted(() => vi.fn(() => false));
+const mockActiveAlerts = vi.hoisted(() => ({}) as Record<string, unknown>);
const mockFetchReplicationJobs = vi.hoisted(() =>
vi.fn((_signal?: AbortSignal) => Promise.resolve([] as unknown[])),
);
@@ -60,6 +61,10 @@ const setResourcesSnapshot = (resources: Resource[] | undefined, loading = false
});
};
+vi.mock('@/contexts/appRuntime', () => ({
+ useWebSocket: () => ({ activeAlerts: mockActiveAlerts }),
+}));
+
vi.mock('@/hooks/useUnifiedResources', () => ({
useUnifiedResources: (...args: unknown[]) => mockUseUnifiedResources(...args),
}));
@@ -619,6 +624,36 @@ describe('ProxmoxPageSurface contract', () => {
);
});
+ it('hands the backups table a live alert lookup for datastore fill forecasts', () => {
+ mockPathname.mockReturnValue('/proxmox/backups');
+ const forecast = { id: 'a1', resourceId: 'pbs-main-store', level: 'warning' };
+ mockActiveAlerts.a1 = forecast;
+ mockActiveAlerts.a2 = { id: 'a2', resourceId: 'pbs-other-store', level: 'warning' };
+ // The Backups tab mounts only once a PBS server is in the estate.
+ const server = makeResource({
+ id: 'pbs-1',
+ type: 'pbs',
+ platformType: 'proxmox-pbs',
+ sources: ['pbs'],
+ });
+ mockUseUnifiedResources.mockImplementation((options: { cacheKey: string }) => ({
+ resources: () => (options.cacheKey === 'proxmox-backups-shell' ? [server] : []),
+ loading: () => false,
+ error: () => null,
+ refetch: vi.fn(),
+ }));
+ try {
+ renderSurface();
+ const props = mockBackupsTableProps.mock.calls.at(-1)?.[0] as {
+ datastoreAlerts?: (ids: string[]) => unknown[];
+ };
+ expect(props.datastoreAlerts?.(['pbs-main-store'])).toEqual([forecast]);
+ } finally {
+ delete mockActiveAlerts.a1;
+ delete mockActiveAlerts.a2;
+ }
+ });
+
it('places workload controls beside the workload table they affect', () => {
const nodesTableIndex = proxmoxPageSurfaceSource.indexOf('<ProxmoxNodesTable');
const workloadFilterIndex = proxmoxPageSurfaceSource.indexOf('<WorkloadsFilter');
diff --git a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupServerForecast.test.ts b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupServerForecast.test.ts
new file mode 100644
index 0000000000..818d71e29e
--- /dev/null
+++ b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupServerForecast.test.ts
@@ -0,0 +1,109 @@
+import { describe, expect, it } from 'vitest';
+import type { Alert } from '@/types/api';
+import type { Resource } from '@/types/resource';
+import {
+ backupServerDatastoreAlertIds,
+ getDatastoreFillForecast,
+ isBackupServerDatastoreAlert,
+} from '../proxmoxBackupServerForecast';
+
+const alert = (patch: Partial<Alert> = {}): Alert =>
+ ({
+ id: 'storage-usage',
+ type: 'usage',
+ level: 'warning',
+ resourceId: 'pbs-main-tank',
+ resourceName: 'tank',
+ node: 'main',
+ instance: 'pbs-main',
+ message: 'Storage projected to fill in 5 days',
+ value: 82,
+ threshold: 90,
+ startTime: '2026-11-02T08:00:00Z',
+ acknowledged: false,
+ ...patch,
+ }) as Alert;
+
+describe('backupServerDatastoreAlertIds', () => {
+ it('names the poller storage id and its alias from the instance id, not the hostname', () => {
+ const server = {
+ id: 'pbs-f611797ee465f279',
+ name: 'backup-vault',
+ pbs: { instanceId: 'pbs-main' },
+ } as Resource;
+ expect(backupServerDatastoreAlertIds(server, 'tank')).toEqual([
+ 'pbs-main-tank',
+ 'pbs-main/tank',
+ ]);
+ expect(backupServerDatastoreAlertIds({ ...server, pbs: {} } as Resource, 'tank')).toEqual([]);
+ });
+});
+
+describe('isBackupServerDatastoreAlert', () => {
+ const pbs = (instanceId: string) =>
+ ({ id: instanceId, name: instanceId, pbs: { instanceId } }) as Resource;
+
+ it('tells apart two datastores that share a dashed storage id', () => {
+ // Connection "main" store "daily-tank" and connection "main-daily" store
+ // "tank" are both storage "pbs-main-daily-tank".
+ const forDailyTank = alert({
+ resourceId: 'pbs-main-daily-tank',
+ metadata: { forecastDaysToFull: 3, storagePolicyAliases: ['pbs-main/daily-tank'] },
+ });
+ expect(backupServerDatastoreAlertIds(pbs('pbs-main'), 'daily-tank')).toContain(
+ 'pbs-main-daily-tank',
+ );
+ expect(backupServerDatastoreAlertIds(pbs('pbs-main-daily'), 'tank')).toContain(
+ 'pbs-main-daily-tank',
+ );
+ expect(isBackupServerDatastoreAlert(forDailyTank, pbs('pbs-main'), 'daily-tank')).toBe(true);
+ expect(isBackupServerDatastoreAlert(forDailyTank, pbs('pbs-main-daily'), 'tank')).toBe(false);
+ });
+
+ it('falls back to the alert instance and store name without policy aliases', () => {
+ const plain = alert({
+ resourceId: 'pbs-main-daily-tank',
+ instance: 'pbs-main',
+ resourceName: 'daily-tank',
+ });
+ expect(isBackupServerDatastoreAlert(plain, pbs('pbs-main'), 'daily-tank')).toBe(true);
+ expect(isBackupServerDatastoreAlert(plain, pbs('pbs-main-daily'), 'tank')).toBe(false);
+ });
+});
+
+describe('getDatastoreFillForecast', () => {
+ it('reads the soonest confident forecast and its growth', () => {
+ const forecast = getDatastoreFillForecast([
+ alert({ id: 'later', metadata: { forecastDaysToFull: 6.4 } }),
+ alert({
+ id: 'sooner',
+ level: 'critical',
+ acknowledged: true,
+ metadata: { forecastDaysToFull: 0.6, forecastDailyChangePct: 4.25 },
+ }),
+ ]);
+ expect(forecast).toMatchObject({
+ level: 'critical',
+ label: 'Full within a day',
+ shortLabel: 'Full <1d',
+ detail: 'Full within a day, growing 4.3% a day',
+ });
+ });
+
+ it('rounds the runway the way the Storage page does', () => {
+ expect(
+ getDatastoreFillForecast([alert({ metadata: { forecastDaysToFull: 4.6 } })]),
+ ).toMatchObject({
+ level: 'warning',
+ label: 'Full in ~5 days',
+ shortLabel: 'Full in ~5d',
+ detail: 'Full in ~5 days',
+ });
+ });
+
+ it('shows nothing without a forecast: a usage alert is not a runway', () => {
+ expect(getDatastoreFillForecast([alert()])).toBeNull();
+ expect(getDatastoreFillForecast([alert({ metadata: { forecastDaysToFull: -1 } })])).toBeNull();
+ expect(getDatastoreFillForecast([])).toBeNull();
+ });
+});
diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupServerForecast.ts b/frontend-modern/src/features/proxmox/proxmoxBackupServerForecast.ts
new file mode 100644
index 0000000000..5db4edbccb
--- /dev/null
+++ b/frontend-modern/src/features/proxmox/proxmoxBackupServerForecast.ts
@@ -0,0 +1,84 @@
+import type { Alert } from '@/types/api';
+import type { Resource } from '@/types/resource';
+import {
+ describeStorageAlertHeadline,
+ getStorageAlertForecastDaysToFull,
+} from '@/features/storageBackups/storageRowAlertPresentation';
+
+// "How long until it fills" for one PBS datastore. Pulse already forecasts it:
+// the PBS poller evaluates each datastore as storage `pbs-<connection>-<store>`
+// (alias `<instance id>/<store>`, monitor_pbs_pmg.go), and its capacity alert
+// carries forecastDaysToFull only once the usage trend is confident
+// (internal/alerts/capacity_forecast.go). This reads that alert while it carries
+// a forecast; it never estimates a runway of its own. No countdown does not mean
+// the runway is safe: a store over the usage threshold alerts on usage instead
+// (the percentage already shows it), and a younger trend is not yet trusted.
+
+export interface DatastoreFillForecast {
+ days: number;
+ level: 'warning' | 'critical';
+ // "Full in ~5 days"
+ label: string;
+ // "Full in ~5d": the Used cell's pill, or the phone layout's State cell.
+ shortLabel: string;
+ // Drawer text: the label plus the observed growth when it is known.
+ detail: string;
+}
+
+// The poller's instance id is already "pbs-<connection>", so the storage id is
+// "<instance id>-<store>". The resource name can be the PBS hostname instead of
+// the connection name, so it is not used.
+export const backupServerDatastoreAlertIds = (
+ server: Resource,
+ datastoreName: string,
+): string[] => {
+ const name = datastoreName.trim();
+ const instanceId = server.pbs?.instanceId?.trim();
+ if (!name || !instanceId) return [];
+ return [`${instanceId}-${name}`, `${instanceId}/${name}`];
+};
+
+// The dashed storage id is ambiguous: connection "main" with store "daily-tank"
+// and connection "main-daily" with store "tank" share "pbs-main-daily-tank". The
+// capacity alert names its exact "<instance id>/<store>" alias in its policy
+// aliases, and otherwise its instance and store name, so require one of those.
+export const isBackupServerDatastoreAlert = (
+ alert: Alert,
+ server: Resource,
+ datastoreName: string,
+): boolean => {
+ const name = datastoreName.trim();
+ const instanceId = server.pbs?.instanceId?.trim();
+ if (!name || !instanceId) return false;
+ const aliases = alert.metadata?.storagePolicyAliases;
+ if (Array.isArray(aliases)) return aliases.includes(`${instanceId}/${name}`);
+ return alert.instance === instanceId && alert.resourceName === name;
+};
+
+const dailyGrowth = (alert: Alert): number | null => {
+ const value = alert.metadata?.forecastDailyChangePct;
+ return typeof value === 'number' && Number.isFinite(value) && value > 0 ? value : null;
+};
+
+// The soonest forecast among the datastore's alerts. Acknowledging an alert
+// does not change when the store fills, so acknowledged forecasts count too.
+export const getDatastoreFillForecast = (
+ alerts: readonly Alert[],
+): DatastoreFillForecast | null => {
+ let soonest: { alert: Alert; days: number } | null = null;
+ for (const alert of alerts) {
+ const days = getStorageAlertForecastDaysToFull(alert);
+ if (days === null) continue;
+ if (!soonest || days < soonest.days) soonest = { alert, days };
+ }
+ if (!soonest) return null;
+ const label = describeStorageAlertHeadline(soonest.alert);
+ const growth = dailyGrowth(soonest.alert);
+ return {
+ days: soonest.days,
+ level: soonest.alert.level === 'critical' ? 'critical' : 'warning',
+ label,
+ shortLabel: describeStorageAlertHeadline(soonest.alert, { compact: true }),
+ detail: growth === null ? label : `${label}, growing ${growth.toFixed(1)}% a day`,
+ };
+};
diff --git a/frontend-modern/src/features/storageBackups/__tests__/storageAlertState.test.ts b/frontend-modern/src/features/storageBackups/__tests__/storageAlertState.test.ts
index b65f4bbe24..8a2cd6b31c 100644
--- a/frontend-modern/src/features/storageBackups/__tests__/storageAlertState.test.ts
+++ b/frontend-modern/src/features/storageBackups/__tests__/storageAlertState.test.ts
@@ -6,6 +6,8 @@ import {
getStorageRecordAlertResourceIds,
mergeStorageAlertRowState,
} from '@/features/storageBackups/storageAlertState';
+import { getStorageAlertForecastDaysToFull } from '@/features/storageBackups/storageRowAlertPresentation';
+import type { Alert } from '@/types/api';
const makeRecord = (overrides: Partial<StorageRecord> = {}): StorageRecord => ({
id: 'storage-1',
@@ -88,3 +90,21 @@ describe('storageAlertState', () => {
).toEqual(['storage-1', 'legacy-storage-id', 'cluster-a-pve1-tank']);
});
});
+
+// The Storage page headline and the Backups page's PBS datastore rows read the
+// same forecast field through this one rule.
+describe('getStorageAlertForecastDaysToFull', () => {
+ const alert = (metadata?: Record<string, unknown>) => ({ metadata }) as unknown as Alert;
+
+ it('reads a finite, non-negative forecast', () => {
+ expect(getStorageAlertForecastDaysToFull(alert({ forecastDaysToFull: 4.2 }))).toBe(4.2);
+ expect(getStorageAlertForecastDaysToFull(alert({ forecastDaysToFull: 0 }))).toBe(0);
+ });
+
+ it('treats a missing, malformed or negative forecast as none', () => {
+ expect(getStorageAlertForecastDaysToFull(alert())).toBeNull();
+ expect(getStorageAlertForecastDaysToFull(alert({ forecastDaysToFull: '4' }))).toBeNull();
+ expect(getStorageAlertForecastDaysToFull(alert({ forecastDaysToFull: Number.NaN }))).toBeNull();
+ expect(getStorageAlertForecastDaysToFull(alert({ forecastDaysToFull: -1 }))).toBeNull();
+ });
+});
diff --git a/frontend-modern/src/features/storageBackups/storageRowAlertPresentation.ts b/frontend-modern/src/features/storageBackups/storageRowAlertPresentation.ts
index 30d7a3aa1b..92ea0874ea 100644
--- a/frontend-modern/src/features/storageBackups/storageRowAlertPresentation.ts
+++ b/frontend-modern/src/features/storageBackups/storageRowAlertPresentation.ts
@@ -58,7 +58,7 @@ export const getStorageRowAlertPresentation = (options: {
};
};
-const forecastDaysToFull = (alert: Alert): number | null => {
+export const getStorageAlertForecastDaysToFull = (alert: Alert): number | null => {
const value = alert.metadata?.forecastDaysToFull;
return typeof value === 'number' && Number.isFinite(value) && value >= 0 ? value : null;
};
@@ -71,7 +71,7 @@ export const describeStorageAlertHeadline = (
alert: Alert,
options: { compact?: boolean } = {},
): string => {
- const days = forecastDaysToFull(alert);
+ const days = getStorageAlertForecastDaysToFull(alert);
if (days !== null) {
if (days < 1) return options.compact ? 'Full <1d' : 'Full within a day';
const rounded = Math.max(1, Math.round(days));