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.

fix(ui): scale trend sparklines to their own peak

rcourtmanb724dc1a9d7e
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 6a0f036cf8..7e0b1b8931 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -1041,6 +1041,20 @@ AI actions belongs on intentful guest/action surfaces, such as the guest
drawer, where the operator is inspecting a specific workload and can decide
whether that guest should be agent-managed.
+Trend-mode cells own their vertical scale through
+`getMetricMiniSparklineScale` in
+`frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts`.
+Percent series are zero-floored and scaled to their own observed peak with a
+5% floor ceiling and a 100% cap, the same shape rule the network and disk I/O
+series already follow. A fixed 0-100 window is not the contract, because inside
+a 16px table cell it draws low-domain series such as a guest's share of host
+memory or an idle guest's CPU on top of the axis rule, where a flat line is
+indistinguishable from missing history. Absolute level stays readable through
+the per-cell current-value label, the hover tooltip, and bar mode, so scale
+work must not remove those. The scale is derived from the points already
+fetched for that cell and must not add history reads, cross-row coordination,
+or a second pass over the Workloads hot path.
+
The Workloads table metric display mode is part of the protected Workloads
hot path. The default bar mode must keep the existing zero-extra-history cost;
the sparkline mode may hydrate a short shared history window only when selected
diff --git a/frontend-modern/browser-verification.json b/frontend-modern/browser-verification.json
index 05a8f27263..1228358e8e 100644
--- a/frontend-modern/browser-verification.json
+++ b/frontend-modern/browser-verification.json
@@ -1,85 +1,33 @@
{
"version": 1,
- "base_sha": "0f7b1ddee4960573f6009f2f2e0995b9a76508c7",
- "verified_at": "2026-08-05T22:35:48Z",
+ "base_sha": "66388197430a093cc707b3a914845dcfcbd17d02",
+ "verified_at": "2026-08-05T22:41:40Z",
"result": "passed",
- "changed_paths": [
- "frontend-modern/src/components/Workloads/WorkloadsSurface.tsx",
- "frontend-modern/src/components/Workloads/WorkloadsTable.tsx",
- "frontend-modern/src/components/Workloads/guestRowModel.tsx",
- "frontend-modern/src/components/Workloads/useWorkloadsControlsState.ts",
- "frontend-modern/src/components/Workloads/useWorkloadsState.ts"
- ],
+ "changed_paths": ["frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts"],
"content_sha256": {
- "frontend-modern/src/components/Workloads/WorkloadsSurface.tsx": "3e2d0e313aebcfd563c39792f45d63d72d75783d8afe405bfb39476201b85a32",
- "frontend-modern/src/components/Workloads/WorkloadsTable.tsx": "23cc10b33810af82d6726cc18c580c1c1c53504e0691707c40cfdfb2e6abe70e",
- "frontend-modern/src/components/Workloads/guestRowModel.tsx": "51ef0831a897393292c5e27ea7aa19ccfb343a5729d2b80d023f7b8cf79efbd5",
- "frontend-modern/src/components/Workloads/useWorkloadsControlsState.ts": "dc9aa36e8890b1b467bfdbdf5627dde8b74d6c57975988d18bbd7c125cb32f60",
- "frontend-modern/src/components/Workloads/useWorkloadsState.ts": "1d4d01757a36691c3aa62402bdf5beb9bdf592ae9cc29bd2f73f6de65b9ffb53"
+ "frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts": "538ce70e4c8efebe6ea28657c915ea94401bebd460fba4b46b49aa9e643e08e0"
},
- "routes": [
- "/proxmox/overview",
- "/docker/overview",
- "/vmware/overview"
- ],
+ "routes": ["/proxmox/overview", "/docker/overview"],
"viewports": [
- {
- "width": 1920,
- "height": 900
- },
- {
- "width": 1536,
- "height": 800
- },
- {
- "width": 1440,
- "height": 800
- },
- {
- "width": 1280,
- "height": 800
- },
- {
- "width": 1024,
- "height": 800
- },
- {
- "width": 900,
- "height": 800
- },
- {
- "width": 768,
- "height": 800
- },
- {
- "width": 720,
- "height": 800
- },
- {
- "width": 390,
- "height": 844
- },
- {
- "width": 320,
- "height": 800
- }
+ { "width": 1440, "height": 900 },
+ { "width": 768, "height": 1024 },
+ { "width": 390, "height": 844 }
],
"states": [
- "Populated Proxmox mock inventory with every workload column selected at the wide layout",
- "Responsive workload column sets at wide, compact, tablet, and phone stages",
- "Proxmox View preferences and nested Columns picker at 1920px and 1024px",
- "Expanded Proxmox workload details at 390px",
- "Populated Docker host and container tables across desktop, tablet, and phone widths",
- "Populated vSphere host and VM tables across desktop, tablet, and phone widths",
- "vSphere View preferences and nested Columns picker at 1024px"
+ "workloads table in Trends mode with memory relative to Host capacity, 1h range",
+ "workloads table in Trends mode with memory relative to Guest allocation, 1h range",
+ "workloads table in Trends mode, 24h range with 48 sampled points per series",
+ "workloads table in Bars mode, stacked memory bars unaffected by the scale change",
+ "Proxmox nodes table CPU, memory and disk trend cells",
+ "memory sparkline hover tooltip showing Host memory share at a sampled timestamp",
+ "Docker overview confirmed to carry no mini sparkline cells"
],
"interactions": [
- "Selected every available Proxmox workload column at 1920px and confirmed all selections fit without internal or document overflow",
- "Resized the same selected-column state through 1920, 1536, 1440, 1280, 1024, 900, 768, 720, 390, and 320px and confirmed selected wide columns return automatically when space permits",
- "Opened View preferences and the nested Columns picker at 1024px and confirmed wide-only choices are omitted while compact choices remain available",
- "Opened the wide Columns picker at 1920px and confirmed IP, Tags, OS, Net I/O, and Disk I/O remain selected and available",
- "Expanded auth-service-01 at 390px and visually inspected the identity row, primary metrics, tabs, and detail cards without clipping or horizontal scroll",
- "Measured every visible Docker and vSphere table at 1920, 1280, 1024, 768, 390, and 320px and confirmed table and document scroll widths match their containers",
- "Opened the vSphere compact Columns picker and confirmed only columns supported by the current layout are offered"
+ "opened the View menu and switched Metrics between Bars and Trends",
+ "switched Memory relative to between Guest allocation and Host capacity",
+ "switched Trend range between 1h and 24h",
+ "hovered a guest memory sparkline and read the tooltip value and cursor line",
+ "read rendered path geometry per row to confirm the trend line clears the axis rule",
+ "reloaded each route and checked the browser console for errors"
]
}
diff --git a/frontend-modern/src/components/Workloads/__tests__/workloadMetricHistoryModel.test.ts b/frontend-modern/src/components/Workloads/__tests__/workloadMetricHistoryModel.test.ts
index 2f20e59340..2ab7e02667 100644
--- a/frontend-modern/src/components/Workloads/__tests__/workloadMetricHistoryModel.test.ts
+++ b/frontend-modern/src/components/Workloads/__tests__/workloadMetricHistoryModel.test.ts
@@ -147,6 +147,48 @@ describe('workloadMetricHistoryModel', () => {
).toBe('M1.00,16.00 L48.00,9.00 L95.00,2.00');
});
+ it('lifts low-domain percent sparklines off the axis instead of pinning them to a 0-100 window', () => {
+ const hostMemoryShare = [
+ {
+ id: 'memory',
+ label: 'Host memory share',
+ color: '#f59e0b',
+ points: [
+ { timestamp: 1, value: 1.9 },
+ { timestamp: 2, value: 2.4 },
+ { timestamp: 3, value: 2.1 },
+ ],
+ },
+ ];
+ const scale = getMetricMiniSparklineScale(hostMemoryShare, '%');
+
+ // A guest's share of host memory is single digits by construction; a fixed
+ // 0-100 window drew it on top of the axis rule.
+ expect(scale).toEqual({ minValue: 0, maxValue: 5 });
+ expect(buildMetricMiniSparklinePath(hostMemoryShare[0].points, scale)).toBe(
+ 'M1.00,10.68 L48.00,9.28 L95.00,10.12',
+ );
+ });
+
+ it('keeps percent sparklines zero-floored and capped at 100', () => {
+ const scale = getMetricMiniSparklineScale(
+ [
+ {
+ id: 'cpu',
+ label: 'CPU',
+ color: '#8b5cf6',
+ points: [
+ { timestamp: 1, value: 40 },
+ { timestamp: 2, value: 95 },
+ ],
+ },
+ ],
+ '%',
+ );
+
+ expect(scale).toEqual({ minValue: 0, maxValue: 100 });
+ });
+
it('uses a shared time range and resolves nearest hover values for paired I/O sparklines', () => {
const series = [
{
diff --git a/frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts b/frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts
index 2d82df3b21..461a757890 100644
--- a/frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts
+++ b/frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts
@@ -75,6 +75,7 @@ export const WORKLOAD_TABLE_HISTORY_RANGE_LABELS: Record<WorkloadTableMetricHist
};
export const WORKLOAD_TABLE_HISTORY_DEFAULT_RANGE: WorkloadTableMetricHistoryRange = '1h';
export const WORKLOAD_TABLE_HISTORY_MAX_POINTS = 72;
+export const MIN_PERCENT_SCALE_CEILING = 5;
export const WORKLOAD_TABLE_HISTORY_POLL_MS = 30_000;
export const WORKLOAD_TABLE_HISTORY_INFRA_METRICS = [
@@ -298,10 +299,6 @@ export const getMetricMiniSparklineScale = (
series: readonly WorkloadMetricSparklineSeries[],
unit?: string,
): MetricMiniSparklineScale => {
- if (unit === '%') {
- return { minValue: 0, maxValue: 100 };
- }
-
let maxValue = 0;
for (const item of series) {
for (const point of item.points) {
@@ -311,6 +308,18 @@ export const getMetricMiniSparklineScale = (
}
}
+ if (unit === '%') {
+ // Percent sparklines stay zero-floored, but a hard 0-100 window pins
+ // low-domain series onto the axis rule where no shape survives: a guest's
+ // share of host memory is single digits by construction, and idle guests
+ // sit near zero on CPU. Scale to the observed peak like the I/O series do,
+ // with a floor ceiling so idle noise stays flat instead of amplified.
+ return {
+ minValue: 0,
+ maxValue: Math.min(100, Math.max(MIN_PERCENT_SCALE_CEILING, maxValue * 1.15)),
+ };
+ }
+
return {
minValue: 0,
maxValue: Math.max(1, maxValue * 1.15),