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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
Chart Net and Disk I/O in the row history lens
rcourtmancdae811bb7a0
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 710f4ef07e..a017298dca 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -666,13 +666,18 @@ existing picker unchanged.The default Workloads metric presentation keeps compact progress bars at rest.A fine-pointer preview or keyboard focus on one guest row replaces CPU, memory,-and disk together with the existing `MetricMiniSparkline` presentation without-changing row height; touch pointer entry does not trigger this transient lens,-and the persistent Trends View choice remains the touch-accessible fallback.+disk, Net I/O, and Disk I/O together with the existing `MetricMiniSparkline`+presentation without changing row height; touch pointer entry does not trigger+this transient lens, and the persistent Trends View choice remains the+touch-accessible fallback. Both I/O cells render through one rate renderer in+the lens and in Trends: the chart keeps a compact current pair beside it+(`MetricMiniSparklineRatePair`, the at-rest ↓/↑ and R/W glyphs coloured like+the series they label) while the full rates stay in the chart's accessible+label, and a stopped guest or unavailable I/O keeps its dash.The active chart owns its local tooltip while its normalized cursor position isshared across sibling charts in that guest row, so every guide represents thesame relative point in the selected history range. Leaving the row clears the-cursor and restores all three bars together. The lens mounts with a short+cursor and restores the bars and I/O readouts together. The lens mounts with a shortreduced-motion-safe fade and must not leave both bar and chart semantics in theaccessibility tree simultaneously.Bar mode resolves history only for that active guest through its canonicaldiff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex a26b7e22af..0863723717 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -2005,8 +2005,10 @@ Trend-mode and row-history-lens 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+5% floor ceiling and a 100% cap. Network and disk I/O series follow the same+shape rule with a 100 KiB/s floor ceiling, so an idle guest's background+chatter stays near the axis instead of drawing the full-height spike a busy+guest draws. A fixed 0-100 window is not the contract, because insidea 16px table cell it draws low-domain series such as a guest's share of hostmemory or an idle guest's CPU on top of the axis rule, where a flat line isindistinguishable from missing history. Absolute level stays readable through@@ -2015,7 +2017,10 @@ work must not remove those. The scale is derived from the points alreadyfetched for that cell and must not add history reads or a second pass over theWorkloads hot path. Pointer scrubbing may synchronize one normalized cursorposition across the active guest row, but it must remain row-local and operate-only on the already-fetched series.+only on the already-fetched series. `GuestRow` builds each chart from accessors,+so a live snapshot updates the mounted lens or Trends chart in place instead of+remounting it, and an open scrub tooltip re-reads the current series at its+pointer position rather than holding the values from the last mouse move.The Workloads table metric display mode is part of the protected Workloadshot path. Default bar mode keeps compact current-value bars at rest and swapsdiff --git a/frontend-modern/browser-verification/baa3a6b3d9fabd1a.json b/frontend-modern/browser-verification/baa3a6b3d9fabd1a.jsonnew file mode 100644index 0000000000..32c74e7a1c--- /dev/null+++ b/frontend-modern/browser-verification/baa3a6b3d9fabd1a.json@@ -0,0 +1,61 @@+{+ "version": 1,+ "base_sha": "9aaac4d3e502c01913fb3637d0997b0ce03a8b7b",+ "verified_at": "2026-10-06T19:32:29Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/components/Workloads/GuestRow.tsx",+ "frontend-modern/src/components/Workloads/MetricDisplayModeSegmentedControl.tsx",+ "frontend-modern/src/components/Workloads/MetricMiniSparkline.tsx",+ "frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts",+ "frontend-modern/src/utils/format.ts"+ ],+ "content_sha256": {+ "frontend-modern/src/components/Workloads/GuestRow.tsx": "3e7b1583b1c2ff5db07aaaa59006684f2e8c7d71d035f1ba29c03be28ae3bcd9",+ "frontend-modern/src/components/Workloads/MetricDisplayModeSegmentedControl.tsx": "fc4af4a98de6ddae1b26033ad102398cb598975bae0619cba134610d8102e2d9",+ "frontend-modern/src/components/Workloads/MetricMiniSparkline.tsx": "3afd872c9633430d60f8782b33501d941ccdef8f58f28a65cecf5ca7845c6523",+ "frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts": "b2fbcd169b0d7bacb8045ad4c134e6ddb5addc7ce6c4d0ac4a3c6673b85f462f",+ "frontend-modern/src/utils/format.ts": "30ce3873607bdf03e34307f56e561c191957304b7e07b780afb2bbb9bd554d98"+ },+ "routes": [+ "/proxmox"+ ],+ "viewports": [+ {+ "width": 1920,+ "height": 1000+ },+ {+ "width": 1600,+ "height": 1000+ },+ {+ "width": 1440,+ "height": 1000+ },+ {+ "width": 768,+ "height": 1000+ }+ ],+ "states": [+ "Private mock stack (backend + Vite on 7735/5253) built from main plus this change; before captures taken on the same stack before the edit, and the 1440 behaviour re-checked with main's versions of these files swapped back in",+ "Before, bars mode at 1600 dark: hovering artifact-cache-310 swapped CPU, memory and disk for synchronized sparklines while Net I/O and Disk I/O stayed as static numbers",+ "After, bars mode at 1600 dark and 1920 light: the same hover swaps all five cells; the I/O cells show both series with a compact coloured pair (e.g. ↓3.2M ↑2.2M, R1.4M W826K) and the svg labels carry the full rates; row stays 32px tall",+ "After, pointer scrub on the CPU chart moves one cursor across all five charts, including both I/O charts",+ "After, live update while scrubbing: with the Net I/O tooltip open on artifact-cache-310, a websocket snapshot changed the compact pair (↓2.8M to ↓3.7M) while all five chart nodes stayed mounted and the tooltip stayed open (before this change every live update remounted the lens charts)",+ "After, idle I/O (history intercepted to 1-6 KB/s with one 80 KB/s disk write flush): both I/O lines sit within a pixel of the axis and the flush still shows as a bump instead of every blip filling the cell",+ "After, Trends (sparklines) mode at 1600 dark: every running guest's I/O cell shows chart plus compact pair (736 charts, 256 rate pairs, 0 clipped), stopped dev-portal-312 keeps its dash",+ "After, 768 dark and light: I/O columns are hidden by the layout as before; the lens and Trends still render CPU/memory/disk with 0 clipped cells",+ "Pre-existing, not changed here: at 1440 the first-use history hint wraps and its dismissal shifts the table 36px, so the first lens opens on the next row (same on main)"+ ],+ "interactions": [+ "Hovered guest rows with a fine pointer in bars mode and read data-history-lens-active, chart count and svg aria-labels",+ "Moved the pointer across the CPU chart to scrub and confirmed cursor lines in all five charts",+ "Tagged the five lens chart nodes, opened the Net I/O tooltip, waited for live updates and compared node tags, compact pair text and tooltip presence",+ "Left the row and confirmed bars and I/O numbers returned",+ "Switched View to sparklines via the metric display toggle and measured chart, pair and overflow counts",+ "Intercepted /api/metrics-store/history for one guest to idle I/O values to inspect the scale floor",+ "Traced pointerenter/pointerleave and row y at 1440 to explain the lens opening on the next row"+ ]+}diff --git a/frontend-modern/src/components/Workloads/GuestRow.tsx b/frontend-modern/src/components/Workloads/GuestRow.tsxindex adb2046f0a..ef0d60564d 100644--- a/frontend-modern/src/components/Workloads/GuestRow.tsx+++ b/frontend-modern/src/components/Workloads/GuestRow.tsx@@ -1,4 +1,4 @@-import { createMemo, createSignal, Show, splitProps } from 'solid-js';+import { createMemo, createSignal, Show, splitProps, type JSX } from 'solid-js';import BoxIcon from 'lucide-solid/icons/box';import type { VM } from '@/types/api';import type { WorkloadGuest } from '@/types/workloads';@@ -22,6 +22,7 @@ import { getWorkloadCPUPercent, resolveWorkloadType } from '@/utils/workloads';import { EnhancedCPUBar } from '@/components/Workloads/EnhancedCPUBar';import {MetricMiniSparkline,+ MetricMiniSparklineRatePair,type MetricMiniSparklineValueLabelContext,} from '@/components/Workloads/MetricMiniSparkline';import { UpdateButton } from '@/components/shared/ContainerUpdateBadge';@@ -38,6 +39,7 @@ import type { GuestRowProps } from './guestRowModel';import { useGuestRowState } from './useGuestRowState';import type {WorkloadMetricHistoryReader,+ WorkloadRateMetric,WorkloadTableMetric,} from './workloadMetricHistoryModel';@@ -200,29 +202,88 @@ export function GuestRow(props: GuestRowProps) {}return clampMetricPercent(fallbackUsage);};+ // Every input is an accessor so a live snapshot updates the mounted chart in+ // place. Reading signals while building the chart would remount it on each+ // update and drop an open scrub tooltip.const renderMetricSparkline = (metric: WorkloadTableMetric,- valueLabel: string,- title: string,- unit = '%',- valueLabelMode: 'inline' | 'tooltip' | 'hidden' = 'inline',- formatValue?: (value: number) => string,- seriesOptions?: Parameters<WorkloadMetricHistoryReader['getGuestMetricSeries']>[2],- valueLabelContext?: MetricMiniSparklineValueLabelContext,+ options: {+ valueLabel: () => string;+ title: () => string;+ unit?: string;+ formatValue: (value: number) => string;+ seriesOptions?: () => Parameters<WorkloadMetricHistoryReader['getGuestMetricSeries']>[2];+ valueLabelContext?: () => MetricMiniSparklineValueLabelContext;+ valueContent?: () => JSX.Element;+ },) => (<MetricMiniSparkline- series={props.metricHistory?.getGuestMetricSeries(props.guest, metric, seriesOptions) ?? []}- valueLabel={valueLabel}- valueLabelContext={valueLabelContext}- valueLabelMode={valueLabelMode}- title={title}- unit={unit}- formatValue={formatValue}+ series={+ props.metricHistory?.getGuestMetricSeries(props.guest, metric, options.seriesOptions?.()) ??+ []+ }+ valueLabel={options.valueLabel()}+ valueContent={options.valueContent?.()}+ valueLabelContext={options.valueLabelContext?.()}+ valueLabelMode="inline"+ title={options.title()}+ unit={options.unit ?? '%'}+ formatValue={options.formatValue}cursorRatio={historyCursorRatio()}onCursorRatioChange={setTrackedHistoryCursorRatio}showTooltip={true}/>);+ const renderCpuSparkline = () =>+ renderMetricSparkline('cpu', {+ valueLabel: () => formatMetricPercent(cpuPercent()),+ title: () => `${props.guest.name} CPU history`,+ formatValue: formatMetricPercent,+ });+ const renderMemorySparkline = () =>+ renderMetricSparkline('memory', {+ valueLabel: () =>+ memoryDisplayUnavailable()+ ? 'N/A'+ : formatMetricPercent(+ usagePercent(+ props.guest.memory?.used,+ memoryDisplayTotal(),+ isHostMemoryBasis() ? undefined : props.guest.memory?.usage,+ ),+ ),+ title: () =>+ isHostMemoryBasis()+ ? `${props.guest.name} host memory share history`+ : `${props.guest.name} memory history`,+ formatValue: formatMetricPercent,+ seriesOptions: () => ({+ memoryDisplayBasis: props.memoryDisplayBasis,+ parentMemoryTotal: props.parentMemoryTotal,+ }),+ });+ const renderDiskSparkline = () =>+ renderMetricSparkline('disk', {+ valueLabel: () => (hasDiskUsage() ? formatMetricPercent(props.guest.disk?.usage) : '—'),+ title: () => `${props.guest.name} disk usage history`,+ formatValue: formatMetricPercent,+ valueLabelContext: () => diskValueLabelContext(),+ });+ const renderRateSparkline = (metric: WorkloadRateMetric) => {+ const isNetwork = metric === 'netIo';+ const live = () => isRunning() && telemetryAvailable(isNetwork ? 'networkIO' : 'diskIO');+ const values = (): [number, number] =>+ isNetwork ? [networkIn(), networkOut()] : [diskRead(), diskWrite()];+ return renderMetricSparkline(metric, {+ valueLabel: () =>+ live() ? `${formatSpeed(values()[0])} / ${formatSpeed(values()[1])}` : '—',+ title: () => `${props.guest.name} ${isNetwork ? 'network' : 'disk'} I/O history`,+ unit: 'B/s',+ formatValue: formatSpeed,+ valueContent: () =>+ live() ? <MetricMiniSparklineRatePair metric={metric} values={values()} /> : undefined,+ });+ };const getDiskStatusTooltip = () => {if (!isVM(props.guest)) return 'Disk stats unavailable';@@ -475,27 +536,13 @@ export function GuestRow(props: GuestRowProps) {}><div class="h-4 animate-in fade-in-0 duration-100 motion-reduce:animate-none">- {renderMetricSparkline(- 'cpu',- formatMetricPercent(cpuPercent()),- `${props.guest.name} CPU history`,- '%',- 'inline',- formatMetricPercent,- )}+ {renderCpuSparkline()}</div></Show></div>}>- {renderMetricSparkline(- 'cpu',- formatMetricPercent(cpuPercent()),- `${props.guest.name} CPU history`,- '%',- 'inline',- formatMetricPercent,- )}+ {renderCpuSparkline()}</Show></Show></td>@@ -545,55 +592,13 @@ export function GuestRow(props: GuestRowProps) {}><div class="h-4 animate-in fade-in-0 duration-100 motion-reduce:animate-none">- {renderMetricSparkline(- 'memory',- memoryDisplayUnavailable()- ? 'N/A'- : formatMetricPercent(- usagePercent(- props.guest.memory?.used,- memoryDisplayTotal(),- isHostMemoryBasis() ? undefined : props.guest.memory?.usage,- ),- ),- isHostMemoryBasis()- ? `${props.guest.name} host memory share history`- : `${props.guest.name} memory history`,- '%',- 'inline',- formatMetricPercent,- {- memoryDisplayBasis: props.memoryDisplayBasis,- parentMemoryTotal: props.parentMemoryTotal,- },- )}+ {renderMemorySparkline()}</div></Show></div>}>- {renderMetricSparkline(- 'memory',- memoryDisplayUnavailable()- ? 'N/A'- : formatMetricPercent(- usagePercent(- props.guest.memory?.used,- memoryDisplayTotal(),- isHostMemoryBasis() ? undefined : props.guest.memory?.usage,- ),- ),- isHostMemoryBasis()- ? `${props.guest.name} host memory share history`- : `${props.guest.name} memory history`,- '%',- 'inline',- formatMetricPercent,- {- memoryDisplayBasis: props.memoryDisplayBasis,- parentMemoryTotal: props.parentMemoryTotal,- },- )}+ {renderMemorySparkline()}</Show></td></Show>@@ -605,18 +610,7 @@ export function GuestRow(props: GuestRowProps) {data-workload-col="disk"title={diskReadStatus()?.message}>- <Show when={isSparklineMode()}>- {renderMetricSparkline(- 'disk',- hasDiskUsage() ? formatMetricPercent(props.guest.disk?.usage) : '—',- `${props.guest.name} disk usage history`,- '%',- 'inline',- formatMetricPercent,- undefined,- diskValueLabelContext(),- )}- </Show>+ <Show when={isSparklineMode()}>{renderDiskSparkline()}</Show><Show when={!isSparklineMode()}><Showwhen={hasDiskUsage()}@@ -647,16 +641,7 @@ export function GuestRow(props: GuestRowProps) {}><div class="h-4 animate-in fade-in-0 duration-100 motion-reduce:animate-none">- {renderMetricSparkline(- 'disk',- formatMetricPercent(props.guest.disk?.usage),- `${props.guest.name} disk usage history`,- '%',- 'inline',- formatMetricPercent,- undefined,- diskValueLabelContext(),- )}+ {renderDiskSparkline()}</div></Show></div>@@ -916,18 +901,7 @@ export function GuestRow(props: GuestRowProps) {{/* Net I/O */}<Show when={isColVisible('netIo')}><td class="px-1.5 sm:px-2 py-0.5 align-middle">- <Show when={isSparklineMode()}>- {renderMetricSparkline(- 'netIo',- isRunning() && telemetryAvailable('networkIO')- ? `${formatSpeed(networkIn())} / ${formatSpeed(networkOut())}`- : '—',- `${props.guest.name} network I/O history`,- 'B/s',- 'tooltip',- formatSpeed,- )}- </Show>+ <Show when={isSparklineMode()}>{renderRateSparkline('netIo')}</Show><Show when={!isSparklineMode()}><Showwhen={isRunning() && telemetryAvailable('networkIO')}@@ -939,30 +913,39 @@ export function GuestRow(props: GuestRowProps) {</div>}>- <div class="grid w-full min-w-0 grid-cols-[0.75rem_minmax(0,1fr)_0.75rem_minmax(0,1fr)] items-center gap-x-1 overflow-hidden text-[11px] tabular-nums">- <span class="inline-flex w-3 justify-center text-emerald-500">↓</span>- <span- class={`block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap ${networkEmphasis().className}`}- title={- networkEmphasis().showOutlierHint- ? `${formatSpeed(networkIn())} (Top outlier)`- : formatSpeed(networkIn())- }- >- {formatSpeed(networkIn())}- </span>- <span class="inline-flex w-3 justify-center text-orange-400">↑</span>- <span- class={`block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap ${networkEmphasis().className}`}- title={- networkEmphasis().showOutlierHint- ? `${formatSpeed(networkOut())} (Top outlier)`- : formatSpeed(networkOut())- }- >- {formatSpeed(networkOut())}- </span>- </div>+ <Show+ when={historyLensVisible()}+ fallback={+ <div class="grid w-full min-w-0 grid-cols-[0.75rem_minmax(0,1fr)_0.75rem_minmax(0,1fr)] items-center gap-x-1 overflow-hidden text-[11px] tabular-nums">+ <span class="inline-flex w-3 justify-center text-emerald-500">↓</span>+ <span+ class={`block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap ${networkEmphasis().className}`}+ title={+ networkEmphasis().showOutlierHint+ ? `${formatSpeed(networkIn())} (Top outlier)`+ : formatSpeed(networkIn())+ }+ >+ {formatSpeed(networkIn())}+ </span>+ <span class="inline-flex w-3 justify-center text-orange-400">↑</span>+ <span+ class={`block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap ${networkEmphasis().className}`}+ title={+ networkEmphasis().showOutlierHint+ ? `${formatSpeed(networkOut())} (Top outlier)`+ : formatSpeed(networkOut())+ }+ >+ {formatSpeed(networkOut())}+ </span>+ </div>+ }+ >+ <div class="h-4 animate-in fade-in-0 duration-100 motion-reduce:animate-none">+ {renderRateSparkline('netIo')}+ </div>+ </Show></Show></Show></td>@@ -971,18 +954,7 @@ export function GuestRow(props: GuestRowProps) {{/* Disk I/O */}<Show when={isColVisible('diskIo')}><td class="px-1.5 sm:px-2 py-0.5 align-middle">- <Show when={isSparklineMode()}>- {renderMetricSparkline(- 'diskIo',- isRunning() && telemetryAvailable('diskIO')- ? `${formatSpeed(diskRead())} / ${formatSpeed(diskWrite())}`- : '—',- `${props.guest.name} disk I/O history`,- 'B/s',- 'tooltip',- formatSpeed,- )}- </Show>+ <Show when={isSparklineMode()}>{renderRateSparkline('diskIo')}</Show><Show when={!isSparklineMode()}><Showwhen={isRunning() && telemetryAvailable('diskIO')}@@ -994,30 +966,39 @@ export function GuestRow(props: GuestRowProps) {</div>}>- <div class="grid w-full min-w-0 grid-cols-[0.75rem_minmax(0,1fr)_0.75rem_minmax(0,1fr)] items-center gap-x-1 overflow-hidden text-[11px] tabular-nums">- <span class="inline-flex w-3 justify-center font-mono text-blue-500">R</span>- <span- class={`block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap ${diskIOEmphasis().className}`}- title={- diskIOEmphasis().showOutlierHint- ? `${formatSpeed(diskRead())} (Top outlier)`- : formatSpeed(diskRead())- }- >- {formatSpeed(diskRead())}- </span>- <span class="inline-flex w-3 justify-center font-mono text-amber-500">W</span>- <span- class={`block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap ${diskIOEmphasis().className}`}- title={- diskIOEmphasis().showOutlierHint- ? `${formatSpeed(diskWrite())} (Top outlier)`- : formatSpeed(diskWrite())- }- >- {formatSpeed(diskWrite())}- </span>- </div>+ <Show+ when={historyLensVisible()}+ fallback={+ <div class="grid w-full min-w-0 grid-cols-[0.75rem_minmax(0,1fr)_0.75rem_minmax(0,1fr)] items-center gap-x-1 overflow-hidden text-[11px] tabular-nums">+ <span class="inline-flex w-3 justify-center font-mono text-blue-500">R</span>+ <span+ class={`block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap ${diskIOEmphasis().className}`}+ title={+ diskIOEmphasis().showOutlierHint+ ? `${formatSpeed(diskRead())} (Top outlier)`+ : formatSpeed(diskRead())+ }+ >+ {formatSpeed(diskRead())}+ </span>+ <span class="inline-flex w-3 justify-center font-mono text-amber-500">W</span>+ <span+ class={`block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap ${diskIOEmphasis().className}`}+ title={+ diskIOEmphasis().showOutlierHint+ ? `${formatSpeed(diskWrite())} (Top outlier)`+ : formatSpeed(diskWrite())+ }+ >+ {formatSpeed(diskWrite())}+ </span>+ </div>+ }+ >+ <div class="h-4 animate-in fade-in-0 duration-100 motion-reduce:animate-none">+ {renderRateSparkline('diskIo')}+ </div>+ </Show></Show></Show></td>diff --git a/frontend-modern/src/components/Workloads/MetricDisplayModeSegmentedControl.tsx b/frontend-modern/src/components/Workloads/MetricDisplayModeSegmentedControl.tsxindex a6faaa2a3b..e5e5ee47d8 100644--- a/frontend-modern/src/components/Workloads/MetricDisplayModeSegmentedControl.tsx+++ b/frontend-modern/src/components/Workloads/MetricDisplayModeSegmentedControl.tsx@@ -47,7 +47,7 @@ export const MetricHoverModeSegmentedControl: Component<MetricHoverModeSegmented},{value: 'history',- title: 'Preview synchronized CPU, memory, and disk history across the row',+ title: 'Preview synchronized CPU, memory, disk, and I/O history across the row',label: 'History',},]}diff --git a/frontend-modern/src/components/Workloads/MetricMiniSparkline.tsx b/frontend-modern/src/components/Workloads/MetricMiniSparkline.tsxindex eedc2de08f..b4eb62f3ed 100644--- a/frontend-modern/src/components/Workloads/MetricMiniSparkline.tsx+++ b/frontend-modern/src/components/Workloads/MetricMiniSparkline.tsx@@ -1,5 +1,6 @@import { For, Show, createMemo, createSignal, type Component, type JSX } from 'solid-js';import { TooltipPortal } from '@/components/shared/TooltipPortal';+import { formatCompactSpeed } from '@/utils/format';import {buildMetricMiniSparklinePath,@@ -8,8 +9,10 @@ import {getMetricMiniSparklineScale,getMetricMiniSparklineTimeRange,hasRenderableMetricSeries,+ WORKLOAD_RATE_METRIC_GLYPHS,type MetricMiniSparklineHoverState,type WorkloadMetricSparklineSeries,+ type WorkloadRateMetric,} from './workloadMetricHistoryModel';type MetricMiniSparklineValueLabelMode = 'inline' | 'tooltip' | 'hidden';@@ -18,6 +21,8 @@ export type MetricMiniSparklineValueLabelContext = 'current' | 'last known';interface MetricMiniSparklineProps {series: WorkloadMetricSparklineSeries[];valueLabel?: string;+ /** Visible inline value when it should read shorter than the accessible valueLabel. */+ valueContent?: JSX.Element;valueLabelMode?: MetricMiniSparklineValueLabelMode;valueLabelContext?: MetricMiniSparklineValueLabelContext;title?: string;@@ -29,10 +34,13 @@ interface MetricMiniSparklineProps {showTooltip?: boolean;}-type MetricMiniSparklineTooltipState = MetricMiniSparklineHoverState & {+interface MetricMiniSparklinePointer {+ cursorRatio: number;tooltipX: number;tooltipY: number;-};+}++type MetricMiniSparklineTooltipState = MetricMiniSparklineHoverState & MetricMiniSparklinePointer;const SPARKLINE_VIEWBOX_WIDTH = 96;const SPARKLINE_PLOT_X_PADDING = 1;@@ -72,9 +80,16 @@ export const MetricMiniSparkline: Component<MetricMiniSparklineProps> = (props)const showInlineValue = createMemo(() => valueLabelMode() === 'inline' || (valueLabelMode() === 'tooltip' && !hasLine()),);- const [hoveredState, setHoveredState] = createSignal<MetricMiniSparklineTooltipState | null>(- null,- );+ // Keep only where the pointer is. The tooltip's point and values derive from+ // the current series, so a live update under an open tooltip re-reads it+ // instead of showing the snapshot taken at the last mouse move.+ const [pointer, setPointer] = createSignal<MetricMiniSparklinePointer | null>(null);+ const hoveredState = createMemo<MetricMiniSparklineTooltipState | null>(() => {+ const current = pointer();+ if (!current) return null;+ const state = computeMetricMiniSparklineHoverState(props.series, current.cursorRatio, 1);+ return state ? { ...state, tooltipX: current.tooltipX, tooltipY: current.tooltipY } : null;+ });const synchronizedState = createMemo(() => {const ratio = props.cursorRatio;if (ratio === null || ratio === undefined) return null;@@ -102,7 +117,7 @@ export const MetricMiniSparkline: Component<MetricMiniSparklineProps> = (props));const handleMouseMove: JSX.EventHandler<SVGSVGElement, MouseEvent> = (event) => {if (!hasLine()) {- setHoveredState(null);+ setPointer(null);props.onCursorRatioChange?.(null);return;}@@ -113,10 +128,10 @@ export const MetricMiniSparkline: Component<MetricMiniSparklineProps> = (props)event.clientX - rect.left,rect.width,);- setHoveredState(+ setPointer(next? {- ...next,+ cursorRatio: next.cursorRatio,tooltipX: event.clientX,tooltipY: rect.top,}@@ -125,7 +140,7 @@ export const MetricMiniSparkline: Component<MetricMiniSparklineProps> = (props)props.onCursorRatioChange?.(next?.cursorRatio ?? null);};const handleMouseLeave = () => {- setHoveredState(null);+ setPointer(null);props.onCursorRatioChange?.(null);};const showTooltip = createMemo(() => (props.showTooltip ?? true) && hoveredState());@@ -179,7 +194,7 @@ export const MetricMiniSparkline: Component<MetricMiniSparklineProps> = (props)</svg><Show when={showInlineValue()}><span class="block max-w-22 overflow-hidden text-ellipsis whitespace-nowrap text-right text-[10px] font-medium tabular-nums text-base-content">- {displayLabel()}+ {props.valueContent ?? displayLabel()}</span></Show><Show when={showTooltip()}>@@ -215,3 +230,28 @@ export const MetricMiniSparkline: Component<MetricMiniSparklineProps> = (props)</div>);};++interface MetricMiniSparklineRatePairProps {+ metric: WorkloadRateMetric;+ values: readonly [number, number];+}++/**+ * Current in/out (or read/write) rates compact enough to sit beside a rate+ * sparkline. The full rates belong in the chart's valueLabel, which carries+ * them to assistive technology, so this abbreviation stays out of that tree.+ */+export const MetricMiniSparklineRatePair: Component<MetricMiniSparklineRatePairProps> = (props) => (+ <span aria-hidden="true" data-metric-rate-pair="true" class="inline-flex items-center gap-1">+ <For each={WORKLOAD_RATE_METRIC_GLYPHS[props.metric]}>+ {(entry, index) => (+ <span class="inline-flex items-center gap-px">+ <span class={entry.mono ? 'font-mono' : undefined} style={{ color: entry.color }}>+ {entry.glyph}+ </span>+ {formatCompactSpeed(props.values[index()])}+ </span>+ )}+ </For>+ </span>+);diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsxindex 39b59fb197..36317abf96 100644--- a/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/GuestRow.test.tsx@@ -541,9 +541,15 @@ describe('GuestRow', () => {expect(screen.queryByTestId('disk-bar')).not.toBeInTheDocument();});- it('keeps Net I/O and Disk I/O live labels out of sparkline table cells', () => {+ it('pairs Net I/O and Disk I/O sparklines with compact current rates', () => {renderGuestRow({- guest: makeGuest({ name: 'spark-io-vm', networkIn: 1024, networkOut: 2048 }),+ guest: makeGuest({+ name: 'spark-io-vm',+ networkIn: 3.32 * 1024 * 1024,+ networkOut: 512 * 1024,+ diskRead: 0,+ diskWrite: 2048,+ }),visibleColumnIds: ['name', 'netIo', 'diskIo'],metricDisplayMode: 'sparklines',metricHistory: {@@ -565,10 +571,160 @@ describe('GuestRow', () => {const sparklines = screen.getAllByTestId('metric-mini-sparkline');expect(sparklines).toHaveLength(2);expect(sparklines.map((sparkline) => sparkline.dataset.valueLabelMode)).toEqual([- 'tooltip',- 'tooltip',+ 'inline',+ 'inline',+ ]);+ // The full pair does not fit beside a chart; the compact pair does, and+ // its glyphs double as the legend for the two lines.+ expect(sparklines.map((sparkline) => sparkline.textContent)).toEqual([+ '↓3.3M↑512K',+ 'R0W2.0K',]);- expect(screen.queryByText('1.00 KB/s / 2.00 KB/s')).toBeNull();+ expect(screen.queryByText('3.32 MB/s / 512 KB/s')).toBeNull();+ expect(+ sparklines.map((sparkline) => sparkline.querySelector('svg')?.getAttribute('aria-label')),+ ).toEqual([+ 'spark-io-vm network I/O history, current 3.32 MB/s / 512 KB/s',+ 'spark-io-vm disk I/O history, current 0 B/s / 2.00 KB/s',+ ]);+ });++ it('swaps Net I/O and Disk I/O readouts into the row history lens', () => {+ renderGuestRow({+ guest: makeGuest({ name: 'io-lens-vm', networkIn: 2048, networkOut: 4096 }),+ visibleColumnIds: ['name', 'cpu', 'netIo', 'diskIo'],+ metricDisplayMode: 'bars',+ metricHistory: {+ getGuestMetricSeries: (_guest, metric) => [+ {+ id: metric,+ label: metric,+ color: '#8b5cf6',+ points: [+ { timestamp: 1, value: 10 },+ { timestamp: 2, value: 25 },+ ],+ },+ ],+ getNodeMetricSeries: () => [],+ },+ });++ expect(screen.getByText('2.00 KB/s')).toBeInTheDocument();+ expect(screen.getByText('4.00 KB/s')).toBeInTheDocument();++ const row = screen.getByText('io-lens-vm').closest('tr')!;+ fireEvent.pointerEnter(row, { pointerType: 'mouse' });++ const lensCharts = screen.getAllByTestId('metric-mini-sparkline');+ expect(+ lensCharts.map((chart) => chart.querySelector('svg')?.getAttribute('aria-label')),+ ).toEqual([+ 'io-lens-vm CPU history, current 25%',+ 'io-lens-vm network I/O history, current 2.00 KB/s / 4.00 KB/s',+ 'io-lens-vm disk I/O history, current 500 B/s / 600 B/s',+ ]);+ expect(screen.queryByText('2.00 KB/s')).toBeNull();+ expect(lensCharts[1].textContent).toBe('↓2.0K↑4.0K');+ expect(lensCharts[1].parentElement).toHaveClass('h-4', 'motion-reduce:animate-none');++ const cpuSvg = lensCharts[0].querySelector('svg') as SVGSVGElement;+ cpuSvg.getBoundingClientRect = () =>+ ({+ bottom: 18,+ height: 18,+ left: 0,+ right: 96,+ top: 0,+ width: 96,+ x: 0,+ y: 0,+ toJSON: () => ({}),+ }) as DOMRect;+ fireEvent.mouseMove(cpuSvg, { clientX: 48, clientY: 8 });+ expect(lensCharts.every((chart) => chart.querySelector('[data-metric-history-cursor]'))).toBe(+ true,+ );++ fireEvent.pointerLeave(row, { pointerType: 'mouse' });+ expect(screen.queryByTestId('metric-mini-sparkline')).not.toBeInTheDocument();+ expect(screen.getByText('2.00 KB/s')).toBeInTheDocument();+ });++ it('keeps lens charts mounted across live updates so scrub state survives', () => {+ const [guest, setGuest] = createSignal(+ makeGuest({ name: 'live-lens-vm', cpu: 0.2, networkIn: 2048, networkOut: 4096 }),+ );+ renderGuestRow({+ get guest() {+ return guest();+ },+ visibleColumnIds: ['name', 'cpu', 'netIo'],+ metricDisplayMode: 'bars',+ metricHistory: {+ getGuestMetricSeries: (_guest, metric) => [+ {+ id: metric,+ label: metric,+ color: '#8b5cf6',+ points: [+ { timestamp: 1, value: 10 },+ { timestamp: 2, value: 25 },+ ],+ },+ ],+ getNodeMetricSeries: () => [],+ },+ });++ const row = screen.getByText('live-lens-vm').closest('tr')!;+ fireEvent.pointerEnter(row, { pointerType: 'mouse' });+ const [cpuChart, netChart] = screen.getAllByTestId('metric-mini-sparkline');++ setGuest(makeGuest({ name: 'live-lens-vm', cpu: 0.4, networkIn: 8192, networkOut: 1024 }));++ // A websocket snapshot while the operator is reading a chart must update+ // its values in place: a remount drops the chart's open scrub tooltip.+ const [nextCpuChart, nextNetChart] = screen.getAllByTestId('metric-mini-sparkline');+ expect(nextCpuChart).toBe(cpuChart);+ expect(nextNetChart).toBe(netChart);+ expect(nextNetChart.textContent).toBe('↓8.0K↑1.0K');+ expect(nextCpuChart.querySelector('svg')).toHaveAttribute(+ 'aria-label',+ 'live-lens-vm CPU history, current 40%',+ );+ expect(nextNetChart.querySelector('svg')).toHaveAttribute(+ 'aria-label',+ 'live-lens-vm network I/O history, current 8.00 KB/s / 1.00 KB/s',+ );+ });++ it('leaves stopped guests on the I/O dash while the lens charts the rest of the row', () => {+ renderGuestRow({+ guest: makeGuest({ name: 'io-stopped-vm', status: 'stopped' }),+ visibleColumnIds: ['name', 'cpu', 'netIo', 'diskIo'],+ metricDisplayMode: 'bars',+ metricHistory: {+ getGuestMetricSeries: (_guest, metric) => [+ {+ id: metric,+ label: metric,+ color: '#8b5cf6',+ points: [+ { timestamp: 1, value: 10 },+ { timestamp: 2, value: 25 },+ ],+ },+ ],+ getNodeMetricSeries: () => [],+ },+ });++ const row = screen.getByText('io-stopped-vm').closest('tr')!;+ fireEvent.pointerEnter(row, { pointerType: 'mouse' });++ expect(screen.getAllByTestId('metric-mini-sparkline')).toHaveLength(1);+ expect(row.querySelector('[data-metric-rate-pair]')).toBeNull();});it('shows dash when disk data is unavailable', () => {diff --git a/frontend-modern/src/components/Workloads/__tests__/MetricMiniSparkline.test.tsx b/frontend-modern/src/components/Workloads/__tests__/MetricMiniSparkline.test.tsxindex d145438de7..1d6a654f65 100644--- a/frontend-modern/src/components/Workloads/__tests__/MetricMiniSparkline.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/MetricMiniSparkline.test.tsx@@ -4,6 +4,7 @@ import { fireEvent, render, screen } from '@solidjs/testing-library';import { createSignal } from 'solid-js';import {MetricMiniSparkline,+ MetricMiniSparklineRatePair,type MetricMiniSparklineValueLabelContext,} from '../MetricMiniSparkline';@@ -146,4 +147,88 @@ describe('MetricMiniSparkline', () => {expect(screen.getByText('Out')).toBeInTheDocument();expect(screen.getByText('200 B/s')).toBeInTheDocument();});++ it('shows a compact rate pair beside the chart while announcing the full rates', () => {+ render(() => (+ <MetricMiniSparkline+ title="Disk I/O history"+ unit="B/s"+ valueLabel="3.32 MB/s / 512 KB/s"+ valueContent={+ <MetricMiniSparklineRatePair metric="diskIo" values={[3.32 * 1024 * 1024, 512 * 1024]} />+ }+ series={[+ {+ id: 'diskread',+ label: 'Read',+ color: '#3b82f6',+ points: [+ { timestamp: 1_000, value: 10 },+ { timestamp: 2_000, value: 20 },+ ],+ },+ ]}+ />+ ));++ const sparkline = screen.getByTestId('metric-mini-sparkline');+ expect(sparkline.dataset.valueLabelMode).toBe('inline');+ expect(sparkline.textContent).toBe('R3.3MW512K');+ expect(screen.queryByText('3.32 MB/s / 512 KB/s')).not.toBeInTheDocument();+ expect(sparkline.querySelector('svg')).toHaveAttribute(+ 'aria-label',+ 'Disk I/O history, current 3.32 MB/s / 512 KB/s',+ );++ const pair = sparkline.querySelector('[data-metric-rate-pair]') as HTMLElement;+ expect(pair).toHaveAttribute('aria-hidden', 'true');+ // Glyph colours match the read/write series they label.+ expect(screen.getByText('R')).toHaveStyle({ color: '#3b82f6' });+ expect(screen.getByText('W')).toHaveStyle({ color: '#f59e0b' });+ });++ it('re-reads an open tooltip from the current series when history updates', () => {+ const series = (inbound: number) => [+ {+ id: 'netin',+ label: 'In',+ color: '#10b981',+ points: [+ { timestamp: 1_000, value: 10 },+ { timestamp: 2_000, value: inbound },+ { timestamp: 3_000, value: 30 },+ ],+ },+ ];+ const [current, setCurrent] = createSignal(series(20));+ render(() => (+ <MetricMiniSparkline+ title="Network history"+ unit="B/s"+ formatValue={(value) => `${value} B/s`}+ series={current()}+ />+ ));++ const svg = screen.getByTestId('metric-mini-sparkline').querySelector('svg') as SVGSVGElement;+ svg.getBoundingClientRect = () =>+ ({+ bottom: 38,+ height: 18,+ left: 0,+ right: 96,+ top: 20,+ width: 96,+ x: 0,+ y: 20,+ toJSON: () => ({}),+ }) as DOMRect;+ fireEvent.mouseMove(svg, { clientX: 48, clientY: 24 });+ expect(screen.getByText('20 B/s')).toBeInTheDocument();++ setCurrent(series(25));++ expect(screen.queryByText('20 B/s')).not.toBeInTheDocument();+ expect(screen.getByText('25 B/s')).toBeInTheDocument();+ });});diff --git a/frontend-modern/src/components/Workloads/__tests__/workloadMetricHistoryModel.test.ts b/frontend-modern/src/components/Workloads/__tests__/workloadMetricHistoryModel.test.tsindex 9814659315..4a1bfe826b 100644--- a/frontend-modern/src/components/Workloads/__tests__/workloadMetricHistoryModel.test.ts+++ b/frontend-modern/src/components/Workloads/__tests__/workloadMetricHistoryModel.test.ts@@ -13,6 +13,7 @@ import {getNodeChartKeyCandidates,getWorkloadChartKeyCandidates,isWorkloadTableMetricHistoryRange,+ MIN_RATE_SCALE_CEILING,normalizeWorkloadChartKey,WORKLOAD_TABLE_HISTORY_DEFAULT_RANGE,WORKLOAD_TABLE_HISTORY_MAX_POINTS,@@ -191,6 +192,37 @@ describe('workloadMetricHistoryModel', () => {expect(scale).toEqual({ minValue: 0, maxValue: 100 });});+ it('keeps idle I/O chatter near the axis instead of drawing it as a full-height spike', () => {+ const rateSeries = (inbound: number[], outbound: number[]) => [+ {+ id: 'netin',+ label: 'In',+ color: '#10b981',+ points: inbound.map((value, index) => ({ timestamp: index + 1, value })),+ },+ {+ id: 'netout',+ label: 'Out',+ color: '#fb923c',+ points: outbound.map((value, index) => ({ timestamp: index + 1, value })),+ },+ ];++ const idle = rateSeries([2 * 1024, 6 * 1024, 3 * 1024], [1024, 1536, 1024]);+ const idleScale = getMetricMiniSparklineScale(idle, 'B/s');+ expect(idleScale).toEqual({ minValue: 0, maxValue: MIN_RATE_SCALE_CEILING });+ // The 6 KB/s blip stays within a pixel of the axis rule at y=16 instead of reaching the top.+ expect(buildMetricMiniSparklinePath(idle[0].points, idleScale)).toBe(+ 'M1.00,15.72 L48.00,15.16 L95.00,15.58',+ );++ const busy = rateSeries([400 * 1024 ** 2, 500 * 1024 ** 2], [1024, 2048]);+ expect(getMetricMiniSparklineScale(busy, 'B/s')).toEqual({+ minValue: 0,+ maxValue: 500 * 1024 ** 2 * 1.15,+ });+ });+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.tsindex d2fa35b55a..054a51971b 100644--- a/frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts+++ b/frontend-modern/src/components/Workloads/workloadMetricHistoryModel.ts@@ -80,8 +80,36 @@ export const WORKLOAD_TABLE_HISTORY_DEFAULT_RANGE: WorkloadTableMetricHistoryRan// when an operator changes range on a large estate.export const WORKLOAD_TABLE_HISTORY_MAX_POINTS = 36;export const MIN_PERCENT_SCALE_CEILING = 5;+// Rate sparklines scale to their own peak, so without a floor a guest moving+// between 2 KB/s and 6 KB/s draws the same full-height spike as one hitting+// 500 MB/s. Background chatter stays near the axis below this ceiling.+export const MIN_RATE_SCALE_CEILING = 100 * 1024;export const WORKLOAD_TABLE_HISTORY_POLL_MS = 30_000;+export type WorkloadRateMetric = Extract<WorkloadTableMetric, 'netIo' | 'diskIo'>;++export interface WorkloadRateMetricGlyph {+ glyph: string;+ color: string;+ mono: boolean;+}++// The glyphs the rate cells already use at rest, coloured like the series they+// label, so a compact value pair beside a chart also serves as its legend.+export const WORKLOAD_RATE_METRIC_GLYPHS: Record<+ WorkloadRateMetric,+ readonly [WorkloadRateMetricGlyph, WorkloadRateMetricGlyph]+> = {+ netIo: [+ { glyph: '↓', color: NET_IN_COLOR, mono: false },+ { glyph: '↑', color: NET_OUT_COLOR, mono: false },+ ],+ diskIo: [+ { glyph: 'R', color: DISK_READ_COLOR, mono: true },+ { glyph: 'W', color: DISK_WRITE_COLOR, mono: true },+ ],+};+export const WORKLOAD_TABLE_HISTORY_INFRA_METRICS = ['cpu','memory',@@ -324,6 +352,13 @@ export const getMetricMiniSparklineScale = (};}+ if (unit === 'B/s') {+ return {+ minValue: 0,+ maxValue: Math.max(MIN_RATE_SCALE_CEILING, maxValue * 1.15),+ };+ }+return {minValue: 0,maxValue: Math.max(1, maxValue * 1.15),diff --git a/frontend-modern/src/utils/__tests__/format.test.ts b/frontend-modern/src/utils/__tests__/format.test.tsindex 417c38b56e..944ccdc882 100644--- a/frontend-modern/src/utils/__tests__/format.test.ts+++ b/frontend-modern/src/utils/__tests__/format.test.ts@@ -5,6 +5,7 @@ import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest';import {formatBytes,formatSpeed,+ formatCompactSpeed,formatObservedSpeed,formatPercent,formatCpuPercent,@@ -69,6 +70,26 @@ describe('formatSpeed', () => {});});+describe('formatCompactSpeed', () => {+ it.each([+ [0, '0'],+ [-1024, '0'],+ [Number.NaN, '0'],+ [512, '<1K'],+ [1024, '1.0K'],+ [3.32 * 1024 * 1024, '3.3M'],+ [9.94 * 1024, '9.9K'],+ [9.96 * 1024, '10K'],+ [512 * 1024, '512K'],+ [1023.6 * 1024, '1.0M'],+ [2.5 * 1024 ** 3, '2.5G'],+ [2 ** 64, '16E'],+ [Number.MAX_VALUE, '>1023E'],+ ])('formats %s B/s as %s', (value, expected) => {+ expect(formatCompactSpeed(value)).toBe(expected);+ });+});+describe('formatCpuPercent', () => {it.each([[0, '0%'],diff --git a/frontend-modern/src/utils/format.ts b/frontend-modern/src/utils/format.tsindex b6f3ba94ec..0abbaf3b8c 100644--- a/frontend-modern/src/utils/format.ts+++ b/frontend-modern/src/utils/format.ts@@ -67,6 +67,35 @@ export function formatSpeed(bytesPerSecond: number, decimals: number | 'auto' =return `${formatBytes(bytesPerSecond, decimals)}/s`;}+const COMPACT_SPEED_UNITS = ['K', 'M', 'G', 'T', 'P', 'E'];++/**+ * Transfer rate for a dense cell that shares its width with a chart: binary+ * unit letter, no "/s", one decimal below 10 ("3.3M", "512K"). Sub-kilobyte+ * rates read "<1K" so idle chatter is not dressed up as a measurement.+ */+export function formatCompactSpeed(bytesPerSecond: number): string {+ if (!Number.isFinite(bytesPerSecond) || bytesPerSecond <= 0) return '0';+ if (bytesPerSecond < 1024) return '<1K';++ let value = bytesPerSecond / 1024;+ let unit = 0;+ while (value >= 1024 && unit < COMPACT_SPEED_UNITS.length - 1) {+ value /= 1024;+ unit += 1;+ }+ // Exabytes per second is already a wrapped counter, not a measurement; keep+ // anything beyond it to the slot's width rather than printing an exponent.+ if (unit === COMPACT_SPEED_UNITS.length - 1 && value >= 1023.5) return '>1023E';+ if (value < 9.95) return `${value.toFixed(1)}${COMPACT_SPEED_UNITS[unit]}`;++ const rounded = Math.round(value);+ if (rounded >= 1024 && unit < COMPACT_SPEED_UNITS.length - 1) {+ return `1.0${COMPACT_SPEED_UNITS[unit + 1]}`;+ }+ return `${rounded}${COMPACT_SPEED_UNITS[unit]}`;+}+export function formatObservedSpeed(bytesPerSecond: number | null | undefined): string {return typeof bytesPerSecond === 'number' &&Number.isFinite(bytesPerSecond) &&