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 retained guest disk readings from signalling live pressure

pulse-triage[bot]f017b77c340a
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 905a5ea6a6..b3ea2ca619 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -15,6 +15,34 @@
## Purpose
+
+### Workloads disk decorations follow the selected filesystem source
+
+`GuestRow` passes the shared `getWorkloadGuestDiskRead` classification to the
+stacked disk primitive, not just its explanatory text. Last-known filesystem
+values keep their bytes, percentage and geometry in every bar mode, but use a
+neutral fill in the cell and tooltip and cannot assert a live anomaly. Tooltip
+headings and per-disk titles identify those values as last known; their mount
+names and numbers use theme-aware text. An explicitly unavailable reading
+withholds usage and anomaly even when numeric carriers remain, while known
+capacity may remain inspectable as unknown usage, never measured zero.
+
+Current QEMU readings and independent current linked-agent filesystems retain
+threshold colours and anomaly behaviour. A linked-agent lease loss makes its
+own filesystems last known; a Proxmox deferral cannot withdraw a current agent
+reading. Unannotated host/platform callers and measured current zero retain
+their behaviour. Status text alone is not a freshness classifier. Source-state
+replacement updates the mounted shell and open tooltip without collection,
+History changes, timers, alert-record changes or timestamp renewal.
+
+Verification: `GuestRow.test.tsx`, `StackedDiskBar.test.tsx` and
+`stackedDiskBarModel.branchcov0712b.test.ts` check the source boundary, every
+mode, retained geometry, unavailable numeric carriers, current/unannotated/zero
+controls and reactive replacement. The parent-bound browser receipt covers
+real canonical mapping and Workloads rendering, desktop/phone and light/dark
+with synthetic observations. These proofs establish presentation, not native
+guest recovery, ordinary QEMU-only polling or release availability.
+
### Narrow Workloads identity during guest locks
In narrow and phone layouts, the guest name and status occupy the first line;
diff --git a/frontend-modern/browser-verification/979c764245666785.json b/frontend-modern/browser-verification/979c764245666785.json
new file mode 100644
index 0000000000..3d93faaebe
--- /dev/null
+++ b/frontend-modern/browser-verification/979c764245666785.json
@@ -0,0 +1,54 @@
+{
+ "version": 1,
+ "result": "passed",
+ "base_sha": "0db330348395cf78930ad280d25cef01c602c7df",
+ "changed_paths": [
+ "frontend-modern/src/components/Workloads/GuestRow.tsx",
+ "frontend-modern/src/components/Workloads/StackedDiskBar.tsx",
+ "frontend-modern/src/components/Workloads/stackedDiskBarModel.ts"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/components/Workloads/GuestRow.tsx": "09b16c2a3006dbf386bcc66be4d8ac35e972bb02a32ae4b9a3a24b52741f815a",
+ "frontend-modern/src/components/Workloads/StackedDiskBar.tsx": "707217d49acb442f82203a5eaaf890b997cf7cc9120a46edf0e8729c51d0f0ed",
+ "frontend-modern/src/components/Workloads/stackedDiskBarModel.ts": "6a517f0aa68be9d82ec53834ef7b3fce296615ca2c2b9344edf16ccb2c1dcef1"
+ },
+ "routes": [
+ "/proxmox?tab=workloads (synthetic canonical snapshots through production useWorkloads/useWorkloadsState/WorkloadsSurface/GuestRow at /tmp/disk-bars/index.html)"
+ ],
+ "states": [
+ "Current and last-known high/low/multiple filesystem readings, unavailable numeric carriers, config-only capacity, genuine zero and independent linked-agent disks during QEMU deferral",
+ "Aggregate/max, stacked, inline/mini, vertical and aggregate-only modes; desktop/phone; light/dark"
+ ],
+ "interactions": [
+ "Inspect real tooltip: last-known heading/caveat, neutral fills, known capacity with unknown usage and theme-readable mount/value text",
+ "Refresh Last seen without reviving decoration, lose/restore linked-agent lease, and replace the same guest with current/unavailable/zero without remount or changed mode geometry",
+ "Phone visible Prior/N/A cues and full screen-reader reason without hover"
+ ],
+ "viewports": [
+ {
+ "width": 1365,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "verified_at": "2026-10-09T19:35:49.608Z",
+ "browsers": [
+ {
+ "engine": "desktop",
+ "version": "141.0.7390.37"
+ },
+ {
+ "engine": "phone",
+ "version": "26.0"
+ }
+ ],
+ "playwright_version": "1.56.1",
+ "evidence": {
+ "result": "Retained lane evidence/browser-result.json",
+ "screenshots": "Eleven visually inspected desktop Chromium/phone WebKit captures in evidence/BROWSER.tar.xz",
+ "limits": "Synthetic canonical snapshots and intercepted synthetic anomalies through production useWorkloads mapper/useWorkloadsState/WorkloadsSurface/GuestRow/StackedDiskBar and CSS, plus direct shared-bar modes. No full authenticated App, native QEMU/Windows/backup/thaw/History polling, installed, released or physical-device acceptance."
+ }
+}
diff --git a/frontend-modern/src/components/Workloads/GuestRow.tsx b/frontend-modern/src/components/Workloads/GuestRow.tsx
index f5e9902a20..da8eb3c335 100644
--- a/frontend-modern/src/components/Workloads/GuestRow.tsx
+++ b/frontend-modern/src/components/Workloads/GuestRow.tsx
@@ -686,7 +686,7 @@ export function GuestRow(props: GuestRowProps) {
aggregateDisk={props.guest.disk}
anomaly={diskAnomaly()}
thresholds={diskThresholds()}
- statusMessage={diskUsageRead().message ?? undefined}
+ reading={diskUsageRead()}
/>
}
>
diff --git a/frontend-modern/src/components/Workloads/StackedDiskBar.tsx b/frontend-modern/src/components/Workloads/StackedDiskBar.tsx
index 48e0bfbdf9..2b82821d6f 100644
--- a/frontend-modern/src/components/Workloads/StackedDiskBar.tsx
+++ b/frontend-modern/src/components/Workloads/StackedDiskBar.tsx
@@ -81,7 +81,7 @@ export function StackedDiskBar(props: StackedDiskBarProps) {
</Show>
{/* Single bar for aggregate or single disk */}
- <Show when={!presentation().useStackedSegments}>
+ <Show when={!presentation().useStackedSegments && !presentation().unavailable}>
<svg
aria-hidden="true"
class="absolute inset-0 h-full w-full"
@@ -104,11 +104,15 @@ export function StackedDiskBar(props: StackedDiskBarProps) {
{/* Label overlay */}
<span class="absolute inset-0 flex items-center justify-center text-[10px] font-semibold text-base-content leading-none min-w-0 overflow-hidden">
<span class="max-w-full min-w-0 whitespace-nowrap overflow-hidden text-ellipsis px-0.5 text-center">
- <span>
- <AnimatedNumber
- value={presentation().displayPercentValue}
- format={formatPercent}
- />
+ <span
+ data-stacked-disk-unavailable={presentation().unavailable ? '' : undefined}
+ >
+ <Show when={!presentation().unavailable} fallback="N/A">
+ <AnimatedNumber
+ value={presentation().displayPercentValue}
+ format={formatPercent}
+ />
+ </Show>
</span>
<Show when={presentation().showMaxLabel}>
<span
@@ -252,11 +256,11 @@ export function StackedDiskBar(props: StackedDiskBarProps) {
maxWidth={420}
>
<div class="w-[360px] max-w-full">
- <div class="font-medium mb-1 text-slate-300 border-b border-border pb-1">
+ <div class="font-medium mb-1 text-base-content border-b border-border pb-1">
{presentation().tooltipTitle}
</div>
- <Show when={props.statusMessage}>
- <p class="mb-1 text-xs text-muted">{props.statusMessage}</p>
+ <Show when={presentation().tooltipMessage}>
+ <p class="mb-1 text-xs text-muted">{presentation().tooltipMessage}</p>
</Show>
<For each={presentation().tooltipContent}>
{(item, idx) => (
@@ -265,7 +269,7 @@ export function StackedDiskBar(props: StackedDiskBarProps) {
classList={{ 'border-t border-border': idx() > 0 }}
>
<div class="grid grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-0.5">
- <span class="flex min-w-0 items-start gap-1.5 text-slate-300">
+ <span class="flex min-w-0 items-start gap-1.5 text-base-content">
<svg aria-hidden="true" class="mt-0.5 h-2 w-2 shrink-0" viewBox="0 0 8 8">
<circle cx="4" cy="4" r="4" fill={item.color} />
</svg>
diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx
index 392d6ce976..9ed714bbfe 100644
--- a/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx
+++ b/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx
@@ -76,8 +76,12 @@ vi.mock('@/components/Workloads/EnhancedCPUBar', () => ({
}));
vi.mock('../StackedDiskBar', () => ({
- StackedDiskBar: (props: { statusMessage?: string }) => (
- <div data-testid="disk-bar" data-status-message={props.statusMessage} />
+ StackedDiskBar: (props: { reading?: { state: string; message: string | null } }) => (
+ <div
+ data-testid="disk-bar"
+ data-reading-state={props.reading?.state}
+ data-reading-message={props.reading?.message}
+ />
),
}));
@@ -833,6 +837,30 @@ describe('GuestRow', () => {
});
describe('visible filesystem read provenance', () => {
+ it('forwards source classification without withdrawing an independent agent reading', () => {
+ const [guest, setGuest] = createSignal(
+ makeGuest({ diskStatusReason: 'agent-cooldown', disksFromAgent: true, agentStale: false }),
+ );
+ const { container } = render(() => (
+ <table>
+ <tbody>
+ <GuestRow guest={guest()} visibleColumnIds={['name', 'disk']} />
+ </tbody>
+ </table>
+ ));
+ const row = container.querySelector('tr');
+ expect(screen.getByTestId('disk-bar')).toHaveAttribute('data-reading-state', 'current');
+ setGuest({ ...guest(), agentStale: true });
+ expect(screen.getByTestId('disk-bar')).toHaveAttribute('data-reading-state', 'last-known');
+ expect(screen.getByTestId('disk-bar')).toHaveAttribute(
+ 'data-reading-message',
+ 'Using last known disk stats. The Pulse Agent in this guest stopped reporting.',
+ );
+ setGuest({ ...guest(), agentStale: false });
+ expect(screen.getByTestId('disk-bar')).toHaveAttribute('data-reading-state', 'current');
+ expect(container.querySelector('tr')).toBe(row);
+ });
+
const history = {
getGuestMetricSeries: () => [
{
@@ -914,6 +942,16 @@ describe('GuestRow', () => {
expect(notice).toHaveTextContent(`Using last known disk stats. ${message}`);
expect(notice?.querySelector('[aria-hidden="true"]')).toHaveTextContent('Last known');
expect(notice).not.toHaveAttribute('tabindex');
+ if (mode === 'bars') {
+ expect(screen.getByTestId('disk-bar')).toHaveAttribute(
+ 'data-reading-state',
+ 'last-known',
+ );
+ expect(screen.getByTestId('disk-bar')).toHaveAttribute(
+ 'data-reading-message',
+ `Using last known disk stats. ${message}`,
+ );
+ }
},
);
@@ -1100,13 +1138,13 @@ describe('GuestRow', () => {
</tbody>
</table>
));
- expect(screen.getByTestId('disk-bar')).not.toHaveAttribute('data-status-message');
+ expect(screen.getByTestId('disk-bar')).not.toHaveAttribute('data-reading-message');
expect(container.querySelector('[data-workload-disk-read-status]')).toBeNull();
const lastKnown =
'Using last known disk stats. The Pulse Agent in this guest stopped reporting.';
setGuest(agentGuest({ agentStale: true }));
- expect(screen.getByTestId('disk-bar')).toHaveAttribute('data-status-message', lastKnown);
+ expect(screen.getByTestId('disk-bar')).toHaveAttribute('data-reading-message', lastKnown);
let notice = container.querySelector('[data-workload-disk-read-status]');
expect(notice?.querySelector('[aria-hidden="true"]')).toHaveTextContent('Last known');
expect(notice).toHaveAttribute('title', lastKnown);
@@ -1405,7 +1443,7 @@ describe('GuestRow', () => {
'title',
expected,
);
- expect(screen.getByTestId('disk-bar')).toHaveAttribute('data-status-message', expected);
+ expect(screen.getByTestId('disk-bar')).toHaveAttribute('data-reading-message', expected);
},
);
diff --git a/frontend-modern/src/components/Workloads/__tests__/StackedDiskBar.test.tsx b/frontend-modern/src/components/Workloads/__tests__/StackedDiskBar.test.tsx
index 9cd200c640..0958819512 100644
--- a/frontend-modern/src/components/Workloads/__tests__/StackedDiskBar.test.tsx
+++ b/frontend-modern/src/components/Workloads/__tests__/StackedDiskBar.test.tsx
@@ -1,4 +1,6 @@
import { describe, it, expect, afterEach } from 'vitest';
+import { createSignal } from 'solid-js';
+import { formatBytes } from '@/utils/format';
import { render, screen, cleanup, fireEvent } from '@solidjs/testing-library';
import type { Disk } from '@/types/api';
import type { AnomalyReport } from '@/types/aiIntelligence';
@@ -631,3 +633,47 @@ describe('StackedDiskBar', () => {
});
});
});
+
+describe('reactive disk reading decorations', () => {
+ it('updates an open last-known tooltip and mounted shell through fresh and unavailable replacement', async () => {
+ const message = 'Using last known disk stats. Guest reads paused during a backup.';
+ const [reading, setReading] = createSignal<{
+ state: 'last-known' | 'current' | 'unavailable';
+ message: string | null;
+ }>({ state: 'last-known', message });
+ const [disk, setDisk] = createSignal(
+ makeDisk({ used: 102005473280, free: 5368709120, usage: 95 }),
+ );
+ const { container } = render(() => (
+ <StackedDiskBar disks={[disk()]} reading={reading()} anomaly={makeAnomaly()} />
+ ));
+ const shell = container.firstElementChild;
+ expect(getSingleBarFill(container)).toHaveAttribute('fill', 'rgba(148, 163, 184, 0.5)');
+ expect(container.querySelector('.animate-pulse')).toBeNull();
+ fireEvent.mouseEnter(getBarTrigger(container));
+ expect(await screen.findByText(message)).toBeVisible();
+ expect(screen.getByText('Last known disk usage')).toHaveClass('text-base-content');
+ expect(document.querySelector('[data-stacked-disk-fill="tooltip"]')).toHaveAttribute(
+ 'fill',
+ 'rgba(148, 163, 184, 0.5)',
+ );
+ setReading({ state: 'current', message: null });
+ expect(container.firstElementChild).toBe(shell);
+ expect(screen.queryByText(message)).toBeNull();
+ expect(getSingleBarFill(container)).toHaveAttribute('fill', 'rgba(239, 68, 68, 0.6)');
+ expect(container.querySelector('.animate-pulse')).not.toBeNull();
+ setReading({ state: 'unavailable', message: 'No filesystem usage reading.' });
+ expect(container.firstElementChild).toBe(shell);
+ expect(container.querySelector('[data-stacked-disk-unavailable]')).toHaveTextContent('N/A');
+ expect(container.querySelector('[data-stacked-disk-fill]')).toBeNull();
+ expect(container.querySelector('.animate-pulse')).toBeNull();
+ expect(screen.queryByText('95%')).toBeNull();
+ expect(screen.getByText(`?/${formatBytes(disk().total ?? 0)}`)).toBeVisible();
+ setDisk(makeDisk({ used: 0, usage: 0 }));
+ setReading({ state: 'current', message: null });
+ expect(container.firstElementChild).toBe(shell);
+ expect(getSingleBarFill(container)).toHaveAttribute('width', '0');
+ expect(getSingleBarFill(container)).toHaveAttribute('fill', 'rgba(34, 197, 94, 0.6)');
+ fireEvent.mouseLeave(getBarTrigger(container));
+ });
+});
diff --git a/frontend-modern/src/components/Workloads/__tests__/stackedDiskBarModel.branchcov0712b.test.ts b/frontend-modern/src/components/Workloads/__tests__/stackedDiskBarModel.branchcov0712b.test.ts
index 9809420da7..cf5cb97cae 100644
--- a/frontend-modern/src/components/Workloads/__tests__/stackedDiskBarModel.branchcov0712b.test.ts
+++ b/frontend-modern/src/components/Workloads/__tests__/stackedDiskBarModel.branchcov0712b.test.ts
@@ -585,3 +585,138 @@ describe('stackedDiskBarModel (branch coverage 2)', () => {
});
});
});
+
+describe('disk observation decorations', () => {
+ const neutral = 'rgba(148, 163, 184, 0.5)';
+ const message = 'Using last known disk stats. Guest reads paused during a backup.';
+ const disks = [
+ makeDisk({ used: 95, free: 5, usage: 95 }),
+ makeDisk({ mountpoint: '/data', total: 200, used: 180, free: 20, usage: 90 }),
+ ];
+
+ it.each([undefined, 'aggregate', 'stacked', 'mini', 'vertical-bars'] as const)(
+ 'keeps last-known %s values inspectable without live health colours or anomaly',
+ (mode) => {
+ const props = { disks, mode, anomaly: makeAnomaly(), summaryStrategy: 'max' as const };
+ const current = buildStackedDiskBarPresentation(props, 400);
+ const retained = buildStackedDiskBarPresentation(
+ { ...props, reading: { state: 'last-known', message } },
+ 400,
+ );
+ expect(retained.displayPercentValue).toBe(current.displayPercentValue);
+ expect(retained.barPercent).toBe(current.barPercent);
+ expect(retained.displaySublabel).toBe(current.displaySublabel);
+ expect(retained.segments.map((item) => item.widthPercent)).toEqual(
+ current.segments.map((item) => item.widthPercent),
+ );
+ expect(retained.miniDisks.map((item) => item.percent)).toEqual(
+ current.miniDisks.map((item) => item.percent),
+ );
+ expect(retained.verticalBars.map((item) => item.fillPercent)).toEqual(
+ current.verticalBars.map((item) => item.fillPercent),
+ );
+ expect(retained.barColor).toBe(neutral);
+ for (const item of [
+ ...retained.segments,
+ ...retained.miniDisks,
+ ...retained.verticalBars,
+ ...retained.tooltipContent,
+ ])
+ expect(item.color).toBe(neutral);
+ expect(retained.anomalyDescription).toBeUndefined();
+ expect(retained.anomalyRatio).toBe('');
+ expect(retained.tooltipMessage).toBe(message);
+ expect(retained.tooltipTitle).toMatch(/Last known/i);
+ expect(retained.miniDisks.every((item) => item.title.startsWith('Last known'))).toBe(true);
+ expect(retained.verticalBars.every((item) => item.title.startsWith('Last known'))).toBe(true);
+ },
+ );
+
+ it('keeps a retained aggregate-only value neutral, and config-only capacity unknown', () => {
+ const aggregate = buildStackedDiskBarPresentation(
+ { aggregateDisk: disks[0], reading: { state: 'last-known', message } },
+ 400,
+ );
+ expect(aggregate.displayPercentValue).toBe(95);
+ expect(aggregate.barColor).toBe(neutral);
+ expect(aggregate.tooltipContent[0]).toMatchObject({ percent: '95%', color: neutral });
+ const mixed = buildStackedDiskBarPresentation(
+ {
+ disks: [...disks, makeDisk({ mountpoint: '/config', total: 300, usage: -1 })],
+ reading: { state: 'last-known', message },
+ },
+ 400,
+ );
+ expect(mixed.miniDisks).toHaveLength(2);
+ expect(mixed.tooltipContent[2]).toMatchObject({
+ label: '/config',
+ percent: '—',
+ used: '?',
+ total: '300 B',
+ color: neutral,
+ });
+ });
+
+ it.each([undefined, 'aggregate', 'stacked', 'mini', 'vertical-bars'] as const)(
+ 'withholds unavailable %s usage and anomaly despite numeric carriers',
+ (mode) => {
+ const p = buildStackedDiskBarPresentation(
+ {
+ disks,
+ aggregateDisk: disks[0],
+ mode,
+ anomaly: makeAnomaly(),
+ reading: { state: 'unavailable', message: 'Filesystem usage is unavailable.' },
+ },
+ 400,
+ );
+ expect(p.unavailable).toBe(true);
+ expect(p.displayLabel).toBe('N/A');
+ expect(p.displayPercentValue).toBe(0);
+ expect(p.barPercent).toBe(0);
+ expect(p.segments).toEqual([]);
+ expect(p.miniDisks).toEqual([]);
+ expect(p.verticalBars).toEqual([]);
+ expect(p.displaySublabel).toBe('');
+ expect(p.anomalyDescription).toBeUndefined();
+ expect(p.anomalyRatio).toBe('');
+ expect(
+ p.tooltipContent.every(
+ (item) => item.percent === '—' && item.used === '?' && item.color === neutral,
+ ),
+ ).toBe(true);
+ expect(p.tooltipContent.map((item) => item.total)).toEqual(['100 B', '200 B']);
+ },
+ );
+
+ it('does not fabricate zero usage for unavailable aggregate-only capacity', () => {
+ const p = buildStackedDiskBarPresentation(
+ { aggregateDisk: disks[0], reading: { state: 'unavailable', message: 'No reading.' } },
+ 400,
+ );
+ expect(p.tooltipContent).toEqual([
+ { label: 'Total', percent: '—', used: '?', total: '100 B', color: neutral },
+ ]);
+ expect(p.displayLabel).toBe('N/A');
+ });
+
+ it('preserves measured current zero and unannotated callers; advisory text alone is not freshness', () => {
+ const base = { disks, anomaly: makeAnomaly(), statusMessage: 'Advisory text' };
+ const legacy = buildStackedDiskBarPresentation(base, 400);
+ const current = buildStackedDiskBarPresentation(
+ { ...base, reading: { state: 'current', message: null } },
+ 400,
+ );
+ expect(current).toEqual(legacy);
+ expect(current.barColor).toBe(CRITICAL);
+ expect(current.anomalyDescription).toBe('Disk usage spike');
+ const zero = buildStackedDiskBarPresentation(
+ { disks: [makeDisk()], reading: { state: 'current', message: null } },
+ 400,
+ );
+ expect(zero.displayLabel).toBe('0%');
+ expect(zero.barColor).toBe(NORMAL);
+ expect(zero.tooltipContent[0].percent).toBe('0%');
+ expect(zero.unavailable).toBe(false);
+ });
+});
diff --git a/frontend-modern/src/components/Workloads/stackedDiskBarModel.ts b/frontend-modern/src/components/Workloads/stackedDiskBarModel.ts
index a9e7f98ca6..2632fec79a 100644
--- a/frontend-modern/src/components/Workloads/stackedDiskBarModel.ts
+++ b/frontend-modern/src/components/Workloads/stackedDiskBarModel.ts
@@ -1,4 +1,5 @@
import type { Disk } from '@/types/api';
+import type { WorkloadGuestDiskRead } from '@/utils/workloadGuestPresentation';
import type { AnomalyReport } from '@/types/aiIntelligence';
import {
ANOMALY_SEVERITY_CLASS,
@@ -19,6 +20,8 @@ export interface StackedDiskBarProps {
anomaly?: AnomalyReport | null;
thresholds?: MetricDisplayThresholds | null;
statusMessage?: string;
+ /** Source-owned classification; advisory text and capacity never establish freshness. */
+ reading?: Pick<WorkloadGuestDiskRead, 'state' | 'message'> | null;
}
export interface StackedDiskSegment {
@@ -86,6 +89,8 @@ export interface StackedDiskBarPresentation {
showSublabel: boolean;
tooltipContent: StackedDiskTooltipItem[];
tooltipTitle: string;
+ tooltipMessage?: string;
+ unavailable: boolean;
useStackedSegments: boolean;
verticalBars: StackedDiskVerticalBar[];
// The fullest disk's usage, shown beside the micro-bars so a multi-disk
@@ -197,6 +202,8 @@ function buildTooltipContent(
options: {
aggregateDisk: Disk | undefined;
aggregateMode: boolean;
+ current: boolean;
+ unavailable: boolean;
inlineDiskMode: boolean;
miniMode: boolean;
thresholds?: MetricDisplayThresholds | null;
@@ -207,7 +214,7 @@ function buildTooltipContent(
options.aggregateMode || options.inlineDiskMode || options.miniMode || options.verticalBarsMode;
if (disks.length > 0) {
return disks.map((disk, index) => {
- if (isStackedDiskUsageUnknown(disk)) {
+ if (options.unavailable || isStackedDiskUsageUnknown(disk)) {
return {
color: UNKNOWN_DISK_COLOR,
label: getDiskLabel(disk, index),
@@ -218,9 +225,11 @@ function buildTooltipContent(
}
const percentValue = getDiskUsagePercent(disk);
return {
- color: useUsageColors
- ? getMetricColorRgba(percentValue, 'disk', options.thresholds)
- : getStackedDiskColor(percentValue, index, options.thresholds),
+ color: !options.current
+ ? UNKNOWN_DISK_COLOR
+ : useUsageColors
+ ? getMetricColorRgba(percentValue, 'disk', options.thresholds)
+ : getStackedDiskColor(percentValue, index, options.thresholds),
label: getDiskLabel(disk, index),
percent: formatPercent(percentValue),
total: formatBytes(disk.total ?? 0),
@@ -233,11 +242,13 @@ function buildTooltipContent(
const percentValue = getDiskUsagePercent(options.aggregateDisk);
return [
{
- color: getMetricColorRgba(percentValue, 'disk', options.thresholds),
+ color: options.current
+ ? getMetricColorRgba(percentValue, 'disk', options.thresholds)
+ : UNKNOWN_DISK_COLOR,
label: 'Total',
- percent: formatPercent(percentValue),
+ percent: options.unavailable ? '—' : formatPercent(percentValue),
total: formatBytes(options.aggregateDisk.total ?? 0),
- used: formatBytes(options.aggregateDisk.used ?? 0),
+ used: options.unavailable ? '?' : formatBytes(options.aggregateDisk.used ?? 0),
},
];
}
@@ -269,10 +280,17 @@ export function buildStackedDiskBarPresentation(
props: StackedDiskBarProps,
containerWidth: number,
): StackedDiskBarPresentation {
+ // Retained numbers explain the last report, not live pressure. Unannotated
+ // host/platform callers preserve their existing behaviour.
+ const unavailable = props.reading?.state === 'unavailable';
+ const current = !props.reading || props.reading.state === 'current';
+ const valuePrefix = props.reading?.state === 'last-known' ? 'Last known ' : '';
+ const anomaly = current ? props.anomaly : null;
+ const aggregateDisk = unavailable ? undefined : props.aggregateDisk;
const allDisks = props.disks ?? [];
// Usage visualisations only draw disks with measured usage; config-only
// mounts (usage -1) stay listed in the tooltip.
- const disks = allDisks.filter((disk) => !isStackedDiskUsageUnknown(disk));
+ const disks = unavailable ? [] : allDisks.filter((disk) => !isStackedDiskUsageUnknown(disk));
const hasDisks = disks.length > 0;
const hasMultipleDisks = disks.length > 1;
const aggregateMode = props.mode === 'aggregate';
@@ -289,17 +307,17 @@ export function buildStackedDiskBarPresentation(
: 0;
const totalCapacity = hasDisks
? disks.reduce((sum, disk) => sum + (disk.total || 0), 0)
- : (props.aggregateDisk?.total ?? 0);
+ : (aggregateDisk?.total ?? 0);
const totalUsed = hasDisks
? disks.reduce((sum, disk) => sum + (disk.used || 0), 0)
- : (props.aggregateDisk?.used ?? 0);
+ : (aggregateDisk?.used ?? 0);
const overallPercent =
totalCapacity > 0
? (totalUsed / totalCapacity) * 100
- : props.aggregateDisk
- ? getDiskUsagePercent(props.aggregateDisk)
+ : aggregateDisk
+ ? getDiskUsagePercent(aggregateDisk)
: 0;
- const anomalyRatio = formatAnomalyRatio(props.anomaly) ?? '';
+ const anomalyRatio = formatAnomalyRatio(anomaly) ?? '';
const maxInfo = getMaxDiskInfo(disks);
const useMaxSummary =
aggregateMode && hasMultipleDisks && summaryStrategy === 'max' && maxInfo !== null;
@@ -311,13 +329,17 @@ export function buildStackedDiskBarPresentation(
: `max ${formatPercent(maxInfo.percent)}`
: '';
const maxLabelFull = maxInfo
- ? `Highest usage: ${maxInfo.label} ${formatPercent(maxInfo.percent)}`
+ ? `${valuePrefix ? 'Last known highest' : 'Highest'} usage: ${maxInfo.label} ${formatPercent(maxInfo.percent)}`
: '';
- const displayLabel = formatPercent(displayPercentValue);
+ const displayLabel = unavailable ? 'N/A' : formatPercent(displayPercentValue);
const displaySublabel =
- useMaxSummary && maxInfo ? '' : `${formatBytes(totalUsed)}/${formatBytes(totalCapacity)}`;
+ unavailable || (useMaxSummary && maxInfo)
+ ? ''
+ : `${formatBytes(totalUsed)}/${formatBytes(totalCapacity)}`;
const diskCountLabel = hasMultipleDisks ? `${disks.length} disks` : '';
- const diskCountTitle = hasMultipleDisks ? `${disks.length} operational disks in breakdown` : '';
+ const diskCountTitle = hasMultipleDisks
+ ? `${disks.length} ${current ? 'operational' : 'last known'} disks in breakdown`
+ : '';
const showDiskCount = Boolean(props.showDiskCount && hasMultipleDisks);
const showMaxLabel =
useMaxSummary ||
@@ -327,7 +349,7 @@ export function buildStackedDiskBarPresentation(
containerWidth >=
estimateTextWidth(displayLabel, { detail: ` ${maxLabelShort}` }) + LABEL_PADDING_PX);
// The anomaly marker shares the label's line whenever it renders.
- const anomalyMarker = props.anomaly?.description && anomalyRatio ? ` ${anomalyRatio}` : '';
+ const anomalyMarker = anomaly?.description && anomalyRatio ? ` ${anomalyRatio}` : '';
const showSublabel =
displaySublabel.length > 0 &&
containerWidth >=
@@ -337,8 +359,9 @@ export function buildStackedDiskBarPresentation(
}`,
}) +
LABEL_PADDING_PX;
- const barColor =
- aggregateMode && hasMultipleDisks && maxInfo
+ const barColor = !current
+ ? UNKNOWN_DISK_COLOR
+ : aggregateMode && hasMultipleDisks && maxInfo
? getMetricColorRgba(maxInfo.percent, 'disk', props.thresholds)
: getMetricColorRgba(overallPercent, 'disk', props.thresholds);
const segments =
@@ -346,7 +369,9 @@ export function buildStackedDiskBarPresentation(
? disks.map((disk, index) => {
const diskUsagePercent = getDiskUsagePercent(disk);
return {
- color: getStackedDiskColor(diskUsagePercent, index, props.thresholds),
+ color: current
+ ? getStackedDiskColor(diskUsagePercent, index, props.thresholds)
+ : UNKNOWN_DISK_COLOR,
disk,
diskUsagePercent,
index,
@@ -360,13 +385,13 @@ export function buildStackedDiskBarPresentation(
const percentLabel = formatPercent(percent);
const shortLabel = getShortDiskLabel(label);
return {
- color: getMetricColorRgba(percent, 'disk', props.thresholds),
+ color: current ? getMetricColorRgba(percent, 'disk', props.thresholds) : UNKNOWN_DISK_COLOR,
inlineText: getInlineDiskText(shortLabel, percentLabel, inlineDiskSlotWidth),
label,
percent,
percentLabel,
shortLabel,
- title: `${label}: ${percentLabel} (${formatBytes(disk.used ?? 0)}/${formatBytes(disk.total ?? 0)})`,
+ title: `${valuePrefix}${label}: ${percentLabel} (${formatBytes(disk.used ?? 0)}/${formatBytes(disk.total ?? 0)})`,
};
});
const verticalBars: StackedDiskVerticalBar[] = verticalBarsMode
@@ -374,9 +399,11 @@ export function buildStackedDiskBarPresentation(
const percent = getDiskUsagePercent(disk);
const label = getDiskLabel(disk, index);
return {
- color: getMetricColorRgba(percent, 'disk', props.thresholds),
+ color: current
+ ? getMetricColorRgba(percent, 'disk', props.thresholds)
+ : UNKNOWN_DISK_COLOR,
fillPercent: Math.max(0, Math.min(percent, 100)),
- title: `${label}: ${formatPercent(percent)} (${formatBytes(disk.used ?? 0)}/${formatBytes(disk.total ?? 0)})`,
+ title: `${valuePrefix}${label}: ${formatPercent(percent)} (${formatBytes(disk.used ?? 0)}/${formatBytes(disk.total ?? 0)})`,
};
})
: [];
@@ -385,6 +412,8 @@ export function buildStackedDiskBarPresentation(
const tooltipContent = buildTooltipContent(allDisks, {
aggregateDisk: props.aggregateDisk,
aggregateMode,
+ current,
+ unavailable,
inlineDiskMode,
miniMode,
thresholds: props.thresholds,
@@ -393,10 +422,10 @@ export function buildStackedDiskBarPresentation(
return {
aggregateMode,
- anomalyClass: props.anomaly
- ? (ANOMALY_SEVERITY_CLASS[props.anomaly.severity] ?? 'text-yellow-400')
+ anomalyClass: anomaly
+ ? (ANOMALY_SEVERITY_CLASS[anomaly.severity] ?? 'text-yellow-400')
: 'text-yellow-400',
- anomalyDescription: props.anomaly?.description,
+ anomalyDescription: anomaly?.description,
anomalyRatio,
barColor,
barPercent,
@@ -422,7 +451,13 @@ export function buildStackedDiskBarPresentation(
showMaxLabel,
showSublabel,
tooltipContent,
- tooltipTitle: allDisks.length > 1 ? 'Disk Breakdown' : 'Disk Usage',
+ tooltipTitle: valuePrefix
+ ? `${valuePrefix}${allDisks.length > 1 ? 'disk breakdown' : 'disk usage'}`
+ : allDisks.length > 1
+ ? 'Disk Breakdown'
+ : 'Disk Usage',
+ tooltipMessage: props.reading?.message ?? props.statusMessage,
+ unavailable,
useStackedSegments,
verticalBars,
verticalBarsLabel,