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.

Keep row, drawer and replication ages moving on the shared clock

rcourtman75e4ed44a63c
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 4772ac4a62..96d34e3b13 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -5190,6 +5190,15 @@ and the platform alert tables pass it as `now` to `formatRelativeTime` /
data refreshes, so an age computed only at render froze ("2h ago" three hours
later) whenever its timestamp did not change. A relative-age cell must read the
shared clock rather than `Date.now()` at render or a table-local interval.
+That rule covers every relative age, not only `PlatformTableRelativeTimeValue`
+cells: a value formatted through `formatPlatformTableRelativeTimeValue` or
+`formatRelativeTime` (compact phone ages, labelled Detail ages, row subtitles
+and tooltips, an open drawer's summary rows and annotations) passes `now` from
+the owning component's `useRelativeTimeNow`, and a countdown or freshness band
+derived from the same time (replication Next sync, backup age bands) reads it
+too. The clock can trail the wall clock by up to one tick, so a check that
+treats a future time as invalid (the backup age band) measures from the later
+of the two.
Read-only metadata badges follow the same primitive-owned shell rule.
`frontend-modern/src/components/shared/MetadataBadge.tsx` owns filled and
outlined appearances, compact sizing, shape, typed tone vocabulary, fit
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index ebbc81311a..a0a1c4fc91 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -983,6 +983,18 @@ Proxmox backup source/state chips are also a frontend-primitives boundary:
badge tones, `proxmoxBackupsTableShared.tsx` owns the backup table helper
composition, and visible source/state chips must render through `MetadataBadge`
instead of restoring local rounded-sm xs badge spans.
+Backup ages read the frontend-primitives shared relative-time clock:
+`ProxmoxBackupAgeText` measures the full and compact age text and its
+current, aging, or stale band from `useRelativeTimeNow`, never earlier than the
+wall clock, so a backup row that stays mounted for days moves from current to
+aging without new inventory, and a backup that finished inside the clock's last
+tick never bands as a future, unknown age. `ProxmoxPageSurface` reads
+replication jobs through `createNonSuspendingQuery` with a 30-second background
+poll, because the Replication table's Last sync and Next sync move on the same
+clock: a failed read reports the error but keeps the last jobs and the tab, and
+a direct replication link holds until the first read resolves instead of
+falling back to Overview. The poll re-reads the existing read-only
+`/api/replication/jobs` snapshot and opens no new storage or recovery path.
Proxmox backup-health and recoverable-artifact summary rows follow the same
platform-table density contract as every other provider surface. Storage and
recovery owns which backup, datastore, workload-type, and VMID facts matter to
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 3804b3df91..5ec26b8341 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -1250,6 +1250,21 @@ platform-details disclosure. The `KubernetesControllersTable` phone projection
keeps controller, kind, ready, and issues and demotes Target with
`platform-table-phone-hidden`, so kind labels such as `DaemonSet` and
`StatefulSet` fit whole instead of clipping in a 15 percent track.
+Every relative age a unified-resource consumer derives from a timestamp reads
+the frontend-primitives shared relative-time clock (`useRelativeTimeNow`)
+rather than `Date.now()` at render, because rows and open drawers stay mounted
+while a timestamp that has stopped changing must keep aging: the Kubernetes
+controller Detail ages and the drawer's controller section, the drawer's Docker
+container Created, Started and Finished rows, its Last seen, and its Docker
+update-check and Mail Gateway updated ages, the Machines identity subtitle
+(`seen ...` while the Last seen column is hidden) and stale-agent Last report
+tooltip, and the Proxmox replication Last sync and Next sync in the row, phone
+projection and disclosure. A silent agent or a stalled pvesr scheduler is the
+case whose age matters most, so a replication Next sync turns overdue on the
+clock without new data. Replication jobs bypass the unified-resource stream,
+so `ProxmoxPageSurface` re-reads them in the background every 30 seconds;
+moving ages over a snapshot read once at mount would age a job that keeps
+syncing and count it overdue.
Kubernetes name columns hold the chevron, status dot and name inside one
track, so their md widths leave the name room for a typical node or service
name at a 768px viewport: Nodes 20 percent (with Capacity at 16 so its
diff --git a/frontend-modern/browser-verification/21de9738e48c4db3.json b/frontend-modern/browser-verification/21de9738e48c4db3.json
new file mode 100644
index 0000000000..88e0f845d6
--- /dev/null
+++ b/frontend-modern/browser-verification/21de9738e48c4db3.json
@@ -0,0 +1,58 @@
+{
+ "version": 1,
+ "base_sha": "7aa537abe112e5f0b9c043885c62bc255b700134",
+ "verified_at": "2026-10-06T13:58:52Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/components/Infrastructure/ResourceDetailSummary.tsx",
+ "frontend-modern/src/components/Infrastructure/resourceDetailDrawerKubernetesModel.ts",
+ "frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts",
+ "frontend-modern/src/features/kubernetes/KubernetesControllersTable.tsx",
+ "frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx",
+ "frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsx",
+ "frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx",
+ "frontend-modern/src/features/standalone/AgentsMachinesTable.tsx"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/Infrastructure/ResourceDetailSummary.tsx": "7f789e2e38fab255bd080a647b1f9d20185419c336974bc188fa9c2dec3c2e06",
+ "frontend-modern/src/components/Infrastructure/resourceDetailDrawerKubernetesModel.ts": "34de374717a338b6d7417e0264f3ed1f106c965262a88336a52a3ebe1e0e3208",
+ "frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts": "a0c08531c1b3c9eba9827ddf02ece46e55ca6eece7629b9b005653ac5129b6ef",
+ "frontend-modern/src/features/kubernetes/KubernetesControllersTable.tsx": "262e641559d38ccadacf45a74a37b3ec95cbb58887c5ab620b966d369cd9a638",
+ "frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx": "147ce30feded49cbe9bf833daa78edd1a6fbcff6db419d9303b21e62c9fe00e3",
+ "frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsx": "9da12964e02d081b80c848db8741f69d701f8c99e73ed01e9c8958c9d6b51930",
+ "frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx": "4d6c1097737138d1dd6b1ecfc28ee33b0815ffa78279120bcb524cea38053d2a",
+ "frontend-modern/src/features/standalone/AgentsMachinesTable.tsx": "b9c718460ec18d6ef0a72b2fe9d291e0e813feaecfc6d4cd2f8694cda467fbdf"
+ },
+ "routes": [
+ "/kubernetes/workloads",
+ "/proxmox/backups",
+ "/proxmox/replication",
+ "/standalone/machines"
+ ],
+ "viewports": [
+ {
+ "width": 1600,
+ "height": 1000
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "states": [
+ "Private mock stack built from this tree; Playwright page.clock installed at load, /ws held after first render (server frames dropped) and REST GETs replayed from their last response, then the clock fast-forwarded with no data change",
+ "Kubernetes workloads 1600px: Job/CronJob Detail \"Completed 48m ago\" / \"Last success 1h ago\" -> \"Completed 3h ago\" / \"Last success 4h ago\" after 3h",
+ "Kubernetes Job row expansion: controller section \"01:59 PM (48m ago)\" -> \"01:59 PM (3h ago)\" with the absolute time unchanged; Runtime context Last seen \"1s ago\" -> \"3 hours ago\"",
+ "Proxmox backups 1600px and 390px: tracked artifact \"1d ago\" / \"1d\" in the current (green) band -> \"8d ago\" / \"8d\" in the aging (amber) band, title \"Aging backup age\", after 7 days",
+ "Proxmox replication 1600px: row and expanded Last sync \"21m ago\" -> \"3h ago\", Next sync \"in 8m\" -> \"2h overdue\" in red after 3h; one background /api/replication/jobs read fired during the jump",
+ "Proxmox replication 390px compact row: Last sync \"21m\" -> \"3h\", Next sync \"8m\" -> \"-2h\"",
+ "Machines 1600px with Last seen column hidden: identity title \"| seen just now\" -> \"| seen 3h ago\"; 390px Seen cells \"just now\" -> \"3h ago\"",
+ "Control on the same stack with the seven runtime files swapped back to the parent: Kubernetes Detail and expansion, replication expanded Last sync / Next sync and phone row, machines subtitle, and phone backup ages stayed frozen; desktop backup text moved but the band stayed green"
+ ],
+ "interactions": [
+ "Clicked a Kubernetes Job controller row to open its expansion",
+ "Clicked \"Expand details for replication job 100-0\"",
+ "Opened View > Choose which columns to display and unchecked Last seen on Machines",
+ "page.clock.fastForward 3h (Kubernetes, replication, machines) and 7 days (backups) with data held"
+ ]
+}
diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailSummary.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailSummary.tsx
index 86783aec53..adb1a78581 100644
--- a/frontend-modern/src/components/Infrastructure/ResourceDetailSummary.tsx
+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailSummary.tsx
@@ -11,6 +11,7 @@ import {
} from '@/components/shared/detailSectionModel';
import { TagBadges } from '@/components/shared/TagBadges';
import { formatBytes, formatRelativeTime, formatUptime } from '@/utils/format';
+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import { getDockerImageRegistryLink } from '@/features/docker/dockerImageReference';
import {
getDockerContainerHealthCheckPresentation,
@@ -92,7 +93,7 @@ const dockerRuntimeRow = (
})
: null;
-const dockerSection = (docker: NonNullable<Resource['docker']>): DetailSection => {
+const dockerSection = (docker: NonNullable<Resource['docker']>, now: number): DetailSection => {
const labels = docker.labels ?? {};
const labelEntries = Object.entries(labels);
const createdAt = dockerTimestampMillis(docker.createdAt);
@@ -157,17 +158,17 @@ const dockerSection = (docker: NonNullable<Resource['docker']>): DetailSection =
})
: null,
createdAt
- ? makeDetailRow('Created', formatRelativeTime(createdAt), {
+ ? makeDetailRow('Created', formatRelativeTime(createdAt, { now }), {
title: new Date(createdAt).toLocaleString(),
})
: null,
startedAt
- ? makeDetailRow('Started', formatRelativeTime(startedAt), {
+ ? makeDetailRow('Started', formatRelativeTime(startedAt, { now }), {
title: new Date(startedAt).toLocaleString(),
})
: null,
finishedAt
- ? makeDetailRow('Finished', formatRelativeTime(finishedAt), {
+ ? makeDetailRow('Finished', formatRelativeTime(finishedAt, { now }), {
title: new Date(finishedAt).toLocaleString(),
})
: null,
@@ -210,6 +211,10 @@ const dockerSection = (docker: NonNullable<Resource['docker']>): DetailSection =
};
export const InlineResourceSummaryTables: Component<ResourceSummaryPresentationProps> = (props) => {
+ // An open drawer keeps its rows while the resource's timestamps stay the
+ // same, so container and controller ages read the shared clock to keep
+ // moving.
+ const now = useRelativeTimeNow();
const sections = (): DetailSection[] => {
const docker = dockerContainerMeta(props.resource);
const uptimeSeconds = docker
@@ -317,8 +322,8 @@ export const InlineResourceSummaryTables: Component<ResourceSummaryPresentationP
]),
}
: null,
- props.content !== 'overview' && docker ? dockerSection(docker) : null,
- props.content !== 'overview' ? buildKubernetesControllerSection(props.resource) : null,
+ props.content !== 'overview' && docker ? dockerSection(docker, now()) : null,
+ props.content !== 'overview' ? buildKubernetesControllerSection(props.resource, now()) : null,
props.content !== 'overview'
? {
label: 'Identity',
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailSummary.relativeAge.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailSummary.relativeAge.test.tsx
new file mode 100644
index 0000000000..bf17540823
--- /dev/null
+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailSummary.relativeAge.test.tsx
@@ -0,0 +1,143 @@
+import { cleanup, render, screen, within } from '@solidjs/testing-library';
+import { createRoot } from 'solid-js';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+
+import { formatPlatformTableDateTimeValue } from '@/features/platformPage/sharedPlatformPage';
+import type { Resource } from '@/types/resource';
+import { InlineResourceSummaryTables } from '../ResourceDetailSummary';
+import { useResourceDetailDrawerDerivedState } from '../useResourceDetailDrawerDerivedState';
+import type { UseResourceDetailDrawerStateResult } from '../useResourceDetailDrawerState';
+
+// The summary only reads identity and coverage accessors from the drawer
+// state; the ages under test come from the resource itself.
+const drawerState = {
+ primaryIdentityRows: () => [],
+ identityIpValues: () => [],
+ identityAliasValues: () => [],
+ aliasPreviewValues: () => [],
+ hasAliasOverflow: () => false,
+ identityCardHasRichData: () => true,
+ sourceSummary: () => null,
+ lastSeen: () => '',
+ lastSeenAbsolute: () => '',
+} as unknown as UseResourceDetailDrawerStateResult;
+
+const makeResource = ({
+ id,
+ type,
+ ...overrides
+}: Partial<Resource> & Pick<Resource, 'id' | 'type'>): Resource => ({
+ id,
+ name: id,
+ displayName: id,
+ platformId: 'host-1',
+ platformType: 'kubernetes',
+ sourceType: 'agent',
+ status: 'online',
+ type,
+ lastSeen: Date.parse('2026-05-24T13:31:00Z'),
+ ...overrides,
+});
+
+const absoluteTime = (timestamp: string): string =>
+ formatPlatformTableDateTimeValue(timestamp, { dateTimeFormat: { year: 'numeric' } });
+
+afterEach(() => {
+ cleanup();
+ vi.useRealTimers();
+});
+
+describe('resource drawer summary relative ages', () => {
+ it('keeps an open Kubernetes controller summary age moving without new data', () => {
+ vi.useFakeTimers({ now: new Date('2026-05-24T13:31:00Z') });
+
+ render(() => (
+ <InlineResourceSummaryTables
+ resource={makeResource({
+ id: 'nightly-import',
+ type: 'k8s-job',
+ kubernetes: {
+ clusterName: 'prod',
+ namespace: 'batch',
+ resourceKind: 'Job',
+ completionTime: '2026-05-24T13:00:00Z',
+ },
+ })}
+ drawer={drawerState}
+ showPlatformId={false}
+ />
+ ));
+
+ const section = () => screen.getByTestId('resource-kubernetes-controller-section');
+ expect(
+ within(section()).getByText(`${absoluteTime('2026-05-24T13:00:00Z')} (31m ago)`),
+ ).toBeInTheDocument();
+
+ vi.advanceTimersByTime(2 * 60 * 60 * 1000);
+
+ // The absolute time is unchanged; only the age after it moves.
+ expect(
+ within(section()).getByText(`${absoluteTime('2026-05-24T13:00:00Z')} (2h ago)`),
+ ).toBeInTheDocument();
+ });
+
+ it('keeps an open container summary Created and Started ages moving without new data', () => {
+ vi.useFakeTimers({ now: new Date('2026-05-24T13:31:00Z') });
+
+ render(() => (
+ <InlineResourceSummaryTables
+ resource={makeResource({
+ id: 'web',
+ type: 'app-container',
+ platformType: 'docker',
+ docker: {
+ containerId: 'abc123',
+ containerState: 'running',
+ createdAt: '2026-05-24T11:31:00Z',
+ startedAt: '2026-05-24T13:21:00Z',
+ },
+ })}
+ drawer={drawerState}
+ showPlatformId={false}
+ />
+ ));
+
+ const row = (label: string) =>
+ within(screen.getByTestId('resource-docker-container-section'))
+ .getByText(label)
+ .closest('tr');
+ expect(row('Created')).toHaveTextContent('2 hours ago');
+ expect(row('Started')).toHaveTextContent('10 mins ago');
+
+ vi.advanceTimersByTime(3 * 60 * 60 * 1000);
+
+ expect(row('Created')).toHaveTextContent('5 hours ago');
+ expect(row('Started')).toHaveTextContent('3 hours ago');
+ });
+
+ it('keeps an open drawer Last seen moving for a resource that stops reporting', () => {
+ vi.useFakeTimers({ now: new Date('2026-05-24T13:31:00Z') });
+
+ const { state, dispose } = createRoot((dispose) => ({
+ state: useResourceDetailDrawerDerivedState({
+ resource: makeResource({
+ id: 'node-1',
+ type: 'agent',
+ lastSeen: Date.parse('2026-05-24T13:30:00Z'),
+ }),
+ debugEnabled: () => false,
+ discoveryFeatureEnabled: () => false,
+ resourceIntelligence: () => null,
+ }),
+ dispose,
+ }));
+
+ expect(state.lastSeen()).toBe('1 min ago');
+
+ // The resource stays silent: its lastSeen never changes again.
+ vi.advanceTimersByTime(2 * 60 * 60 * 1000);
+
+ expect(state.lastSeen()).toBe('2 hours ago');
+ dispose();
+ });
+});
diff --git a/frontend-modern/src/components/Infrastructure/resourceDetailDrawerKubernetesModel.ts b/frontend-modern/src/components/Infrastructure/resourceDetailDrawerKubernetesModel.ts
index 2d44225f6b..bfd5a21fa0 100644
--- a/frontend-modern/src/components/Infrastructure/resourceDetailDrawerKubernetesModel.ts
+++ b/frontend-modern/src/components/Infrastructure/resourceDetailDrawerKubernetesModel.ts
@@ -147,8 +147,14 @@ const dangerWhenPositive = (count: number): DetailValueTone => (count > 0 ? 'dan
// Kubernetes reports controller timestamps as RFC 3339 strings. The table row
// only has room for an age, so the expansion carries the absolute time first
// and the age after it: "Oct 2, 2026, 09:13 PM (1h ago)". The value wraps
-// because a phone-width detail cell is too narrow for both on one line.
-const timestampRow = (label: string, timestamp?: string | null): DetailRow | null => {
+// because a phone-width detail cell is too narrow for both on one line. The
+// age is measured from `now`, which an open drawer passes from the shared
+// relative-time clock so the age keeps moving while the drawer stays open.
+const timestampRow = (
+ label: string,
+ timestamp: string | null | undefined,
+ now: number | undefined,
+): DetailRow | null => {
const raw = asString(timestamp);
if (!raw) return null;
const absolute = formatPlatformTableDateTimeValue(raw, {
@@ -156,7 +162,7 @@ const timestampRow = (label: string, timestamp?: string | null): DetailRow | nul
dateTimeFormat: { year: 'numeric' },
});
if (!absolute) return makeRow(label, raw, { wrap: true });
- const relative = formatPlatformTableRelativeTimeValue(raw, { emptyText: '' });
+ const relative = formatPlatformTableRelativeTimeValue(raw, { emptyText: '', now });
return makeRow(label, relative ? `${absolute} (${relative})` : absolute, { wrap: true });
};
@@ -173,7 +179,7 @@ type ControllerRows = { label: string; rows: Array<DetailRow | null> };
// Each kind leads with what its narrow table row drops: the Detail column
// (service name, timestamps) below the large layout and Target on a phone.
-const controllerRows = (resource: Resource): ControllerRows | null => {
+const controllerRows = (resource: Resource, now: number | undefined): ControllerRows | null => {
const k = resource.kubernetes;
if (!k) return null;
switch (resource.type) {
@@ -218,8 +224,8 @@ const controllerRows = (resource: Resource): ControllerRows | null => {
return {
label: 'Job',
rows: [
- timestampRow('Started', k.startTime),
- timestampRow('Completed', k.completionTime),
+ timestampRow('Started', k.startTime, now),
+ timestampRow('Completed', k.completionTime, now),
makeRow(
'Duration',
formatPlatformTableDurationValue(elapsedSeconds(k.startTime, k.completionTime), {
@@ -237,8 +243,8 @@ const controllerRows = (resource: Resource): ControllerRows | null => {
label: 'CronJob',
rows: [
makeRow('Schedule', k.schedule, { valueClass: 'font-mono' }),
- timestampRow('Last run', k.lastScheduleTime),
- timestampRow('Last success', k.lastSuccessfulTime),
+ timestampRow('Last run', k.lastScheduleTime, now),
+ timestampRow('Last success', k.lastSuccessfulTime, now),
makeRow('Suspended', k.suspend === true ? 'Yes' : null, { tone: 'warning' }),
countRow('Active', k.active),
],
@@ -253,8 +259,11 @@ const controllerRows = (resource: Resource): ControllerRows | null => {
// controllers table hides Scope and Detail below its large layout and Target
// on a phone, so without this a Job's completion time or a CronJob's last
// success is unreachable from a narrow row.
-export const buildKubernetesControllerSection = (resource: Resource): DetailSection | null => {
- const controller = controllerRows(resource);
+export const buildKubernetesControllerSection = (
+ resource: Resource,
+ now?: number,
+): DetailSection | null => {
+ const controller = controllerRows(resource, now);
if (!controller) return null;
const rows = compactRows([
...controller.rows,
diff --git a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts
index 66e329b8e3..1b33f7d387 100644
--- a/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts
+++ b/frontend-modern/src/components/Infrastructure/useResourceDetailDrawerDerivedState.ts
@@ -7,6 +7,7 @@ import type { HostNetworkInterface } from '@/types/api';
import { requiresGovernedResourceDisplay } from '@/types/resource';
import type { ResourceVMwareMeta } from '@/types/resource';
import { formatAbsoluteTime, formatRelativeTime } from '@/utils/format';
+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import { getAgentStatusIndicator } from '@/utils/status';
import {
dedupeResourceBadges,
@@ -135,7 +136,11 @@ export const useResourceDetailDrawerDerivedState = (
resolveResourceLabelInput?.(resourceId)?.trim() || resourceId;
const statusIndicator = createMemo(() => getAgentStatusIndicator({ status: resource().status }));
const healthIssue = createMemo(() => getResourceHealthIssuePresentation(resource()));
- const lastSeen = createMemo(() => formatRelativeTime(resource().lastSeen));
+ // An open drawer keeps its rows while a resource's timestamps stay the same,
+ // which is exactly when a silent resource's Last seen must keep aging, so
+ // the drawer's ages read the shared clock.
+ const now = useRelativeTimeNow();
+ const lastSeen = createMemo(() => formatRelativeTime(resource().lastSeen, { now: now() }));
const lastSeenAbsolute = createMemo(() => formatAbsoluteTime(resource().lastSeen));
const platformBadge = createMemo(() => getPlatformBadge(resource().platformType));
@@ -210,7 +215,7 @@ export const useResourceDetailDrawerDerivedState = (
if (!raw) return '';
const parsed = Date.parse(raw);
if (!Number.isFinite(parsed)) return '';
- return formatRelativeTime(parsed);
+ return formatRelativeTime(parsed, { now: now() });
});
const dockerHostCommand = createMemo(() => dockerHostData()?.command);
const dockerHostCommandActive = createMemo(() => {
@@ -278,7 +283,7 @@ export const useResourceDetailDrawerDerivedState = (
if (!raw) return '';
const parsed = Date.parse(raw);
if (!Number.isFinite(parsed)) return '';
- return formatRelativeTime(parsed);
+ return formatRelativeTime(parsed, { now: now() });
});
const pbsVisibleJobBreakdown = createMemo(() => buildPbsVisibleJobBreakdown(pbsData()));
const pbsActiveTasks = createMemo(() => buildPbsActiveTasks(pbsData()));
diff --git a/frontend-modern/src/features/kubernetes/KubernetesControllersTable.tsx b/frontend-modern/src/features/kubernetes/KubernetesControllersTable.tsx
index a70172c5b5..ca11a60e91 100644
--- a/frontend-modern/src/features/kubernetes/KubernetesControllersTable.tsx
+++ b/frontend-modern/src/features/kubernetes/KubernetesControllersTable.tsx
@@ -30,6 +30,7 @@ import {
getPlatformResourceDetailRowClass,
} from '@/features/platformPage/PlatformResourceDetailTableRow';
import type { Resource } from '@/types/resource';
+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import {
compareKubernetesControllers,
filterKubernetesResources,
@@ -137,9 +138,10 @@ const plainDetail = (text: string): ControllerDetail => ({ text, title: text });
// Kubernetes reports job timestamps as RFC 3339 strings with microseconds,
// which never fit the Detail column. The cell says how long ago the event
-// happened and keeps the absolute time on hover.
-const timeDetail = (label: string, timestamp: string): ControllerDetail => {
- const relative = formatPlatformTableRelativeTimeValue(timestamp, { emptyText: '' });
+// happened, measured from the shared clock so it keeps moving while the row
+// stays mounted, and keeps the absolute time on hover.
+const timeDetail = (label: string, timestamp: string, now: number): ControllerDetail => {
+ const relative = formatPlatformTableRelativeTimeValue(timestamp, { emptyText: '', now });
if (!relative) return plainDetail(`${label}: ${timestamp}`);
const absolute = formatPlatformTableDateTimeValue(timestamp, {
dateTimeFormat: { year: 'numeric' },
@@ -147,7 +149,7 @@ const timeDetail = (label: string, timestamp: string): ControllerDetail => {
return { text: `${label} ${relative}`, title: `${label}: ${absolute}` };
};
-const apiDetail = (resource: Resource): ControllerDetail => {
+const apiDetail = (resource: Resource, now: number): ControllerDetail => {
switch (resource.type) {
case 'k8s-replicaset': {
if (typeof resource.kubernetes?.fullyLabeledReplicas === 'number') {
@@ -171,17 +173,17 @@ const apiDetail = (resource: Resource): ControllerDetail => {
);
case 'k8s-job':
if (resource.kubernetes?.completionTime) {
- return timeDetail('Completed', resource.kubernetes.completionTime);
+ return timeDetail('Completed', resource.kubernetes.completionTime, now);
}
return resource.kubernetes?.startTime
- ? timeDetail('Started', resource.kubernetes.startTime)
+ ? timeDetail('Started', resource.kubernetes.startTime, now)
: plainDetail('—');
case 'k8s-cronjob':
if (resource.kubernetes?.lastSuccessfulTime) {
- return timeDetail('Last success', resource.kubernetes.lastSuccessfulTime);
+ return timeDetail('Last success', resource.kubernetes.lastSuccessfulTime, now);
}
return resource.kubernetes?.lastScheduleTime
- ? timeDetail('Last run', resource.kubernetes.lastScheduleTime)
+ ? timeDetail('Last run', resource.kubernetes.lastScheduleTime, now)
: plainDetail('—');
default:
return plainDetail('—');
@@ -245,6 +247,7 @@ export const KubernetesControllersTable: Component<{
externalSearch?: () => string;
externalStatus?: () => KubernetesResourceStatusFilter;
}> = (props) => {
+ const now = useRelativeTimeNow();
const singleCluster = createMemo(() => isSingleKubernetesCluster(props.resources));
const tableState = createPlatformTableFilterState({
resources: () => props.resources,
@@ -402,7 +405,7 @@ export const KubernetesControllersTable: Component<{
const kind = () => controllerKind(resource);
const target = () => targetValue(resource);
const exceptions = () => exceptionSummary(resource);
- const detail = () => apiDetail(resource);
+ const detail = () => apiDetail(resource, now());
const detailRowId = () => drawer.detailRowId(resource);
const isExpanded = () => drawer.isExpanded(resource);
diff --git a/frontend-modern/src/features/kubernetes/__tests__/KubernetesControllersTable.relativeAge.test.tsx b/frontend-modern/src/features/kubernetes/__tests__/KubernetesControllersTable.relativeAge.test.tsx
new file mode 100644
index 0000000000..7b547bf664
--- /dev/null
+++ b/frontend-modern/src/features/kubernetes/__tests__/KubernetesControllersTable.relativeAge.test.tsx
@@ -0,0 +1,94 @@
+import { cleanup, render, screen } from '@solidjs/testing-library';
+import { afterEach, describe, expect, it, vi } from 'vitest';
+
+vi.mock('@/contexts/appRuntime', async (importOriginal) => ({
+ ...(await importOriginal<typeof import('@/contexts/appRuntime')>()),
+ useWebSocket: () => ({ activeAlerts: {} }),
+}));
+
+vi.mock('@/api/resources', () => ({
+ ResourceAPI: {
+ getFacetBundle: vi.fn().mockResolvedValue({
+ capabilities: [],
+ relationships: [],
+ recentChanges: [],
+ }),
+ },
+}));
+
+import type { Resource } from '@/types/resource';
+import { KubernetesControllersTable } from '../KubernetesControllersTable';
+
+const makeResource = ({
+ id,
+ type,
+ ...overrides
+}: Partial<Resource> & Pick<Resource, 'id' | 'type'>): Resource => ({
+ id,
+ name: id,
+ displayName: id,
+ platformId: 'cluster-1',
+ platformType: 'kubernetes',
+ sourceType: 'agent',
+ sources: ['kubernetes'],
+ status: 'online',
+ type,
+ lastSeen: 1_700_000_000_000,
+ ...overrides,
+});
+
+afterEach(() => {
+ cleanup();
+ vi.useRealTimers();
+});
+
+describe('KubernetesControllersTable relative ages', () => {
+ it('keeps Job and CronJob detail ages moving while the rows stay mounted', () => {
+ vi.useFakeTimers({ now: new Date('2026-05-24T13:31:00Z') });
+
+ render(() => (
+ <KubernetesControllersTable
+ resources={[
+ makeResource({
+ id: 'nightly-import',
+ type: 'k8s-job',
+ kubernetes: {
+ clusterName: 'prod',
+ namespace: 'batch',
+ resourceKind: 'Job',
+ desiredReplicas: 1,
+ succeeded: 1,
+ completionTime: '2026-05-24T13:00:00Z',
+ },
+ }),
+ makeResource({
+ id: 'billing-rollup',
+ type: 'k8s-cronjob',
+ kubernetes: {
+ clusterName: 'prod',
+ namespace: 'batch',
+ resourceKind: 'CronJob',
+ schedule: '0 * * * *',
+ lastSuccessfulTime: '2026-05-24T12:55:00Z',
+ },
+ }),
+ ]}
+ emptyIcon={<span />}
+ emptyTitle="No controllers"
+ emptyDescription="No controllers"
+ showToolbar={false}
+ />
+ ));
+
+ expect(screen.getByText('Completed 31m ago')).toBeInTheDocument();
+ expect(screen.getByText('Last success 36m ago')).toBeInTheDocument();
+
+ // No data changes: the timestamps stay put and only the clock moves. A
+ // detail computed once at render would still read "31m ago" here.
+ vi.advanceTimersByTime(3 * 60 * 60 * 1000);
+
+ expect(screen.getByText('Completed 3h ago')).toBeInTheDocument();
+ expect(screen.getByText('Last success 3h ago')).toBeInTheDocument();
+ expect(screen.queryByText('Completed 31m ago')).not.toBeInTheDocument();
+ });
+});
diff --git a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
index d40ce5bf2c..adfd9cc874 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
@@ -1,12 +1,5 @@
import { useLocation } from '@solidjs/router';
-import {
- Show,
- createEffect,
- createMemo,
- createResource,
- createSignal,
- type Accessor,
-} from 'solid-js';
+import { Show, createEffect, createMemo, createSignal, type Accessor } from 'solid-js';
import StorageSurface from '@/components/Storage/Storage';
import { WorkloadsFilter } from '@/components/Workloads/WorkloadsFilter';
import { WorkloadsSurface } from '@/components/Workloads/WorkloadsSurface';
@@ -58,7 +51,9 @@ import { ProxmoxCephTable } from './ProxmoxCephTable';
import { ProxmoxMailGatewayTable } from './ProxmoxMailGatewayTable';
import { ProxmoxNodesTable } from './ProxmoxNodesTable';
import { ProxmoxReplicationTable, fetchReplicationJobs } from './ProxmoxReplicationTable';
+import { createNonSuspendingQuery } from '@/hooks/createNonSuspendingQuery';
import { useUnifiedResources } from '@/hooks/useUnifiedResources';
+import type { ReplicationJob } from '@/types/api';
import type { Resource } from '@/types/resource';
import { updateStore } from '@/stores/updates';
import {
@@ -85,6 +80,8 @@ const PROXMOX_PLATFORM_FILTER = 'proxmox-all';
const PROXMOX_WORKLOAD_STATUS_STORAGE_SCOPE = 'proxmox';
const PROXMOX_WORKLOAD_EXCLUDED_TYPES = ['app-container'] as const;
const PHONE_MOUNTED_TAB_LIMIT = 2;
+const REPLICATION_JOBS_POLL_MS = 30_000;
+const NO_REPLICATION_JOBS: ReplicationJob[] = [];
const VALID_TABS = new Set<ProxmoxPageTabId>(PROXMOX_TAB_SPECS.map((tab) => tab.id));
const PROXMOX_WORKLOAD_STATUS_OPTIONS: readonly WorkloadsStatusOption[] = [
{ value: 'all', label: 'All' },
@@ -123,13 +120,18 @@ export function ProxmoxPageSurface() {
});
// Replication jobs come straight from /api/replication/jobs (they bypass
// the unified-resource pipeline), so the surface owns the fetch: the job
- // count gates the Replication tab and the same data feeds the table.
- // Reading an errored resource throws, hence the `.error` guards.
- const [replicationJobs, { refetch: refetchReplicationJobs }] =
- createResource(fetchReplicationJobs);
- const replicationJobCount = createMemo(() =>
- replicationJobs.error ? 0 : (replicationJobs() ?? []).length,
- );
+ // count gates the Replication tab and the same data feeds the table. The
+ // read polls in the background because the table's Last sync and Next sync
+ // keep moving on the shared clock: a snapshot read once at mount would age
+ // a job that keeps syncing and count it overdue. A failed poll keeps the
+ // last jobs, so the tab does not vanish under the user.
+ const replicationJobs = createNonSuspendingQuery({
+ source: () => 'proxmox-pve',
+ fetcher: () => fetchReplicationJobs(),
+ initialValue: NO_REPLICATION_JOBS,
+ pollMs: REPLICATION_JOBS_POLL_MS,
+ });
+ const replicationJobCount = createMemo(() => replicationJobs.value().length);
const visibleTabs = createMemo(() => {
// An unknown snapshot is not evidence that every optional integration is
// present. Never use estate-wide aggregations here: unrelated VMware VMs
@@ -146,7 +148,9 @@ export function ProxmoxPageSurface() {
const requested = requestedTab();
// Do not discard a direct link while counts are still unknown: its own
// resource query must be allowed to hydrate before deciding it is absent.
- return !tabEvidence.facets?.() || visibleTabIds().has(requested) ? requested : 'overview';
+ const countsUnknown =
+ !tabEvidence.facets?.() || (requested === 'replication' && !replicationJobs.resolvedOnce());
+ return countsUnknown || visibleTabIds().has(requested) ? requested : 'overview';
});
const shouldHydrateTab = (tab: ProxmoxPageTabId) => activeTab() === tab;
const overviewResources = useUnifiedResources({
@@ -403,9 +407,9 @@ export function ProxmoxPageSurface() {
</Show>
<Show when={activeTab() === 'replication'}>
<ProxmoxReplicationTable
- jobs={replicationJobs.error ? undefined : replicationJobs()}
- error={replicationJobs.error}
- onRetry={() => void refetchReplicationJobs()}
+ jobs={replicationJobs.resolvedOnce() ? replicationJobs.value() : undefined}
+ error={replicationJobs.error() ?? undefined}
+ onRetry={() => void replicationJobs.refetch()}
emptyIcon={<ProxmoxIcon class="h-6 w-6 text-slate-400" />}
emptyTitle="No replication jobs"
emptyDescription="Replication jobs appear here once PVE is configured to replicate guests between nodes."
diff --git a/frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsx
index 2f635487d1..918f4d8486 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsx
@@ -6,6 +6,7 @@ import { StatusDot } from '@/components/shared/StatusDot';
import type { StatusIndicatorVariant } from '@/utils/status';
import { TableCell, TableHead, TableRow } from '@/components/shared/Table';
import { apiFetch } from '@/utils/apiClient';
+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import {
PlatformTableToolbar,
PlatformErrorState,
@@ -234,8 +235,10 @@ const NEXT_SYNC_TONE_CLASS: Record<NextSyncTone, string> = {
// An overdue next-sync is the one signal that catches a stalled pvesr
// scheduler even while the last sync still reports ok, so it gets its own
// column instead of folding into the status pill (which mirrors PVE's own
-// job state).
-function nextSyncFor(job: ReplicationJob): { text: string; tone: NextSyncTone } {
+// job state). The countdown is measured from the shared relative-time clock:
+// a stalled scheduler leaves nextSync unchanged, so a countdown read once at
+// render would sit at "in 3m" and never turn overdue.
+function nextSyncFor(job: ReplicationJob, now: number): { text: string; tone: NextSyncTone } {
if (!job.enabled) return { text: '—', tone: 'muted' };
let target = 0;
if (job.nextSyncUnix && job.nextSyncUnix > 0) {
@@ -246,7 +249,7 @@ function nextSyncFor(job: ReplicationJob): { text: string; tone: NextSyncTone }
if (Number.isFinite(parsed)) target = parsed;
}
if (!target) return { text: '—', tone: 'muted' };
- const minutes = Math.floor((target - Date.now()) / 60_000);
+ const minutes = Math.floor((target - now) / 60_000);
if (minutes < 0) {
const overdue = Math.abs(minutes);
const text = overdue < 60 ? `${overdue}m overdue` : `${Math.floor(overdue / 60)}h overdue`;
@@ -283,6 +286,9 @@ export const ProxmoxReplicationTable: Component<{
const [search, setSearch] = createSignal('');
const [status, setStatus] = createSignal<ReplicationStatusFilter>('all');
const [expandedJobKey, setExpandedJobKey] = createSignal<string | null>(null);
+ // Rows stay mounted between job refreshes, so Last sync and Next sync read
+ // the shared clock to keep moving while a job's timestamps do not change.
+ const now = useRelativeTimeNow();
const filterByStatus = (want: ReplicationStatusFilter) => {
const split = splitSearchExclusions(search());
@@ -502,7 +508,7 @@ export const ProxmoxReplicationTable: Component<{
{(job, index) => {
const classification = classifyJob(job);
const ind = indicatorFor(classification);
- const next = nextSyncFor(job);
+ const next = () => nextSyncFor(job, now());
const sourceNode = (job.sourceNode ?? '').trim() || '—';
const targetNode = (job.targetNode ?? '').trim() || '—';
const guestLabel = formatGuestLabel(job);
@@ -607,9 +613,9 @@ export const ProxmoxReplicationTable: Component<{
}
>
<span class="tabular-nums text-[10px]">
- {formatPlatformTableRelativeTimeValue(
- syncTimeValue(job),
- ).replace(/ ago$/, '')}
+ {formatPlatformTableRelativeTimeValue(syncTimeValue(job), {
+ now: now(),
+ }).replace(/ ago$/, '')}
</span>
</Show>
</TableCell>
@@ -618,11 +624,11 @@ export const ProxmoxReplicationTable: Component<{
class={`${getPlatformTableCellClassForKind('numeric-value')} text-base-content ${mobilePaddingClass()}`}
>
<span
- class={`${NEXT_SYNC_TONE_CLASS[next.tone]} ${isCompact() ? 'text-[10px]' : ''}`}
+ class={`${NEXT_SYNC_TONE_CLASS[next().tone]} ${isCompact() ? 'text-[10px]' : ''}`}
>
{isCompact()
- ? compactReplicationNextSyncText(next.text, next.tone)
- : next.text}
+ ? compactReplicationNextSyncText(next().text, next().tone)
+ : next().text}
</span>
</TableCell>
</Show>
@@ -701,13 +707,15 @@ export const ProxmoxReplicationTable: Component<{
<dd class="font-mono text-base-content">{job.schedule || '—'}</dd>
<dt class="font-semibold text-muted">Last sync</dt>
<dd class="text-base-content">
- {formatPlatformTableRelativeTimeValue(syncTimeValue(job))}
+ {formatPlatformTableRelativeTimeValue(syncTimeValue(job), {
+ now: now(),
+ })}
</dd>
<dt class="font-semibold text-muted">Next sync</dt>
<dd
- class={NEXT_SYNC_TONE_CLASS[next.tone] || 'text-base-content'}
+ class={NEXT_SYNC_TONE_CLASS[next().tone] || 'text-base-content'}
>
- {next.text}
+ {next().text}
</dd>
<dt class="font-semibold text-muted">Duration</dt>
<dd class="text-base-content">
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 73a1dee144..f387a48ebb 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
@@ -21,6 +21,7 @@ const mockWorkloadSearch = vi.hoisted(() => vi.fn(() => ''));
const mockSelectedNode = vi.hoisted(() => vi.fn<() => string | null>(() => null));
const mockHandleNodeSelect = vi.hoisted(() => vi.fn());
const mockWorkloadsOptions = vi.hoisted(() => vi.fn());
+const mockFetchReplicationJobs = vi.hoisted(() => vi.fn(() => Promise.resolve([] as unknown[])));
const makeResource = (resource: Partial<Resource> & Pick<Resource, 'id' | 'type'>): Resource =>
({
@@ -152,8 +153,14 @@ vi.mock('../ProxmoxNodesTable', () => ({
}));
vi.mock('../ProxmoxReplicationTable', () => ({
- ProxmoxReplicationTable: () => <div data-testid="replication-table" />,
- fetchReplicationJobs: () => Promise.resolve([]),
+ ProxmoxReplicationTable: (props: { jobs?: unknown[]; error?: unknown }) => (
+ <div
+ data-testid="replication-table"
+ data-jobs={props.jobs === undefined ? 'loading' : props.jobs.length}
+ data-error={props.error ? 'yes' : 'no'}
+ />
+ ),
+ fetchReplicationJobs: () => mockFetchReplicationJobs(),
}));
const renderSurface = () =>
@@ -630,6 +637,69 @@ describe('ProxmoxPageSurface contract', () => {
});
});
+ it('re-reads replication jobs in the background and keeps the tab through a failed read', async () => {
+ vi.useFakeTimers({ toFake: ['setInterval', 'clearInterval'] });
+ mockPathname.mockReturnValue('/proxmox/replication');
+ const node = makeResource({ id: 'node:pve1', type: 'agent', name: 'pve1' });
+ mockUseUnifiedResources.mockReturnValue({
+ resources: () => [node],
+ facets: () => ({ incidentCount: 0, byType: {} }),
+ loading: () => false,
+ error: () => null,
+ refetch: vi.fn(async () => []),
+ });
+ let resolveFirstRead: (jobs: unknown[]) => void = () => undefined;
+ mockFetchReplicationJobs.mockReset();
+ mockFetchReplicationJobs.mockReturnValueOnce(
+ new Promise<unknown[]>((resolve) => {
+ resolveFirstRead = resolve;
+ }),
+ );
+
+ try {
+ renderSurface();
+ const tabs = screen.getByTestId('platform-section-tabs');
+ // Counts are known but the first read is pending: a direct link stays put.
+ expect(tabs).toHaveAttribute('data-active', 'replication');
+ expect(screen.getByTestId('replication-table')).toHaveAttribute('data-jobs', 'loading');
+
+ resolveFirstRead([{ id: 'job-1' }]);
+ await waitFor(() =>
+ expect(screen.getByTestId('replication-table')).toHaveAttribute('data-jobs', '1'),
+ );
+ expect(tabs).toHaveAttribute('data-tabs', 'overview,replication');
+
+ // The table's ages move on the shared clock, so its jobs are re-read in
+ // the background rather than aging a snapshot taken at mount.
+ mockFetchReplicationJobs.mockResolvedValueOnce([{ id: 'job-1' }, { id: 'job-2' }]);
+ vi.advanceTimersByTime(30_000);
+ await waitFor(() =>
+ expect(screen.getByTestId('replication-table')).toHaveAttribute('data-jobs', '2'),
+ );
+
+ // A failed read reports the error but keeps the tab and the user on it.
+ mockFetchReplicationJobs.mockRejectedValueOnce(new Error('replication read failed'));
+ vi.advanceTimersByTime(30_000);
+ await waitFor(() =>
+ expect(screen.getByTestId('replication-table')).toHaveAttribute('data-error', 'yes'),
+ );
+ expect(tabs).toHaveAttribute('data-tabs', 'overview,replication');
+ expect(tabs).toHaveAttribute('data-active', 'replication');
+
+ mockFetchReplicationJobs.mockResolvedValueOnce([{ id: 'job-1' }]);
+ vi.advanceTimersByTime(30_000);
+ await waitFor(() =>
+ expect(screen.getByTestId('replication-table')).toHaveAttribute('data-error', 'no'),
+ );
+ expect(screen.getByTestId('replication-table')).toHaveAttribute('data-jobs', '1');
+ expect(mockFetchReplicationJobs).toHaveBeenCalledTimes(4);
+ } finally {
+ vi.useRealTimers();
+ mockFetchReplicationJobs.mockReset();
+ mockFetchReplicationJobs.mockImplementation(() => Promise.resolve([]));
+ }
+ });
+
it('does not surface stale-agent notices for development builds without an agent target', () => {
mockVersionInfo.mockReturnValue({
version: '6.0.0-rc.6+git.172.g2c360f779.dirty',
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxReplicationTable.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxReplicationTable.test.tsx
index b302446ed7..8e9f45cdec 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxReplicationTable.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxReplicationTable.test.tsx
@@ -1,6 +1,7 @@
import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
import { afterEach, describe, expect, it, vi } from 'vitest';
import type { ReplicationJob } from '@/types/api';
+import { RELATIVE_TIME_TICK_MS } from '@/utils/relativeTimeClock';
import {
ProxmoxReplicationTable,
REPLICATION_MOBILE_COLUMNS,
@@ -132,3 +133,67 @@ describe('ProxmoxReplicationTable', () => {
expect(replicationTableSource).toMatch(/job\.lastSyncStatus,\s*job\.error,\s*job\.comment,/);
});
});
+
+describe('ProxmoxReplicationTable relative times', () => {
+ const start = Date.parse('2026-10-04T12:00:00Z');
+ // Last synced 5 minutes before the table opens, next sync due 10 minutes after.
+ const job = () =>
+ replicationJob({
+ lastSyncUnix: (start - 5 * 60_000) / 1000,
+ nextSyncUnix: (start + 10 * 60_000) / 1000,
+ });
+ const renderTable = () =>
+ render(() => (
+ <ProxmoxReplicationTable
+ jobs={[job()]}
+ error={undefined}
+ onRetry={() => undefined}
+ emptyIcon={<span />}
+ emptyTitle="No replication jobs"
+ emptyDescription="Replication jobs appear here."
+ />
+ ));
+ // Two hours pass with no new job data; the next clock tick re-reads them.
+ const twoHoursLater = () => {
+ vi.setSystemTime(start + 2 * 60 * 60_000);
+ vi.advanceTimersByTime(RELATIVE_TIME_TICK_MS);
+ };
+
+ afterEach(() => vi.useRealTimers());
+
+ it('keeps the compact Last sync and Next sync moving while the job does not change', () => {
+ vi.useFakeTimers({ now: start });
+ vi.spyOn(HTMLElement.prototype, 'clientWidth', 'get').mockReturnValue(400);
+ renderTable();
+
+ expect(screen.getByText('5m')).toBeInTheDocument();
+ expect(screen.getByText('10m')).toBeInTheDocument();
+
+ twoHoursLater();
+
+ // A stalled scheduler leaves nextSync unchanged, so the countdown must
+ // turn overdue on its own.
+ expect(screen.getByText('2h')).toBeInTheDocument();
+ expect(screen.getByText('-1h')).toHaveClass('text-red-600');
+ expect(screen.queryByText('10m')).not.toBeInTheDocument();
+ });
+
+ it('keeps the expanded Last sync and Next sync moving while the job does not change', async () => {
+ vi.useFakeTimers({ now: start });
+ renderTable();
+ await fireEvent.click(
+ screen.getByRole('button', { name: 'Expand details for replication job 100-0' }),
+ );
+ const detail = (label: string) =>
+ screen.getByText(label, { selector: 'dt' }).nextElementSibling as HTMLElement;
+
+ expect(detail('Last sync')).toHaveTextContent('5m ago');
+ expect(detail('Next sync')).toHaveTextContent('in 10m');
+
+ twoHoursLater();
+
+ expect(detail('Last sync')).toHaveTextContent('2h ago');
+ expect(detail('Next sync')).toHaveTextContent('1h overdue');
+ expect(detail('Next sync')).toHaveClass('text-red-600');
+ });
+});
diff --git a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTableShared.test.tsx b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTableShared.test.tsx
index 594501f26a..2d6ec3ca25 100644
--- a/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTableShared.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/proxmoxBackupsTableShared.test.tsx
@@ -1,5 +1,5 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import { cleanup, render, screen } from '@solidjs/testing-library';
+import { cleanup, render, screen, within } from '@solidjs/testing-library';
import { WorkloadTypeBadge } from '@/components/shared/WorkloadTypeBadge';
import proxmoxBackupServersTableSource from '../ProxmoxBackupServersTable.tsx?raw';
import proxmoxCoverageTableSource from '../ProxmoxCoverageTable.tsx?raw';
@@ -13,6 +13,7 @@ import {
SortableHead,
formatCompactBackupAge,
} from '../proxmoxBackupsTableShared';
+import { RELATIVE_TIME_TICK_MS } from '@/utils/relativeTimeClock';
import type { RecoverableArtifact } from '../proxmoxBackupRecoveryModel';
afterEach(cleanup);
@@ -205,3 +206,61 @@ describe('backup-date-evidence age cell', () => {
expect(value.title).toContain(createdAt);
});
});
+
+describe('backup age cell on the shared clock', () => {
+ afterEach(() => vi.useRealTimers());
+
+ it('keeps the age and its freshness band moving while the artifact does not change', () => {
+ vi.useFakeTimers({ now: new Date('2026-10-04T12:00:00Z') });
+ const createdAt = '2026-10-04T06:00:00Z';
+ const backup = artifact({ createdAt, createdMs: Date.parse(createdAt) });
+
+ render(() => (
+ <>
+ <span data-testid="full">
+ <ProxmoxBackupAgeText artifact={backup} />
+ </span>
+ <span data-testid="compact">
+ <ProxmoxBackupAgeText artifact={backup} compact />
+ </span>
+ </>
+ ));
+
+ expect(screen.getByTestId('full')).toHaveTextContent('6h ago');
+ expect(screen.getByText('6h')).toHaveClass('text-emerald-600');
+
+ // Eight days pass with no new backup and no data refresh. The next clock
+ // tick moves both ages and drops the backup out of the current band.
+ vi.setSystemTime(new Date('2026-10-12T12:00:00Z'));
+ vi.advanceTimersByTime(RELATIVE_TIME_TICK_MS);
+
+ expect(screen.getByTestId('full')).toHaveTextContent('8d ago');
+ const compact = screen.getByText('8d');
+ expect(compact).toHaveClass('text-amber-600');
+ expect(compact.closest('[title]')?.getAttribute('title')).toBe(
+ `Aging backup age · ${createdAt}`,
+ );
+ });
+
+ it('does not band a backup that finished after the last clock tick as unknown', () => {
+ vi.useFakeTimers({ now: new Date('2026-10-04T12:00:00Z') });
+ // Another mounted cell starts the shared clock at 12:00:00.
+ render(() => <ProxmoxBackupAgeText artifact={artifact()} />);
+
+ // A backup that finished 20s later arrives before the next tick.
+ vi.setSystemTime(new Date('2026-10-04T12:00:25Z'));
+ const createdAt = '2026-10-04T12:00:20Z';
+ render(() => (
+ <span data-testid="fresh">
+ <ProxmoxBackupAgeText
+ artifact={artifact({ createdAt, createdMs: Date.parse(createdAt) })}
+ compact
+ />
+ </span>
+ ));
+
+ const fresh = within(screen.getByTestId('fresh')).getByText('now');
+ expect(fresh).toHaveClass('text-emerald-600');
+ expect(screen.queryByText('Unknown')).not.toBeInTheDocument();
+ });
+});
diff --git a/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx b/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx
index a82b9c27eb..4828f3f754 100644
--- a/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx
+++ b/frontend-modern/src/features/proxmox/proxmoxBackupsTableShared.tsx
@@ -10,6 +10,7 @@ import {
PlatformTableRelativeTimeValue,
formatPlatformTableRelativeTimeValue,
} from '@/features/platformPage/sharedPlatformPage';
+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import {
getRecoveryAgeBand,
@@ -224,14 +225,20 @@ export function RowMetricBar(props: {
// Phone columns are too narrow for "18h ago", so the compact form drops the
// suffix ("18h", "now") and keeps the full age band and timestamp on hover.
-export function formatCompactBackupAge(createdAt: string): string {
- const relative = formatPlatformTableRelativeTimeValue(createdAt);
+export function formatCompactBackupAge(createdAt: string, now?: number): string {
+ const relative = formatPlatformTableRelativeTimeValue(createdAt, { now });
if (relative === 'just now') return 'now';
return relative.replace(/ ago$/, '');
}
export function ProxmoxBackupAgeText(props: { artifact: RecoverableArtifact; compact?: boolean }) {
- const band = () => getRecoveryAgeBand(props.artifact.createdMs);
+ // Backup rows stay mounted while an artifact's creation time never changes,
+ // so the age and its freshness band both read the shared clock. The clock
+ // can trail the wall clock by up to one tick, and a backup that finished
+ // inside that window must not band as a future (unknown) age.
+ const tickNow = useRelativeTimeNow();
+ const now = () => Math.max(tickNow(), Date.now());
+ const band = () => getRecoveryAgeBand(props.artifact.createdMs, now());
const title = () => {
if (band() === 'unknown') return recoveryAgeTitleByBand.unknown;
const parts = [recoveryAgeTitleByBand[band()], props.artifact.createdAt].filter(Boolean);
@@ -250,7 +257,7 @@ export function ProxmoxBackupAgeText(props: { artifact: RecoverableArtifact; com
when={props.compact}
fallback={<PlatformTableRelativeTimeValue value={props.artifact.createdAt} />}
>
- {formatCompactBackupAge(props.artifact.createdAt)}
+ {formatCompactBackupAge(props.artifact.createdAt, now())}
</Show>
</Show>
</span>
diff --git a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
index 4b99ca84a0..2015ac6092 100644
--- a/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
+++ b/frontend-modern/src/features/standalone/AgentsMachinesTable.tsx
@@ -73,6 +73,7 @@ import {
} from '@/utils/raidPresentation';
import { asTrimmedString } from '@/utils/stringUtils';
import { getPreferredResourceIP } from '@/utils/resourceIdentity';
+import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
import {
RESOURCE_METADATA_CHANGED_EVENT,
type ResourceMetadataChangedDetail,
@@ -1174,6 +1175,9 @@ export const AgentsMachinesTable: Component<{
onExternalStatusChange?: (value: PlatformResourceStatusFilter) => void;
onResetFilters?: () => void;
}> = (props) => {
+ // A machine that stops reporting keeps the same last-seen time, which is
+ // exactly when its age must keep moving, so row ages read the shared clock.
+ const now = useRelativeTimeNow();
const [locallyRemovedResourceIds, setLocallyRemovedResourceIds] = createSignal<
Record<string, boolean>
>({});
@@ -1482,7 +1486,7 @@ export const AgentsMachinesTable: Component<{
const agentStaleTitle = () => {
const last = asTrimmedString(machine.agent?.lastReportAt);
const when = last
- ? ` Last report ${formatPlatformTableRelativeTimeValue(last)}.`
+ ? ` Last report ${formatPlatformTableRelativeTimeValue(last, { now: now() })}.`
: '';
return `Agent has stopped reporting.${when} Re-run the install command from the Pulse UI to refresh its token.`;
};
@@ -1534,7 +1538,7 @@ export const AgentsMachinesTable: Component<{
? availabilityFor(machine)?.lastChecked
: machine.lastSeen;
const lastSeenLabel = () =>
- formatPlatformTableRelativeTimeValue(lastSeenValue());
+ formatPlatformTableRelativeTimeValue(lastSeenValue(), { now: now() });
const machineSubtitle = () =>
machineRowSubtitleFor(
name(),
diff --git a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
index 723f0ff3c0..b5c4916578 100644
--- a/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
+++ b/frontend-modern/src/features/standalone/__tests__/AgentsMachinesTable.test.tsx
@@ -4,6 +4,7 @@ import { AgentMetadataAPI } from '@/api/agentMetadata';
import { MonitoringAPI } from '@/api/monitoring';
import type { Resource } from '@/types/resource';
import { STORAGE_KEYS } from '@/utils/localStorage';
+import { RELATIVE_TIME_TICK_MS } from '@/utils/relativeTimeClock';
import { RESOURCE_METADATA_CHANGED_EVENT } from '@/utils/resourceMetadataEvents';
import { AgentsMachinesTable } from '../AgentsMachinesTable';
@@ -1121,4 +1122,50 @@ describe('AgentsMachinesTable', () => {
'Thermal pressure nominal via pmset',
);
});
+
+ it("keeps a silent machine's seen and last-report ages moving while its data does not change", async () => {
+ const start = Date.parse('2026-07-08T09:05:00Z');
+ vi.useFakeTimers({ toFake: ['Date', 'setInterval', 'clearInterval'], now: start });
+
+ try {
+ render(() => (
+ <AgentsMachinesTable
+ resources={[
+ resource({
+ id: 'omv',
+ name: 'omv',
+ lastSeen: Date.parse('2026-07-08T09:00:00Z'),
+ identity: { ips: ['192.168.0.21'] },
+ agent: {
+ agentVersion: '6.0.2',
+ stale: true,
+ lastReportAt: '2026-07-08T09:00:00Z',
+ },
+ }),
+ ]}
+ emptyIcon={emptyIcon}
+ emptyTitle="No machines"
+ emptyDescription="Install Pulse Agent."
+ />
+ ));
+ await openMachineColumnPicker();
+ await fireEvent.click(screen.getByLabelText('Last seen'));
+
+ expect(screen.getByTitle('omv · 192.168.0.21 | seen 5m ago')).toBeInTheDocument();
+ expect(
+ screen.getByTitle(/Agent has stopped reporting\. Last report 5m ago\./),
+ ).toBeInTheDocument();
+
+ // The agent stays silent: no new data arrives and only the clock moves.
+ vi.setSystemTime(start + 3 * 60 * 60 * 1000);
+ vi.advanceTimersByTime(RELATIVE_TIME_TICK_MS);
+
+ expect(screen.getByTitle('omv · 192.168.0.21 | seen 3h ago')).toBeInTheDocument();
+ expect(
+ screen.getByTitle(/Agent has stopped reporting\. Last report 3h ago\./),
+ ).toBeInTheDocument();
+ } finally {
+ vi.useRealTimers();
+ }
+ });
});