mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-06 18:39:42 +00:00
Name stale clusters, nodes, and gateways in Proxmox tab banners (#5981)
The Proxmox Ceph, Replication, and Mail Gateway stale-readings notices said only that some readings were stale, leaving operators to scan rows or hover tooltips (and leaving phone users with truncated routes and hidden detail columns unable to see which source went quiet or for how long). Wire the shared staleSourceSummary helper into ProxmoxCephTable, ProxmoxReplicationTable, and ProxmoxMailGatewayTable so each warning notice names up to three affected sources longest silence first with the age of each source's own last reading (ignoring linked agent timestamps and Go zero-times, falling back to backend telemetry_stale age, and deduplicating multiple replication jobs on the same Proxmox node or all-stale instance). Each detail line ticks on the shared relative-time clock with aria-live="off" so the outer role="status" banner does not re-announce on every tick. Existing banner wording, staleness predicates, and row displays are unchanged. Contract-Neutral: presentation of existing per-source lastSeen and health staleness age in the Proxmox Ceph, Replication, and Mail Gateway stale notices via the already-contracted staleSourceSummary helper; no API, route, model contract, or staleness-predicate change --- Fleet candidate `20261205T063940Z-web-product` from the `web-product` lane. Reviewed tip `ee6e23d3bf61cf2ef7edb98642ba939c854a2238` on `main`. [How Pulse handles triage](https://github.com/rcourtman/Pulse/blob/main/docs/AI_TRANSPARENCY.md)
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
{
|
||||
"version": 1,
|
||||
"base_sha": "ef9278997792fe2c43235e80246cf135a5daed87",
|
||||
"verified_at": "2026-12-05T07:19:36Z",
|
||||
"result": "passed",
|
||||
"changed_paths": [
|
||||
"frontend-modern/src/features/proxmox/ProxmoxCephTable.tsx",
|
||||
"frontend-modern/src/features/proxmox/ProxmoxMailGatewayTable.tsx",
|
||||
"frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsx"
|
||||
],
|
||||
"content_sha256": {
|
||||
"frontend-modern/src/features/proxmox/ProxmoxCephTable.tsx": "1e51a3b6ae4935411a44a4cbde1a3ebfcfe22f3d6eebc94befeef83d968a4051",
|
||||
"frontend-modern/src/features/proxmox/ProxmoxMailGatewayTable.tsx": "a9d4ff735093cfe9df9b945f05a8d1bcba989a03db99e2e91f38b2847ec63aa8",
|
||||
"frontend-modern/src/features/proxmox/ProxmoxReplicationTable.tsx": "db5952375bc6aad8f92beb14ebc7576e12c481b3ff189334eb0ef7fa9639e068"
|
||||
},
|
||||
"routes": [
|
||||
"/proxmox/ceph",
|
||||
"/proxmox/replication",
|
||||
"/proxmox/mail"
|
||||
],
|
||||
"viewports": [
|
||||
{
|
||||
"width": 1440,
|
||||
"height": 1000
|
||||
},
|
||||
{
|
||||
"width": 390,
|
||||
"height": 900
|
||||
}
|
||||
],
|
||||
"states": [
|
||||
"Ceph tab (/proxmox/ceph) with four stale clusters (ceph-eu 4h with online linked agent, ceph-us 2h error, ceph-ap 45m, ceph-dr Go zero-time + 22m reportedAge) beside fresh ceph-live: orders longest silence first, ignores linked agent lastSeen, caps at 3 ('Last Proxmox reading: ceph-eu 4 hours ago, ceph-us 2 hours ago, ceph-ap 45 mins ago and 1 more cluster.'), and +61m live clock fast-forward updates to '5 hours ago, 3 hours ago, 1 hour ago'",
|
||||
"Replication tab (/proxmox/replication) with six jobs across five PVE nodes (two jobs sharing stale pve-eu-01 5h with online linked agent, pve-us-01 2h error, pve-ap-01 40m, pve-dr-01 Go zero-time + 25m reportedAge, fresh pve-live): deduplicates per node, orders longest silence first, caps at 3 ('Last Proxmox reading: pve-eu-01 5 hours ago, pve-us-01 2 hours ago, pve-ap-01 40 mins ago and 1 more node.'), and +61m live clock fast-forward updates to '6 hours ago, 3 hours ago, 1 hour ago'",
|
||||
"Mail Gateway tab (/proxmox/mail) with four stale PMG instances (mail-gateway-eu 3h with online linked agent, mail-gateway-us 50m error, mail-gateway-ap 20m, mail-gateway-dr Go zero-time + 16m reportedAge) beside fresh mail-gateway-live: orders longest silence first, ignores linked agent lastSeen, caps at 3 ('Last Mail Gateway reading: mail-gateway-eu 3 hours ago, mail-gateway-us 50 mins ago, mail-gateway-ap 20 mins ago and 1 more gateway.'), and +61m live clock fast-forward updates to '4 hours ago, 1 hour ago, 1 hour ago'",
|
||||
"paired unmodified base (ef92789977) and candidate production builds captured in light and dark themes across 1440x1000 and 390x900 (24 captures visually inspected); detail lines inside role=status notices carry aria-live=off; 0px horizontal overflow, 0 page errors, 0 console errors"
|
||||
],
|
||||
"interactions": [
|
||||
"loaded /proxmox/ceph, /proxmox/replication, and /proxmox/mail on paired base and candidate production builds at 1440x1000 and 390x900 in light and dark themes, verified banner text, aria-live=off, and 0px horizontal overflow, and fast-forwarded the fake clock by 61 minutes on each route to confirm live relative-time updates"
|
||||
]
|
||||
}
|
||||
@@ -41,7 +41,13 @@ import {
|
||||
getCephMonitorCount,
|
||||
type CephStaleNotice,
|
||||
} from './proxmoxCephClusterDrawerModel';
|
||||
import {
|
||||
describeStaleSourceItems,
|
||||
summarizeStaleSourceItems,
|
||||
type StaleSourceItem,
|
||||
} from '@/features/platformPage/staleSourceSummary';
|
||||
import { buildPlatformResourceSearchSuggestions } from '@/features/platformPage/platformSearchSuggestions';
|
||||
import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
|
||||
import { matchesSearchTermSplit, splitSearchExclusions } from '@/utils/searchQuery';
|
||||
|
||||
// Ceph clusters are first-class Resources (type='ceph') with structured
|
||||
@@ -334,6 +340,33 @@ function healthMessageCell(resource: Resource, staleNotice: CephStaleNotice | nu
|
||||
return <span class="text-muted">—</span>;
|
||||
}
|
||||
|
||||
// Names the affected Ceph clusters and the age of each one's last Proxmox
|
||||
// reading, so operators see at a glance which cluster went quiet without
|
||||
// scanning or hovering rows. Ticks on the shared relative clock;
|
||||
// aria-live="off" prevents the outer role="status" notice from re-announcing.
|
||||
const CephStaleReadingDetail = (props: { items: readonly StaleSourceItem[] }) => {
|
||||
const now = useRelativeTimeNow();
|
||||
const detail = () =>
|
||||
describeStaleSourceItems(props.items, now(), {
|
||||
sourceLabel: 'Proxmox',
|
||||
moreNoun: ['more cluster', 'more clusters'],
|
||||
});
|
||||
|
||||
return (
|
||||
<Show when={detail()}>
|
||||
{(text) => (
|
||||
<p
|
||||
class="mt-1 text-xs font-medium leading-5"
|
||||
aria-live="off"
|
||||
data-testid="proxmox-ceph-stale-notice-detail"
|
||||
>
|
||||
{text()}
|
||||
</p>
|
||||
)}
|
||||
</Show>
|
||||
);
|
||||
};
|
||||
|
||||
export const ProxmoxCephTable: Component<{
|
||||
resources: Resource[];
|
||||
emptyIcon: JSX.Element;
|
||||
@@ -387,6 +420,13 @@ export const ProxmoxCephTable: Component<{
|
||||
const hasStaleDisplayedClusters = createMemo(() =>
|
||||
filtered().some((cluster) => Boolean(getCephClusterStaleNotice(cluster))),
|
||||
);
|
||||
const staleDisplayedClusters = createMemo(() =>
|
||||
hasStaleDisplayedClusters()
|
||||
? summarizeStaleSourceItems(filtered(), 'proxmox', (cluster) =>
|
||||
Boolean(getCephClusterStaleNotice(cluster)),
|
||||
)
|
||||
: [],
|
||||
);
|
||||
const countForStatus = (value: CephStatusFilter): number => filterByStatus(value).length;
|
||||
|
||||
const total = createMemo(() => props.resources.length);
|
||||
@@ -474,6 +514,7 @@ export const ProxmoxCephTable: Component<{
|
||||
<strong>Some Ceph cluster readings are stale.</strong> Affected health, monitor, OSD,
|
||||
pool, and capacity figures reflect the last successful Proxmox poll, not current
|
||||
conditions.
|
||||
<CephStaleReadingDetail items={staleDisplayedClusters()} />
|
||||
</InlineNotice>
|
||||
</Show>
|
||||
<PlatformTableShell
|
||||
|
||||
@@ -37,6 +37,12 @@ import {
|
||||
PlatformResourceDetailToggleButton,
|
||||
} from '@/features/platformPage/PlatformResourceDetailTableRow';
|
||||
import { ensureStaleNoticeSentence } from '@/features/platformPage/resourceStaleness';
|
||||
import {
|
||||
describeStaleSourceItems,
|
||||
summarizeStaleSourceItems,
|
||||
type StaleSourceItem,
|
||||
} from '@/features/platformPage/staleSourceSummary';
|
||||
import { useRelativeTimeNow } from '@/utils/relativeTimeClock';
|
||||
import type { Resource } from '@/types/resource';
|
||||
import {
|
||||
describeMailGatewayDegradation,
|
||||
@@ -208,6 +214,33 @@ export const MAIL_GATEWAY_COLUMN_WEIGHTS: Readonly<Record<MailGatewayColumn, num
|
||||
// operator columns. This bespoke table reuses canonical shared
|
||||
// primitives and surfaces those PMG-native columns.
|
||||
|
||||
// Names the affected Mail Gateways and the age of each one's last PMG reading,
|
||||
// so operators see at a glance which gateway went quiet without scanning or
|
||||
// hovering rows. Ticks on the shared relative clock; aria-live="off" prevents
|
||||
// the outer role="status" notice from re-announcing.
|
||||
const MailGatewayStaleReadingDetail = (props: { items: readonly StaleSourceItem[] }) => {
|
||||
const now = useRelativeTimeNow();
|
||||
const detail = () =>
|
||||
describeStaleSourceItems(props.items, now(), {
|
||||
sourceLabel: 'Mail Gateway',
|
||||
moreNoun: ['more gateway', 'more gateways'],
|
||||
});
|
||||
|
||||
return (
|
||||
<Show when={detail()}>
|
||||
{(text) => (
|
||||
<p
|
||||
class="mt-1 text-xs font-medium leading-5"
|
||||
aria-live="off"
|
||||
data-testid="proxmox-mail-gateway-stale-notice-detail"
|
||||
>
|
||||
{text()}
|
||||
</p>
|
||||
)}
|
||||
</Show>
|
||||
);
|
||||
};
|
||||
|
||||
export const ProxmoxMailGatewayTable: Component<{
|
||||
resources: Resource[];
|
||||
emptyTitle: string;
|
||||
@@ -277,6 +310,11 @@ export const ProxmoxMailGatewayTable: Component<{
|
||||
const hasStaleDisplayedInstances = createMemo(() =>
|
||||
tableState.filtered().some(hasStaleMailGatewayReadings),
|
||||
);
|
||||
const staleDisplayedInstances = createMemo(() =>
|
||||
hasStaleDisplayedInstances()
|
||||
? summarizeStaleSourceItems(tableState.filtered(), 'pmg', hasStaleMailGatewayReadings)
|
||||
: [],
|
||||
);
|
||||
const detail = createPlatformResourceDetailState({ idPrefix: 'proxmox-mail-gateway-detail' });
|
||||
const observedWidth = useObservedElementWidth();
|
||||
const layout = createMemo(() =>
|
||||
@@ -356,6 +394,7 @@ export const ProxmoxMailGatewayTable: Component<{
|
||||
<strong>Some Mail Gateway readings are stale.</strong> Affected uptime, mail-flow,
|
||||
quarantine, and queue figures reflect the last successful Mail Gateway poll, not
|
||||
current conditions.
|
||||
<MailGatewayStaleReadingDetail items={staleDisplayedInstances()} />
|
||||
</InlineNotice>
|
||||
</Show>
|
||||
<PlatformTableShell
|
||||
|
||||
@@ -52,6 +52,13 @@ import {
|
||||
buildPlatformSearchSuggestions,
|
||||
type PlatformSearchSuggestionCandidate,
|
||||
} from '@/features/platformPage/platformSearchSuggestions';
|
||||
import { getResourceStaleness } from '@/features/platformPage/resourceStaleness';
|
||||
import {
|
||||
describeStaleSourceItems,
|
||||
getSourceLastReadingMs,
|
||||
type StaleSourceItem,
|
||||
} from '@/features/platformPage/staleSourceSummary';
|
||||
import { asTrimmedString } from '@/utils/stringUtils';
|
||||
import { splitSearchExclusions } from '@/utils/searchQuery';
|
||||
import { buildProxmoxGuestNativeId } from '@/utils/workloads';
|
||||
import { parseBackupTimestampMs } from '@/utils/backupTimestamp';
|
||||
@@ -88,18 +95,54 @@ const RETAINED_REPLICATION_NOTICE: ReplicationStaleNotice = {
|
||||
const normalizeReplicationToken = (value: unknown): string =>
|
||||
typeof value === 'string' ? value.trim().toLowerCase() : '';
|
||||
|
||||
const buildProxmoxNodeStaleNotice = (
|
||||
interface ResolvedReplicationStaleSource {
|
||||
notice: ReplicationStaleNotice;
|
||||
source: StaleSourceItem;
|
||||
kind: 'node' | 'instance';
|
||||
}
|
||||
|
||||
const buildProxmoxNodeStaleSource = (
|
||||
node: Resource,
|
||||
subjectOverride?: string,
|
||||
): ReplicationStaleNotice | null => {
|
||||
instanceNodes?: readonly Resource[],
|
||||
): ResolvedReplicationStaleSource | null => {
|
||||
const stale = resolveProxmoxSourceStaleness(node, 'proxmox', subjectOverride);
|
||||
if (!stale) return null;
|
||||
return {
|
||||
const notice: ReplicationStaleNotice = {
|
||||
badge: 'Stale data',
|
||||
compactBadge: 'Stale',
|
||||
detail: `${stale.reason} — showing the last values received.`,
|
||||
...(stale.error ? { error: stale.error } : {}),
|
||||
};
|
||||
const isInstanceFallback = Boolean(subjectOverride && instanceNodes && instanceNodes.length > 1);
|
||||
let lastReadingMs = getSourceLastReadingMs(node, 'proxmox');
|
||||
let reportedAge = stale.age;
|
||||
if (isInstanceFallback && instanceNodes) {
|
||||
lastReadingMs = null;
|
||||
for (const candidate of instanceNodes) {
|
||||
const candidateMs = getSourceLastReadingMs(candidate, 'proxmox');
|
||||
if (candidateMs !== null && (lastReadingMs === null || candidateMs < lastReadingMs)) {
|
||||
lastReadingMs = candidateMs;
|
||||
}
|
||||
if (!reportedAge) {
|
||||
reportedAge = getResourceStaleness(candidate)?.age ?? null;
|
||||
}
|
||||
}
|
||||
}
|
||||
const name = isInstanceFallback ? asTrimmedString(subjectOverride) || stale.name : stale.name;
|
||||
const id = isInstanceFallback
|
||||
? `instance:${normalizeReplicationToken(subjectOverride) || node.id}`
|
||||
: `node:${node.id}`;
|
||||
return {
|
||||
notice,
|
||||
source: {
|
||||
id,
|
||||
name,
|
||||
lastReadingMs,
|
||||
reportedAge,
|
||||
},
|
||||
kind: isInstanceFallback ? 'instance' : 'node',
|
||||
};
|
||||
};
|
||||
|
||||
// Replication jobs come from /api/replication/jobs without a per-job source
|
||||
@@ -107,10 +150,10 @@ const buildProxmoxNodeStaleNotice = (
|
||||
// PVE connection when no specific source node matches) already loaded by the
|
||||
// page. This avoids inventing a client-side timeout that would disagree with
|
||||
// adaptive PVE polling intervals.
|
||||
export const getReplicationJobStaleNotice = (
|
||||
const resolveReplicationJobStaleSource = (
|
||||
job: ReplicationJob,
|
||||
nodes: readonly Resource[] | undefined,
|
||||
): ReplicationStaleNotice | null => {
|
||||
): ResolvedReplicationStaleSource | null => {
|
||||
if (!nodes || nodes.length === 0) return null;
|
||||
const instance = normalizeReplicationToken(job.instance);
|
||||
const sourceNode =
|
||||
@@ -129,7 +172,7 @@ export const getReplicationJobStaleNotice = (
|
||||
normalizeReplicationToken(node.name) === sourceNode,
|
||||
);
|
||||
if (matched) {
|
||||
return buildProxmoxNodeStaleNotice(matched);
|
||||
return buildProxmoxNodeStaleSource(matched);
|
||||
}
|
||||
if (instanceNodes.length === 0) {
|
||||
const uninstancedMatches = pveNodes.filter(
|
||||
@@ -139,24 +182,29 @@ export const getReplicationJobStaleNotice = (
|
||||
normalizeReplicationToken(node.name) === sourceNode),
|
||||
);
|
||||
if (uninstancedMatches.length === 1) {
|
||||
return buildProxmoxNodeStaleNotice(uninstancedMatches[0]);
|
||||
return buildProxmoxNodeStaleSource(uninstancedMatches[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (instanceNodes.length > 0) {
|
||||
const notices = instanceNodes.map((node) => buildProxmoxNodeStaleNotice(node));
|
||||
if (notices.every((notice): notice is ReplicationStaleNotice => notice !== null)) {
|
||||
if (instanceNodes.length === 1) return notices[0];
|
||||
const preferredIndex = notices.findIndex((notice) => Boolean(notice.error));
|
||||
const resolved = instanceNodes.map((node) => buildProxmoxNodeStaleSource(node));
|
||||
if (resolved.every((entry): entry is ResolvedReplicationStaleSource => entry !== null)) {
|
||||
if (instanceNodes.length === 1) return resolved[0];
|
||||
const preferredIndex = resolved.findIndex((entry) => Boolean(entry.notice.error));
|
||||
const representative = instanceNodes[preferredIndex >= 0 ? preferredIndex : 0];
|
||||
return buildProxmoxNodeStaleNotice(representative, job.instance);
|
||||
return buildProxmoxNodeStaleSource(representative, job.instance, instanceNodes);
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
export const getReplicationJobStaleNotice = (
|
||||
job: ReplicationJob,
|
||||
nodes: readonly Resource[] | undefined,
|
||||
): ReplicationStaleNotice | null => resolveReplicationJobStaleSource(job, nodes)?.notice ?? null;
|
||||
|
||||
type ReplicationColumn =
|
||||
| 'status'
|
||||
| 'job'
|
||||
@@ -762,6 +810,38 @@ export async function fetchReplicationJobs(signal?: AbortSignal): Promise<Replic
|
||||
return parseReplicationInventory(await readReplicationInventoryJSON(response));
|
||||
}
|
||||
|
||||
// Names the affected Proxmox nodes or connections and the age of each one's
|
||||
// last Proxmox reading, so operators see at a glance which source went quiet
|
||||
// without expanding individual jobs. Ticks on the shared relative clock;
|
||||
// aria-live="off" prevents the outer role="status" notice from re-announcing.
|
||||
const ReplicationStaleReadingDetail = (props: {
|
||||
items: readonly StaleSourceItem[];
|
||||
hasInstanceFallback: boolean;
|
||||
}) => {
|
||||
const now = useRelativeTimeNow();
|
||||
const detail = () =>
|
||||
describeStaleSourceItems(props.items, now(), {
|
||||
sourceLabel: 'Proxmox',
|
||||
moreNoun: props.hasInstanceFallback
|
||||
? ['more source', 'more sources']
|
||||
: ['more node', 'more nodes'],
|
||||
});
|
||||
|
||||
return (
|
||||
<Show when={detail()}>
|
||||
{(text) => (
|
||||
<p
|
||||
class="mt-1 text-xs font-medium leading-5"
|
||||
aria-live="off"
|
||||
data-testid="proxmox-replication-stale-notice-detail"
|
||||
>
|
||||
{text()}
|
||||
</p>
|
||||
)}
|
||||
</Show>
|
||||
);
|
||||
};
|
||||
|
||||
// The jobs resource lives in ProxmoxPageSurface (it also gates the
|
||||
// Replication tab's visibility), so this table is purely presentational.
|
||||
export const ProxmoxReplicationTable: Component<{
|
||||
@@ -787,10 +867,17 @@ export const ProxmoxReplicationTable: Component<{
|
||||
!getAPIReadAccessErrorMessage(props.error) &&
|
||||
(props.jobs?.length ?? 0) > 0;
|
||||
|
||||
const staleResolutionByJobId = createMemo(() => {
|
||||
const resolutions = new Map<string, ResolvedReplicationStaleSource | null>();
|
||||
for (const job of props.jobs ?? []) {
|
||||
resolutions.set(job.id, resolveReplicationJobStaleSource(job, props.nodes));
|
||||
}
|
||||
return resolutions;
|
||||
});
|
||||
const staleNoticeByJobId = createMemo(() => {
|
||||
const notices = new Map<string, ReplicationStaleNotice | null>();
|
||||
for (const job of props.jobs ?? []) {
|
||||
notices.set(job.id, getReplicationJobStaleNotice(job, props.nodes));
|
||||
for (const [id, resolved] of staleResolutionByJobId()) {
|
||||
notices.set(id, resolved?.notice ?? null);
|
||||
}
|
||||
return notices;
|
||||
});
|
||||
@@ -846,6 +933,39 @@ export const ProxmoxReplicationTable: Component<{
|
||||
const hasStaleDisplayedJobs = createMemo(() =>
|
||||
filtered().some((job) => Boolean(staleNoticeByJobId().get(job.id))),
|
||||
);
|
||||
const staleDisplayedSources = createMemo(() => {
|
||||
if (!hasStaleDisplayedJobs()) {
|
||||
return { items: [] as StaleSourceItem[], hasInstanceFallback: false };
|
||||
}
|
||||
const byId = new Map<string, StaleSourceItem>();
|
||||
let hasInstanceFallback = false;
|
||||
for (const job of filtered()) {
|
||||
const resolved = staleResolutionByJobId().get(job.id);
|
||||
if (!resolved) continue;
|
||||
if (resolved.kind === 'instance') hasInstanceFallback = true;
|
||||
const existing = byId.get(resolved.source.id);
|
||||
if (!existing) {
|
||||
byId.set(resolved.source.id, { ...resolved.source });
|
||||
continue;
|
||||
}
|
||||
if (
|
||||
resolved.source.lastReadingMs !== null &&
|
||||
(existing.lastReadingMs === null || resolved.source.lastReadingMs < existing.lastReadingMs)
|
||||
) {
|
||||
existing.lastReadingMs = resolved.source.lastReadingMs;
|
||||
}
|
||||
if (!existing.reportedAge && resolved.source.reportedAge) {
|
||||
existing.reportedAge = resolved.source.reportedAge;
|
||||
}
|
||||
}
|
||||
const items = Array.from(byId.values()).sort((a, b) => {
|
||||
if (a.lastReadingMs === b.lastReadingMs) return a.name.localeCompare(b.name);
|
||||
if (a.lastReadingMs === null) return 1;
|
||||
if (b.lastReadingMs === null) return -1;
|
||||
return a.lastReadingMs - b.lastReadingMs;
|
||||
});
|
||||
return { items, hasInstanceFallback };
|
||||
});
|
||||
const countForStatus = (value: ReplicationStatusFilter): number => filterByStatus(value).length;
|
||||
const statusFilterOptions = createMemo(() => {
|
||||
const showStaleChip = countForStatus('stale') > 0 || status() === 'stale';
|
||||
@@ -977,6 +1097,10 @@ export const ProxmoxReplicationTable: Component<{
|
||||
<strong>Some replication job readings are stale.</strong> Affected status, sync
|
||||
times, duration, and failure counts reflect the last successful Proxmox poll, not
|
||||
current conditions.
|
||||
<ReplicationStaleReadingDetail
|
||||
items={staleDisplayedSources().items}
|
||||
hasInstanceFallback={staleDisplayedSources().hasInstanceFallback}
|
||||
/>
|
||||
</InlineNotice>
|
||||
</Show>
|
||||
<PlatformTableShell
|
||||
|
||||
@@ -243,4 +243,80 @@ describe('Ceph reported health', () => {
|
||||
expect(screen.getByText('HealthStaleCluster')).toBeInTheDocument();
|
||||
expect(screen.queryByText('PendingCluster')).toBeNull();
|
||||
});
|
||||
|
||||
it('names up to three stale clusters longest silence first, ignores linked agent timestamps, and ticks live', async () => {
|
||||
vi.useFakeTimers();
|
||||
const now = Date.parse('2026-12-05T12:00:00Z');
|
||||
vi.setSystemTime(now);
|
||||
try {
|
||||
const oldestWithOnlineAgent: Resource = {
|
||||
...cluster('ceph-eu', 'warning', 'HEALTH_OK'),
|
||||
lastSeen: now - 10_000,
|
||||
sourceStatus: {
|
||||
agent: { status: 'online', lastSeen: new Date(now - 5_000).toISOString() },
|
||||
proxmox: { status: 'stale', lastSeen: new Date(now - 4 * 3_600_000).toISOString() },
|
||||
},
|
||||
};
|
||||
const secondOldest: Resource = {
|
||||
...cluster('ceph-us', 'warning', 'HEALTH_WARN'),
|
||||
sourceStatus: {
|
||||
proxmox: { status: 'error', lastSeen: new Date(now - 2 * 3_600_000).toISOString() },
|
||||
},
|
||||
};
|
||||
const thirdOldest: Resource = {
|
||||
...cluster('ceph-ap', 'warning', 'HEALTH_OK'),
|
||||
sourceStatus: {
|
||||
proxmox: { status: 'stale', lastSeen: new Date(now - 45 * 60_000).toISOString() },
|
||||
},
|
||||
};
|
||||
const fourthReportedAgeOnly: Resource = {
|
||||
...cluster('ceph-dr', 'warning', 'HEALTH_OK'),
|
||||
sourceStatus: {
|
||||
proxmox: { status: 'stale', lastSeen: '0001-01-01T00:00:00Z' },
|
||||
},
|
||||
health: {
|
||||
verdict: 'stale',
|
||||
reasons: [{ code: 'telemetry_stale', detail: '22m' }],
|
||||
},
|
||||
};
|
||||
const fresh: Resource = {
|
||||
...cluster('ceph-live', 'online', 'HEALTH_OK'),
|
||||
sourceStatus: {
|
||||
proxmox: { status: 'online', lastSeen: new Date(now - 10_000).toISOString() },
|
||||
},
|
||||
};
|
||||
|
||||
render(() =>
|
||||
table(() => [
|
||||
fresh,
|
||||
fourthReportedAgeOnly,
|
||||
thirdOldest,
|
||||
oldestWithOnlineAgent,
|
||||
secondOldest,
|
||||
]),
|
||||
);
|
||||
|
||||
const detail = screen.getByTestId('proxmox-ceph-stale-notice-detail');
|
||||
expect(detail).toHaveAttribute('aria-live', 'off');
|
||||
expect(detail).toHaveTextContent(
|
||||
'Last Proxmox reading: ceph-eu 4 hours ago, ceph-us 2 hours ago, ceph-ap 45 mins ago and 1 more cluster.',
|
||||
);
|
||||
|
||||
// Search narrowing to ceph-dr shows its reportedAge fallback and ignores the Go zero-time.
|
||||
const search = screen.getByPlaceholderText('Search clusters, pools, FSID');
|
||||
await fireEvent.input(search, { target: { value: 'ceph-dr' } });
|
||||
expect(screen.getByTestId('proxmox-ceph-stale-notice-detail')).toHaveTextContent(
|
||||
'Last Proxmox reading: ceph-dr (no report for 22m).',
|
||||
);
|
||||
|
||||
// Clear search and advance the shared relative-time clock by 61 minutes.
|
||||
await fireEvent.input(search, { target: { value: '' } });
|
||||
vi.advanceTimersByTime(61 * 60_000);
|
||||
expect(screen.getByTestId('proxmox-ceph-stale-notice-detail')).toHaveTextContent(
|
||||
'Last Proxmox reading: ceph-eu 5 hours ago, ceph-us 3 hours ago, ceph-ap 1 hour ago and 1 more cluster.',
|
||||
);
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
+110
@@ -292,4 +292,114 @@ describe('ProxmoxMailGatewayTable stale readings notice', () => {
|
||||
expect(screen.getByText('mail-gateway-edge')).toBeInTheDocument();
|
||||
expect(screen.queryByText('mail-gateway-core')).toBeNull();
|
||||
});
|
||||
|
||||
it('names up to three stale Mail Gateways longest silence first, ignores linked agent timestamps, and ticks live', () => {
|
||||
vi.useFakeTimers();
|
||||
const now = Date.parse('2026-12-05T12:00:00Z');
|
||||
vi.setSystemTime(now);
|
||||
try {
|
||||
const oldestWithOnlineAgent: Resource = {
|
||||
...makeGateway({
|
||||
id: 'pmg-eu',
|
||||
name: 'mail-gateway-eu',
|
||||
instanceId: 'pmg-eu',
|
||||
pmgSourceStatus: 'stale',
|
||||
}),
|
||||
lastSeen: now - 10_000,
|
||||
sourceStatus: {
|
||||
agent: { status: 'online', lastSeen: new Date(now - 5_000).toISOString() },
|
||||
pmg: { status: 'stale', lastSeen: new Date(now - 3 * 3_600_000).toISOString() },
|
||||
},
|
||||
};
|
||||
const secondOldest: Resource = {
|
||||
...makeGateway({
|
||||
id: 'pmg-us',
|
||||
name: 'mail-gateway-us',
|
||||
instanceId: 'pmg-us',
|
||||
pmgSourceStatus: 'error',
|
||||
pmgSourceError: '503 Service Unavailable',
|
||||
}),
|
||||
sourceStatus: {
|
||||
pmg: {
|
||||
status: 'error',
|
||||
error: '503 Service Unavailable',
|
||||
lastSeen: new Date(now - 50 * 60_000).toISOString(),
|
||||
},
|
||||
},
|
||||
};
|
||||
const thirdOldest: Resource = {
|
||||
...makeGateway({
|
||||
id: 'pmg-ap',
|
||||
name: 'mail-gateway-ap',
|
||||
instanceId: 'pmg-ap',
|
||||
pmgSourceStatus: 'stale',
|
||||
}),
|
||||
sourceStatus: {
|
||||
pmg: { status: 'stale', lastSeen: new Date(now - 20 * 60_000).toISOString() },
|
||||
},
|
||||
};
|
||||
const fourthReportedAgeOnly: Resource = {
|
||||
...makeGateway({
|
||||
id: 'pmg-dr',
|
||||
name: 'mail-gateway-dr',
|
||||
instanceId: 'pmg-dr',
|
||||
pmgSourceStatus: 'stale',
|
||||
health: {
|
||||
verdict: 'stale',
|
||||
reasons: [{ code: 'telemetry_stale', detail: '16m' }],
|
||||
},
|
||||
}),
|
||||
sourceStatus: {
|
||||
pmg: { status: 'stale', lastSeen: '0001-01-01T00:00:00Z' },
|
||||
},
|
||||
};
|
||||
const fresh: Resource = {
|
||||
...makeGateway({
|
||||
id: 'pmg-live',
|
||||
name: 'mail-gateway-live',
|
||||
instanceId: 'pmg-live',
|
||||
pmgSourceStatus: 'online',
|
||||
}),
|
||||
sourceStatus: {
|
||||
pmg: { status: 'online', lastSeen: new Date(now - 10_000).toISOString() },
|
||||
},
|
||||
};
|
||||
|
||||
render(() => (
|
||||
<ProxmoxMailGatewayTable
|
||||
resources={[
|
||||
fresh,
|
||||
fourthReportedAgeOnly,
|
||||
thirdOldest,
|
||||
oldestWithOnlineAgent,
|
||||
secondOldest,
|
||||
]}
|
||||
emptyTitle="No gateways"
|
||||
emptyDescription="No gateways"
|
||||
/>
|
||||
));
|
||||
|
||||
const detail = screen.getByTestId('proxmox-mail-gateway-stale-notice-detail');
|
||||
expect(detail).toHaveAttribute('aria-live', 'off');
|
||||
expect(detail).toHaveTextContent(
|
||||
'Last Mail Gateway reading: mail-gateway-eu 3 hours ago, mail-gateway-us 50 mins ago, mail-gateway-ap 20 mins ago and 1 more gateway.',
|
||||
);
|
||||
|
||||
// Search narrowing to mail-gateway-dr shows its reportedAge fallback and ignores Go zero-time.
|
||||
const search = screen.getByPlaceholderText('Search Mail Gateways');
|
||||
fireEvent.input(search, { target: { value: 'mail-gateway-dr' } });
|
||||
expect(screen.getByTestId('proxmox-mail-gateway-stale-notice-detail')).toHaveTextContent(
|
||||
'Last Mail Gateway reading: mail-gateway-dr (no report for 16m).',
|
||||
);
|
||||
|
||||
// Clear search and advance the shared relative-time clock by 61 minutes.
|
||||
fireEvent.input(search, { target: { value: '' } });
|
||||
vi.advanceTimersByTime(61 * 60_000);
|
||||
expect(screen.getByTestId('proxmox-mail-gateway-stale-notice-detail')).toHaveTextContent(
|
||||
'Last Mail Gateway reading: mail-gateway-eu 4 hours ago, mail-gateway-us 1 hour ago, mail-gateway-ap 1 hour ago and 1 more gateway.',
|
||||
);
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
+187
@@ -574,4 +574,191 @@ describe('ProxmoxReplicationTable stale-reading presentation', () => {
|
||||
/^Next sync\s*in 3m$/,
|
||||
);
|
||||
});
|
||||
|
||||
it('deduplicates stale replication sources per Proxmox node, caps at three longest silence first, and ticks live', async () => {
|
||||
vi.useFakeTimers();
|
||||
const now = Date.parse('2026-12-05T12:00:00Z');
|
||||
vi.setSystemTime(now);
|
||||
try {
|
||||
const nodeEu = makeNode({
|
||||
id: 'pve:pve-eu-01',
|
||||
name: 'pve-eu-01',
|
||||
lastSeen: now - 10_000,
|
||||
sources: ['agent', 'proxmox'],
|
||||
proxmox: { instance: 'site-eu', nodeName: 'pve-eu-01', connectionHealth: 'stale' },
|
||||
sourceStatus: {
|
||||
agent: { status: 'online', lastSeen: new Date(now - 5_000).toISOString() },
|
||||
proxmox: { status: 'stale', lastSeen: new Date(now - 5 * 3_600_000).toISOString() },
|
||||
},
|
||||
});
|
||||
const nodeUs = makeNode({
|
||||
id: 'pve:pve-us-01',
|
||||
name: 'pve-us-01',
|
||||
proxmox: { instance: 'site-us', nodeName: 'pve-us-01', connectionHealth: 'error' },
|
||||
sourceStatus: {
|
||||
proxmox: {
|
||||
status: 'error',
|
||||
error: 'API timeout',
|
||||
lastSeen: new Date(now - 2 * 3_600_000).toISOString(),
|
||||
},
|
||||
},
|
||||
});
|
||||
const nodeAp = makeNode({
|
||||
id: 'pve:pve-ap-01',
|
||||
name: 'pve-ap-01',
|
||||
proxmox: { instance: 'site-ap', nodeName: 'pve-ap-01', connectionHealth: 'stale' },
|
||||
sourceStatus: {
|
||||
proxmox: { status: 'stale', lastSeen: new Date(now - 40 * 60_000).toISOString() },
|
||||
},
|
||||
});
|
||||
const nodeDr = makeNode({
|
||||
id: 'pve:pve-dr-01',
|
||||
name: 'pve-dr-01',
|
||||
proxmox: { instance: 'site-dr', nodeName: 'pve-dr-01', connectionHealth: 'stale' },
|
||||
sourceStatus: {
|
||||
proxmox: { status: 'stale', lastSeen: '0001-01-01T00:00:00Z' },
|
||||
},
|
||||
health: {
|
||||
verdict: 'stale',
|
||||
reasons: [{ code: 'telemetry_stale', detail: '25m' }],
|
||||
},
|
||||
});
|
||||
const nodeLive = makeNode({
|
||||
id: 'pve:pve-live',
|
||||
name: 'pve-live',
|
||||
proxmox: { instance: 'site-live', nodeName: 'pve-live', connectionHealth: 'healthy' },
|
||||
sourceStatus: {
|
||||
proxmox: { status: 'online', lastSeen: new Date(now - 10_000).toISOString() },
|
||||
},
|
||||
});
|
||||
|
||||
// Two jobs share pve-eu-01 and must deduplicate into one named node entry.
|
||||
const jobs: ReplicationJobWithPoll[] = [
|
||||
makeJob({
|
||||
id: 'eu-100-0',
|
||||
instance: 'site-eu',
|
||||
jobId: '100-0',
|
||||
guestId: 100,
|
||||
guestName: 'eu-db',
|
||||
sourceNode: 'pve-eu-01',
|
||||
}),
|
||||
makeJob({
|
||||
id: 'eu-101-0',
|
||||
instance: 'site-eu',
|
||||
jobId: '101-0',
|
||||
guestId: 101,
|
||||
guestName: 'eu-api',
|
||||
sourceNode: 'pve-eu-01',
|
||||
}),
|
||||
makeJob({
|
||||
id: 'us-200-0',
|
||||
instance: 'site-us',
|
||||
jobId: '200-0',
|
||||
guestId: 200,
|
||||
guestName: 'us-app',
|
||||
sourceNode: 'pve-us-01',
|
||||
}),
|
||||
makeJob({
|
||||
id: 'ap-300-0',
|
||||
instance: 'site-ap',
|
||||
jobId: '300-0',
|
||||
guestId: 300,
|
||||
guestName: 'ap-web',
|
||||
sourceNode: 'pve-ap-01',
|
||||
}),
|
||||
makeJob({
|
||||
id: 'dr-400-0',
|
||||
instance: 'site-dr',
|
||||
jobId: '400-0',
|
||||
guestId: 400,
|
||||
guestName: 'dr-vault',
|
||||
sourceNode: 'pve-dr-01',
|
||||
}),
|
||||
makeJob({
|
||||
id: 'live-500-0',
|
||||
instance: 'site-live',
|
||||
jobId: '500-0',
|
||||
guestId: 500,
|
||||
guestName: 'live-proxy',
|
||||
sourceNode: 'pve-live',
|
||||
}),
|
||||
];
|
||||
|
||||
mount(
|
||||
() => jobs,
|
||||
() => [nodeLive, nodeDr, nodeAp, nodeUs, nodeEu],
|
||||
);
|
||||
|
||||
const detail = screen.getByTestId('proxmox-replication-stale-notice-detail');
|
||||
expect(detail).toHaveAttribute('aria-live', 'off');
|
||||
expect(detail).toHaveTextContent(
|
||||
'Last Proxmox reading: pve-eu-01 5 hours ago, pve-us-01 2 hours ago, pve-ap-01 40 mins ago and 1 more node.',
|
||||
);
|
||||
|
||||
// Search narrowing to dr-vault displays only pve-dr-01 with its reportedAge fallback.
|
||||
const search = screen.getByPlaceholderText('Search jobs, guests, nodes');
|
||||
await fireEvent.input(search, { target: { value: 'dr-vault' } });
|
||||
expect(screen.getByTestId('proxmox-replication-stale-notice-detail')).toHaveTextContent(
|
||||
'Last Proxmox reading: pve-dr-01 (no report for 25m).',
|
||||
);
|
||||
|
||||
// Clear search and advance the shared clock by 61 minutes.
|
||||
await fireEvent.input(search, { target: { value: '' } });
|
||||
vi.advanceTimersByTime(61 * 60_000);
|
||||
expect(screen.getByTestId('proxmox-replication-stale-notice-detail')).toHaveTextContent(
|
||||
'Last Proxmox reading: pve-eu-01 6 hours ago, pve-us-01 3 hours ago, pve-ap-01 1 hour ago and 1 more node.',
|
||||
);
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
|
||||
it('uses the oldest Proxmox reading across an all-stale instance when a job falls back to instance scope', () => {
|
||||
vi.useFakeTimers();
|
||||
const now = Date.parse('2026-12-05T12:00:00Z');
|
||||
vi.setSystemTime(now);
|
||||
try {
|
||||
const nodeA = makeNode({
|
||||
id: 'pve:site-dr-a',
|
||||
name: 'dr-a',
|
||||
proxmox: { instance: 'site-dr', nodeName: 'dr-a', connectionHealth: 'stale' },
|
||||
sourceStatus: {
|
||||
proxmox: { status: 'stale', lastSeen: new Date(now - 3 * 3_600_000).toISOString() },
|
||||
},
|
||||
});
|
||||
const nodeB = makeNode({
|
||||
id: 'pve:site-dr-b',
|
||||
name: 'dr-b',
|
||||
proxmox: { instance: 'site-dr', nodeName: 'dr-b', connectionHealth: 'error' },
|
||||
sourceStatus: {
|
||||
proxmox: {
|
||||
status: 'error',
|
||||
error: '502 Bad Gateway',
|
||||
lastSeen: new Date(now - 30 * 60_000).toISOString(),
|
||||
},
|
||||
},
|
||||
});
|
||||
const jobs: ReplicationJobWithPoll[] = [
|
||||
makeJob({
|
||||
id: 'dr-900-0',
|
||||
instance: 'site-dr',
|
||||
jobId: '900-0',
|
||||
guestId: 900,
|
||||
guestName: 'dr-core',
|
||||
sourceNode: 'missing-node',
|
||||
}),
|
||||
];
|
||||
|
||||
mount(
|
||||
() => jobs,
|
||||
() => [nodeA, nodeB],
|
||||
);
|
||||
|
||||
expect(screen.getByTestId('proxmox-replication-stale-notice-detail')).toHaveTextContent(
|
||||
'Last Proxmox reading: site-dr 3 hours ago.',
|
||||
);
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user