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 drawer history on Overview and drop the History tab
rcourtman070d0a36fbe6
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 6cb28ef5ce..7fdec8974e 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -268,13 +268,13 @@ writes, guest liveness, service restoration or reporter recovery.### Node drawer CPU temperature reads the backend reading-The node drawer's CPU temperature trend card, its Summary temperature row and+The node drawer's Thermals chart reading, its Summary temperature row and`getNodeDrawerCurrentMetrics` read `Node.cpuTemperature`, the backend's-primary CPU reading, which the history line beneath the card records under the-same rule. `getCpuTemperature` (a frontend maximum over package, CPU maximum-and cores) is removed from `utils/temperature.ts`; no drawer may rebuild a-headline from `temperature` details. Proof: `NodeDrawer.test.tsx` (the card-shows the backend value while the details hold a hotter core) and the+primary CPU reading, which the chart's stored line records under the same+rule. `getCpuTemperature` (a frontend maximum over package, CPU maximum and+cores) is removed from `utils/temperature.ts`; no drawer may rebuild a reading+from `temperature` details. Proof: `NodeDrawer.test.tsx` (the chart's live+fallback shows the backend value while the details hold a hotter core) and the`nodeDrawerModel` branch tests.### Drawer attention detail line and temperature alert floor — issue #2068@@ -5456,31 +5456,41 @@ The Proxmox guest and node drawers (`GuestDrawerOverview.tsx`,2026-10-13 (demand ledger "Drawer Overview leads with attention and trends",a named bet): a grid of equal-weight inventory cards buried the drawer's job.Their Overview leads with active alerts (or one "No active alerts" line), then-24h trend cards for the metrics the row shows, which add the time dimension-the row lacks rather than restating it. Any warning- or danger-toned detail row+the resource's history charts (`GuestDrawerHistory`, lazy-loaded) opening on+24 hours with the range picker beside them. These drawers have no History tab:+by maintainer decision on 2026-10-13 the tab was removed because it repeated+Overview's charts at another range in another style. The charts poll only+while Overview shows, and before any history is stored they show the live+reading, qualified "current" or "last known". An active alert on a charted+metric tones that reading and, when it carries a numeric trigger, draws it as+a dashed line in its severity colour; `getDrawerChartAlerts` maps alert types+to chart metrics and converts I/O triggers from the alert engine's MiB/s to+the charts' bytes per second. Any+warning- or danger-toned detail rowis lifted into a "Worth checking" section in front, whichever section owns it,so demotion never hides a reason a reading cannot be trusted. Guestfilesystems, physical disks, RAID, node GPU and NVMe sensor readings (whichcarry no heat tone of their own), and any availability check that is not bothhealthy and fresh stay visible; "availability checks passing" is said only of-fresh healthy evidence. Trend cards withhold the live value of an offline or-stale node, and a guest's withdrawn memory reading shows no bytes either.-A node card is coloured only by the node's own alerts, which+fresh healthy evidence. An offline or stale node says so in one line above+its charts, which then take no live fallback reading, and a guest's withdrawn+memory reading shows no memory size either.+A node chart draws alert lines only for the node's own alerts, which`ProxmoxNodesTable.tsx` passes as `ownAlerts` by identity match; the drawer's`alerts` list also carries its guests' alerts through the node-name match. A-one-line facts strip carries OS, address, a healthy last completed backup and-tags. The complete inventory sits in a closed "Details"+one-line facts strip carries OS, the amounts the charts' percentages are of+(guest vCPUs and used-of-total RAM and disk; node CPUs and used-of-total RAM+and root disk, capacity only while its readings are withheld), address, a+healthy last completed backup and tags. The complete inventory sits in a closed "Details"`TechnicalDetailsDisclosure` with `keepMounted`, so its rows stay in thedocument for find-in-page and tests while hidden. Other drawers keep the ruleabove until that bet is graded. "Worth checking" renders through-`DrawerExceptionList.tsx` directly under the alerts line, above the trend-cards: one compact label/value line per lifted row with the shared-`detailValueToneClass` tone, not a card per section. Each trend card marks its-headline value "now" and states its range as "24h low–high", so the live-number is not read as the last point of the stored line. A guest memory reading-from a cache-inclusive source says "may include cache" on the Memory card-itself; the full note (why, and what to do) is the Details row "About this-reading" and appears once. `DetailSectionTable` keeps the single bordered table at narrow widths+`DrawerExceptionList.tsx` directly under the alerts line, above the charts:+one compact label/value line per lifted row with the shared+`detailValueToneClass` tone, not a card per section. A guest memory reading+from a cache-inclusive source says "may include cache" beside its RAM amount+in the facts strip; the full note (why, and what to do) is the Details row+"About this reading" and appears once. `DetailSectionTable` keeps the single bordered table at narrow widthswhere density matters, then presents those same canonical rows as boundedsection cards on desktop. Desktop cards share the available row width, stretchto the same row height, and use stable three- or four-column tracks. Andiff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 1356efe7dc..e3cfaef27d 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -2892,16 +2892,16 @@ local bar geometry, or render a bar for the negative unknown-usage sentinel.`GuestDrawerOverview.tsx` renders the `Filesystems` section on its own, infront of the collapsed Details, so the mount-point list never shares a cardrow with shorter sections; tags render as chips in the Overview facts strip-rather than as a `Tags` detail section. The Overview's 24h trend cards-(`DrawerTrendCards.tsx`, lazy-loaded out of the WorkloadsSurface chunk) and-the History tab read one query from `guestDrawerHistoryQuery.ts` with one cache-key, and each mounts only while its tab is visible: the node drawer's History-no longer stays mounted and polling while hidden. Because those cards already-cover the last 24 hours, the guest and node drawers open History on-`TRENDED_DRAWER_HISTORY_DEFAULT_RANGE` (7 days, within the free plan's-retention) rather than repeating them; a 24h History selection reuses the-cards' cached read. Drawers without trend cards (Docker host, resource-detail) keep the 24h `GUEST_DRAWER_HISTORY_DEFAULT_RANGE`.+rather than as a `Tags` detail section. The guest and node drawers chart+history on Overview itself: `GuestDrawerOverview.tsx` and+`NodeDrawerOverview.tsx` lazy-load `GuestDrawerHistory` out of the+WorkloadsSurface chunk, open it on the 24h `GUEST_DRAWER_HISTORY_DEFAULT_RANGE`+and pass `enabled={false}` while Manage shows, so one query from+`guestDrawerHistoryQuery.ts` polls only while the charts are visible. These+drawers have no History tab, so there is no second read of the same resource+at another range (the deleted `DrawerTrendCards.tsx` and the History tab each+held one). Docker host and resource-detail drawers keep their History tab on+the same 24h default.Panel width alone does not make mount paths readable. Filesystem disk rows mustopt into the shared `layout: 'stacked'` presentation so their full mount pathwraps above usage and progress at desktop and phone widths. Shared-prefix paths@@ -4012,8 +4012,9 @@ Round dot markers (zero-length round-capped strokes) and the in-placenode per observation beyond the marker's two paths, and the readout no longerinserts or removes a line as the inspected time changes.Numeric gridline labels are computed from the scale the panel already holds;-the compact "Worth checking" list and the trend cards' "now" and "24h low–high"-labels reuse rows and ranges already derived. None adds a read or timer.+the compact "Worth checking" list reuses rows already derived, and an alert's+dashed trigger line reuses the alert the drawer already holds. None adds a read+or timer.The default stored-history legend resolves one latest timestamp from thatsame bounded, normalized panel index, then looks up each configured series atdiff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 2deb90320c..f860737813 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -150,17 +150,17 @@ the shared live-status copy to `TemperatureGauge`. Other node alerts neverrecolour the cell. The Mail Gateway drawer formats its attention rows through`getAlertAttentionCopy`.-### Proxmox node drawer trend cards follow the node's own alerts+### Proxmox node drawer charts follow the node's own alerts`ProxmoxNodesTable` passes `NodeDrawer` two lists. `alerts` keeps thenode-name match, so Needs attention also lists the node's guests. `ownAlerts`is the same `hostOverrideIdCandidates` identity match without the name, and-only it colours the drawer's CPU, memory, temperature and disk trend cards and-draws their triggers. Node alerts are keyed on the cluster-qualified id (for+only it draws dashed alert triggers on the drawer's Overview charts and tones+their readings. Node alerts are keyed on the cluster-qualified id (forexample `homelab-delly2`), which the drawer's own node record does not carry,so the drawer must not rebuild this match itself. `NodeDrawer.test.tsx` covers-a guest alert that leaves the card plain and a table-supplied node alert that-colours it.+a guest alert that draws no line and a table-supplied node alert that draws+one.### Canonical Discovery honours VM guest-read deferralsdiff --git a/frontend-modern/browser-verification/a8482c4564c3571d.json b/frontend-modern/browser-verification/a8482c4564c3571d.jsonnew file mode 100644index 0000000000..036e9c639e--- /dev/null+++ b/frontend-modern/browser-verification/a8482c4564c3571d.json@@ -0,0 +1,58 @@+{+ "version": 1,+ "base_sha": "72d25e4925136d4825cfde7bffbcda0dfa3cab45",+ "verified_at": "2026-10-13T21:16:00Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/components/Workloads/DrawerTrendCards.tsx",+ "frontend-modern/src/components/Workloads/GuestDrawer.tsx",+ "frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx",+ "frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx",+ "frontend-modern/src/components/Workloads/NodeDrawer.tsx",+ "frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx",+ "frontend-modern/src/components/Workloads/drawerOverviewModel.ts",+ "frontend-modern/src/components/Workloads/guestDrawerModel.ts",+ "frontend-modern/src/components/Workloads/useGuestDrawerState.ts"+ ],+ "content_sha256": {+ "frontend-modern/src/components/Workloads/DrawerTrendCards.tsx": "deleted",+ "frontend-modern/src/components/Workloads/GuestDrawer.tsx": "432877652921fa2bbb88ea93cba0ee3595f8bc86e44432df97c81ac216e55f7c",+ "frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx": "680cdaf8d6de2b6f2b5e2041c42727a3bbe7b87877da2ebcdeded1788e8fd711",+ "frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx": "06b7ea42bfbebf968fd71c431151d92176a8d78a9efce2d89d5ced118328a71a",+ "frontend-modern/src/components/Workloads/NodeDrawer.tsx": "f7e8b8681a4ef8e746a59712cda37d8a944b9ad77c2082f8e8aebd7f3b619fb1",+ "frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx": "ce84229c3dae971af99db270dd4e6a066d2c14cbf30abf82d31eb307af433529",+ "frontend-modern/src/components/Workloads/drawerOverviewModel.ts": "925431410bff547760decdd86b1b6c44dba39bff22e044178d9812019441b132",+ "frontend-modern/src/components/Workloads/guestDrawerModel.ts": "caf6936ece406d824aa6261d9d5715dc12f4bfcfeee07ee0638cce095717011a",+ "frontend-modern/src/components/Workloads/useGuestDrawerState.ts": "ee91b7576c75303d5a920e6ac792a9c57ac021e86c218b28e10142f9c8abbec3"+ },+ "routes": [+ "/proxmox/overview"+ ],+ "viewports": [+ {+ "width": 1440,+ "height": 900+ },+ {+ "width": 1000,+ "height": 900+ },+ {+ "width": 390,+ "height": 844+ }+ ],+ "states": [+ "final built bytes of this tree (origin/main 72d25e4925 plus this change) embedded in a darwin binary, mock mode with 7 days of seeded metrics, headless Chromium on pulse-dev through a reverse tunnel, full-resolution element screenshots read by eye at each viewport",+ "guest drawer (artifact-cache-310): tabs read Overview, Manage with no History tab; Overview shows No active alerts, Worth checking (21d-old backup), then Utilization, Network I/O and Disk I/O charts at 24 hours with continuous lines, numeric gridline labels and the range picker plus Refresh history above them, then a facts strip reading \"2 vCPU\", \"401 MB of 853 MB RAM (may include cache)\", \"2.87 GB of 10.0 GB disk\" and tag chips, then the closed Details",+ "node drawer (Analytics A): tabs read Overview, Manage; Utilization, Network I/O, Disk I/O and Thermals charts at 24 hours, Thermals reading CPU 44°C, facts strip with \"36.9 GB of 88.0 GB RAM\" and \"637 GB of 1.29 TB root disk\"",+ "1440px: guest charts in three columns, node charts in four (the Utilization legend wraps to two lines at that width); 1000px: charts in two columns (node 2x2); 390px phone: charts stack in one column under the toolbar, no horizontal overflow",+ "no Proxmox guest or node in the mock estate carried an active cpu/memory/disk/temperature alert, so the dashed alert line and toned reading were not seen in the browser; they are covered by NodeDrawer.test.tsx and drawerOverviewModel.test.ts only"+ ],+ "interactions": [+ "expanded the first guest row and the first node row by their expand buttons",+ "moved the mouse over the middle of the guest Utilization plot: the dashed crosshair and round markers appeared and the header read \"Stored · 09:03 AM\" with that time's CPU, Memory and Disk values; moving away restored \"Latest stored\"",+ "changed the guest range picker from 24 hours to 7 days: the three charts redrew over Oct 6 to Oct 13 with continuous lines",+ "read the tab list of both drawers at each viewport (Overview, Manage)"+ ]+}diff --git a/frontend-modern/src/components/Workloads/DrawerTrendCards.tsx b/frontend-modern/src/components/Workloads/DrawerTrendCards.tsxdeleted file mode 100644index 033a2e1046..0000000000--- a/frontend-modern/src/components/Workloads/DrawerTrendCards.tsx+++ /dev/null@@ -1,285 +0,0 @@-import { For, Show, createMemo, type Component } from 'solid-js';--import type { AggregatedMetricPoint } from '@/api/charts';-import { formatHistoryChartTooltipValue } from '@/components/shared/historyChartModel';--import {- DRAWER_TREND_RANGE,- getGuestDrawerHistoryScale,- normalizeGuestDrawerHistoryPoints,- type GuestDrawerHistoryDeferredMetric,- type GuestDrawerHistoryTarget,-} from './guestDrawerModel';-import {- createGuestDrawerHistoryQuery,- createGuestDrawerHistorySource,-} from './guestDrawerHistoryQuery';--export interface DrawerTrendCardConfig {- /** Metrics-store key, shared with the History tab's series. */- metric: string;- label: string;- unit: '%' | 'C';- color: string;- /** Live reading; a current value is never drawn as a trend point. */- current?: number;- /** Set when the live reading is not current, e.g. during a backup. */- deferred?: GuestDrawerHistoryDeferredMetric;- /** Short secondary fact, e.g. "3.42 of 4.00 GB". */- detail?: string;- /** Severity of an active alert on this metric. */- alertSeverity?: 'warning' | 'critical';- /** The active alert's trigger, drawn as a dashed line. */- alertThreshold?: number;-}--interface DrawerTrendCardsProps {- target: GuestDrawerHistoryTarget | null;- /** False while another drawer tab is showing, so hidden cards do not poll. */- enabled: boolean;- cards: DrawerTrendCardConfig[];-}--const PLOT_WIDTH = 240;-const PLOT_HEIGHT = 48;--const formatValue = (value: number, unit: string): string =>- formatHistoryChartTooltipValue(value, unit);--const buildPath = (- points: readonly AggregatedMetricPoint[],- scale: { minValue: number; maxValue: number },- startTime: number,- endTime: number,-): string => {- if (points.length < 2) return '';- const timeSpan = Math.max(1, endTime - startTime);- const valueSpan = Math.max(1, scale.maxValue - scale.minValue);- return points- .map((point, index) => {- const x = ((point.timestamp - startTime) / timeSpan) * PLOT_WIDTH;- const bounded = Math.min(Math.max(point.value, scale.minValue), scale.maxValue);- const y = (1 - (bounded - scale.minValue) / valueSpan) * PLOT_HEIGHT;- return `${index === 0 ? 'M' : 'L'}${x.toFixed(1)},${y.toFixed(1)}`;- })- .join(' ');-};--const thresholdY = (value: number, scale: { minValue: number; maxValue: number }): number => {- const valueSpan = Math.max(1, scale.maxValue - scale.minValue);- const bounded = Math.min(Math.max(value, scale.minValue), scale.maxValue);- return (1 - (bounded - scale.minValue) / valueSpan) * PLOT_HEIGHT;-};--const cardBorderClass = (severity: DrawerTrendCardConfig['alertSeverity']): string => {- if (severity === 'critical') return 'border-red-400 dark:border-red-700';- if (severity === 'warning') return 'border-amber-400 dark:border-amber-600';- return 'border-border';-};--const valueToneClass = (severity: DrawerTrendCardConfig['alertSeverity']): string => {- if (severity === 'critical') return 'text-red-700 dark:text-red-300';- if (severity === 'warning') return 'text-amber-700 dark:text-amber-300';- return 'text-base-content';-};--// The drawer Overview's 24h trend for the metrics its table row shows. It reads-// the same query as the History tab, so a trend here and the History tab's 24h-// chart are one observation set.-const DrawerTrendCards: Component<DrawerTrendCardsProps> = (props) => {- const source = createGuestDrawerHistorySource(- () => props.target,- () => DRAWER_TREND_RANGE,- () => props.enabled,- );- const query = createGuestDrawerHistoryQuery(source);- const metrics = createMemo(() => query.value().metrics ?? {});- const historyWindow = createMemo(() => {- const value = query.value();- return value.end > value.start ? { start: value.start, end: value.end } : null;- });-- return (- <Show when={props.target && props.cards.length > 0}>- <ul- data-testid="drawer-trend-cards"- aria-label="Last 24 hours"- class={`grid gap-2 sm:grid-cols-2 ${props.cards.length > 3 ? 'xl:grid-cols-4' : 'xl:grid-cols-3'}`}- >- <For each={props.cards}>- {(card) => {- const points = createMemo(() =>- normalizeGuestDrawerHistoryPoints(metrics()[card.metric], card.unit),- );- // An alert trigger outside the observed range widens the scale,- // so the dashed line sits at its real value, not clamped to an edge.- const scale = createMemo(() =>- getGuestDrawerHistoryScale(- [- { points: points() },- ...(typeof card.alertThreshold === 'number' && points().length > 0- ? [- {- points: [- {- timestamp: points()[0].timestamp,- value: card.alertThreshold,- min: card.alertThreshold,- max: card.alertThreshold,- },- ],- },- ]- : []),- ],- card.unit,- ),- );- const bounds = createMemo(() => {- const list = points();- const w = historyWindow();- const first = list[0]?.timestamp;- const last = list[list.length - 1]?.timestamp;- if (first === undefined || last === undefined) return null;- return {- start: Math.min(w?.start ?? first, first),- end: Math.max(w?.end ?? last, last),- };- });- const path = createMemo(() => {- const b = bounds();- return b ? buildPath(points(), scale(), b.start, b.end) : '';- });- const range = createMemo(() => {- const list = points();- if (list.length === 0) return null;- let low = Infinity;- let high = -Infinity;- // Buckets carry their own extremes; a spike inside an averaged- // bucket must still widen the stated range.- for (const point of list) {- low = Math.min(low, point.min ?? point.value);- high = Math.max(high, point.max ?? point.value);- }- return { low, high };- });- const displayValue = createMemo(() => {- if (typeof card.current === 'number') return formatValue(card.current, card.unit);- if (card.deferred && typeof card.deferred.lastKnownValue === 'number') {- return formatValue(card.deferred.lastKnownValue, card.unit);- }- return '—';- });- const valueQualifier = () => {- // Name the big number's time, so it is not read as the last point- // of the 24h line (stored history can trail the live reading).- if (typeof card.current === 'number') return 'now';- if (card.deferred?.valueLabel) return card.deferred.valueLabel;- if (card.deferred && typeof card.deferred.lastKnownValue === 'number') {- return 'last known';- }- return card.deferred ? 'not current' : '';- };- const rangeLabel = () => {- const r = range();- if (!r) return null;- if (points().length === 1) return '24h: one reading so far';- const low = formatValue(r.low, card.unit);- const high = formatValue(r.high, card.unit);- return low === high ? `24h: steady at ${low}` : `24h low–high: ${low}–${high}`;- };- const ariaLabel = () => {- const r = range();- const trend = r- ? `, ${formatValue(r.low, card.unit)} to ${formatValue(r.high, card.unit)} over 24 hours`- : '';- const qualifier = valueQualifier() ? `${valueQualifier()} ` : '';- return `${card.label} ${qualifier}${displayValue()}${trend}`;- };- return (- <li- data-testid={`drawer-trend-card-${card.metric}`}- class={`flex min-w-0 flex-col gap-1.5 rounded-md border bg-surface px-3 py-2.5 ${cardBorderClass(card.alertSeverity)}`}- >- <div class="flex items-baseline justify-between gap-2">- <span class="text-xs text-muted">{card.label}</span>- <span class="flex items-baseline gap-1.5">- <Show when={valueQualifier()}>- <span class="text-[10px] text-muted">{valueQualifier()}</span>- </Show>- <span- class={`text-lg font-semibold tabular-nums leading-none ${valueToneClass(card.alertSeverity)}`}- >- {displayValue()}- </span>- </span>- </div>- <Show- when={path()}- fallback={- <div class="flex h-12 items-center text-[11px] text-muted">- {query.loading() && !query.resolvedOnce()- ? 'Loading trend…'- : query.error()- ? 'Trend unavailable'- : 'Collecting history'}- </div>- }- >- <svg- class="block h-12 w-full"- viewBox={`0 0 ${PLOT_WIDTH} ${PLOT_HEIGHT}`}- preserveAspectRatio="none"- role="img"- aria-label={ariaLabel()}- >- <Show when={typeof card.alertThreshold === 'number'}>- <line- data-testid="drawer-trend-threshold"- x1="0"- x2={PLOT_WIDTH}- y1={thresholdY(card.alertThreshold!, scale())}- y2={thresholdY(card.alertThreshold!, scale())}- stroke="currentColor"- class={- card.alertSeverity === 'critical' ? 'text-red-500' : 'text-amber-500'- }- stroke-width="1"- stroke-dasharray="4 4"- vector-effect="non-scaling-stroke"- />- </Show>- <path- d={path()}- fill="none"- stroke={card.color}- stroke-width="1.5"- stroke-linejoin="round"- vector-effect="non-scaling-stroke"- />- </svg>- </Show>- <Show when={path() && query.error()}>- <p class="text-[11px] leading-snug text-amber-700 dark:text-amber-300">- Refresh failed. Showing the last loaded trend.- </p>- </Show>- <div class="flex flex-wrap justify-between gap-x-2 text-[11px] text-muted">- <span>{rangeLabel() ?? ''}</span>- <Show when={card.detail}>- <span class="tabular-nums">{card.detail}</span>- </Show>- </div>- <Show when={card.deferred?.message}>- <p class="text-[11px] leading-snug text-muted">{card.deferred!.message}</p>- </Show>- </li>- );- }}- </For>- </ul>- </Show>- );-};--export default DrawerTrendCards;diff --git a/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx b/frontend-modern/src/components/Workloads/GuestDrawer.test.tsxindex 2a547ba53c..f08af4e0e4 100644--- a/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx+++ b/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx@@ -76,6 +76,9 @@ vi.mock('@/components/shared/WebInterfaceUrlField', () => ({// After mocks, import the component under testimport { GuestDrawer } from './GuestDrawer';+// Overview loads its charts lazily; warm the module so a cold transform does+// not outlast the tests' waits.+import './GuestDrawerHistory';const render = (...args: Parameters<typeof solidRender>): ReturnType<typeof solidRender> => {const result = solidRender(...args);@@ -201,7 +204,7 @@ describe('GuestDrawer', () => {}),);render(() => <GuestDrawer guest={guest()} onClose={vi.fn()} />);- fireEvent.click(screen.getByRole('tab', { name: 'History' }));+ fireEvent.click(screen.getByRole('tab', { name: 'Overview' }));await waitFor(() => expect(chartsApiMocks.getMetricsHistory).toHaveBeenCalledTimes(1));const chart = screen.getAllByTestId('guest-history-group-chart')[0];expect(chart.querySelector('[data-history-last-known="memory"]')).toHaveTextContent(@@ -242,7 +245,7 @@ describe('GuestDrawer', () => {makeGuest({ lock: 'backup', diskStatusReason: 'prev-vm-locked' }),);render(() => <GuestDrawer guest={guest()} onClose={vi.fn()} />);- fireEvent.click(screen.getByRole('tab', { name: 'History' }));+ fireEvent.click(screen.getByRole('tab', { name: 'Overview' }));await screen.findByRole('slider', { name: 'Inspect Utilization history' });const chart = screen.getAllByTestId('guest-history-group-chart')[0];expect(chart.querySelectorAll('path[data-history-series]')).toHaveLength(1);@@ -267,7 +270,7 @@ describe('GuestDrawer', () => {expect(chartsApiMocks.getMetricsHistory.mock.calls[0][0]).toMatchObject({resourceType: 'vm',resourceId: 'inst1:node1:100',- range: '7d',+ range: '24h',maxPoints: 240,});chartsApiMocks.getMetricsHistory.mockResolvedValue({@@ -301,7 +304,7 @@ describe('GuestDrawer', () => {expect(within(precaution()).getByRole('link', { name: 'Backup safety guidance' }),).toHaveAttribute('href', '/docs/VM_DISK_MONITORING');- fireEvent.click(screen.getByRole('tab', { name: 'History' }));+ fireEvent.click(screen.getByRole('tab', { name: 'Overview' }));expect(precaution()).toBeVisible();setGuest({...guest(),@@ -351,7 +354,7 @@ describe('GuestDrawer', () => {}),);render(() => <GuestDrawer guest={guest()} onClose={vi.fn()} />);- fireEvent.click(screen.getByRole('tab', { name: 'History' }));+ fireEvent.click(screen.getByRole('tab', { name: 'Overview' }));await waitFor(() =>expect(screen.getAllByText('No stored history in this range')).toHaveLength(3),);@@ -389,7 +392,7 @@ describe('GuestDrawer', () => {expect(request).toMatchObject({resourceType: 'vm',resourceId: 'inst1:node1:100',- range: '7d',+ range: '24h',});}});@@ -415,7 +418,7 @@ describe('GuestDrawer', () => {}),);render(() => <GuestDrawer guest={guest()} onClose={vi.fn()} />);- fireEvent.click(screen.getByRole('tab', { name: 'History' }));+ fireEvent.click(screen.getByRole('tab', { name: 'Overview' }));await waitFor(() =>expect(screen.getAllByText('No stored history in this range')).toHaveLength(3),);@@ -590,10 +593,11 @@ describe('GuestDrawer', () => {// ── Tabs ──describe('tab switching', () => {- it('renders Overview and History tabs', () => {+ it('renders Overview and Manage tabs, with the charts on Overview instead of a History tab', () => {render(() => <GuestDrawer guest={makeGuestWithDiscoveryTarget()} onClose={vi.fn()} />);expect(screen.getByRole('tab', { name: 'Overview' })).toBeInTheDocument();- expect(screen.getByRole('tab', { name: 'History' })).toBeInTheDocument();+ expect(screen.getByRole('tab', { name: 'Manage' })).toBeInTheDocument();+ expect(screen.queryByRole('tab', { name: 'History' })).toBeNull();expect(screen.queryByRole('tab', { name: 'Discovery' })).toBeNull();});@@ -606,18 +610,17 @@ describe('GuestDrawer', () => {expect(panels[1]).toHaveClass('hidden');});- it('renders persistent metric charts on the History tab', async () => {+ it('renders the metric charts on the Overview tab', async () => {render(() => <GuestDrawer guest={makeGuest()} onClose={vi.fn()} />);- expect(screen.queryByTestId('guest-history-group-chart')).toBeNull();- await fireEvent.click(screen.getByText('History'));+ await fireEvent.click(screen.getByRole('tab', { name: 'Overview' }));await waitFor(() => {expect(chartsApiMocks.getMetricsHistory).toHaveBeenCalledWith(expect.objectContaining({resourceType: 'vm',resourceId: 'inst1:node1:100',- range: '7d',+ range: '24h',}),);});@@ -645,12 +648,15 @@ describe('GuestDrawer', () => {});render(() => <GuestDrawer guest={makeGuest({ cpu: 0.25 })} onClose={vi.fn()} />);- await fireEvent.click(screen.getByText('History'));- await waitFor(() => expect(chartsApiMocks.getMetricsHistory).toHaveBeenCalled());+ await fireEvent.click(screen.getByRole('tab', { name: 'Overview' }));+ await waitFor(() =>+ expect(screen.getAllByTestId('guest-history-group-chart')[0]).toHaveTextContent(+ 'No stored history in this range',+ ),+ );const utilizationChart = screen.getAllByTestId('guest-history-group-chart')[0];expect(utilizationChart).toHaveTextContent('CPU25.0%current');- expect(utilizationChart).toHaveTextContent('No stored history in this range');expect(utilizationChart.querySelector('path[data-history-series]')).toBeNull();});@@ -673,7 +679,7 @@ describe('GuestDrawer', () => {/>));- await fireEvent.click(screen.getByText('History'));+ await fireEvent.click(screen.getByRole('tab', { name: 'Overview' }));await waitFor(() => expect(chartsApiMocks.getMetricsHistory).toHaveBeenCalled());const utilizationChart = screen.getAllByTestId('guest-history-group-chart')[0];@@ -684,11 +690,11 @@ describe('GuestDrawer', () => {it('updates grouped metric header values on History chart hover', async () => {render(() => <GuestDrawer guest={makeGuest()} onClose={vi.fn()} />);- await fireEvent.click(screen.getByText('History'));+ await fireEvent.click(screen.getByRole('tab', { name: 'Overview' }));- await waitFor(() => {- expect(chartsApiMocks.getMetricsHistory).toHaveBeenCalled();- });+ await waitFor(() =>+ expect(screen.getAllByTestId('guest-history-group-chart')[0]).toHaveTextContent('40.0%'),+ );const utilizationChart = screen.getAllByTestId('guest-history-group-chart')[0];const plot = within(utilizationChart).getByTestId('guest-history-plot');plot.getBoundingClientRect = () =>@@ -735,7 +741,7 @@ describe('GuestDrawer', () => {const { container } = render(() => (<GuestDrawer guest={makeGuestWithDiscoveryTarget()} onClose={vi.fn()} />));- await fireEvent.click(screen.getByRole('tab', { name: 'History' }));+ await fireEvent.click(screen.getByRole('tab', { name: 'Manage' }));await fireEvent.click(screen.getByRole('tab', { name: 'Overview' }));const panels = container.querySelectorAll('[class*="overflow-anchor"]');expect(panels[0]).not.toHaveClass('hidden');@@ -1124,6 +1130,40 @@ describe('GuestDrawer', () => {});});+ // ── Facts strip ──++ describe('Facts strip', () => {+ it('states the amounts the chart percentages are of', () => {+ const GiB = 1024 ** 3;+ solidRender(() => (+ <GuestDrawer+ guest={makeGuest({+ cpus: 4,+ memory: { total: 4 * GiB, used: GiB, free: 3 * GiB, usage: 25 },+ disk: { total: 100 * GiB, used: 25 * GiB, free: 75 * GiB, usage: 25 },+ })}+ onClose={vi.fn()}+ />+ ));+ const facts = screen.getByTestId('guest-drawer-facts');+ expect(facts).toHaveTextContent('4 vCPU');+ expect(facts).toHaveTextContent(/1\.00 GB of 4\.00 GB RAM/);+ expect(facts).toHaveTextContent(/25\.0 GB of 100 GB disk/);+ });++ it('shows no memory amount when the memory reading is withdrawn', () => {+ solidRender(() => (+ <GuestDrawer+ guest={makeGuest({+ memory: { total: 100, used: 0, free: 100, usage: 0, usageUnavailable: true },+ })}+ onClose={vi.fn()}+ />+ ));+ expect(screen.getByTestId('guest-drawer-facts')).not.toHaveTextContent('RAM');+ });+ });+// ── Tags card ──describe('Tags card', () => {diff --git a/frontend-modern/src/components/Workloads/GuestDrawer.tsx b/frontend-modern/src/components/Workloads/GuestDrawer.tsxindex 7fb18728eb..093fc7eb3a 100644--- a/frontend-modern/src/components/Workloads/GuestDrawer.tsx+++ b/frontend-modern/src/components/Workloads/GuestDrawer.tsx@@ -3,7 +3,7 @@ import ExternalLinkIcon from 'lucide-solid/icons/external-link';import { getDrawerHeaderActionButtonClass } from '@/components/shared/buttonModel';import { DrawerSubjectHeading } from '@/components/shared/DrawerSubjectHeading';import { ObjectDrawerHeader } from '@/components/shared/ObjectDrawerHeader';-import { Subtabs, type SubtabOption } from '@/components/shared/Subtabs';+import { Subtabs } from '@/components/shared/Subtabs';import { WebInterfaceLink } from '@/components/shared/WebInterfaceLink';import { getSimpleStatusIndicator } from '@/utils/status';import {@@ -17,7 +17,6 @@ import { getCanonicalWorkloadId } from '@/utils/workloads';import { InlineNotice } from '@/components/shared/InlineNotice';import { getShippedDocUrl } from '@/utils/docsLinks';import { useGuestDrawerState } from './useGuestDrawerState';-import { GuestDrawerHistory, GuestDrawerHistoryRangeSelect } from './GuestDrawerHistory';import { GuestDrawerOverview } from './GuestDrawerOverview';import { GuestDrawerManage } from './GuestDrawerManage';@@ -105,16 +104,8 @@ const GuestDrawerContent: Component<GuestDrawerProps> = (props) => {onChange={(value) => switchTab(value as Parameters<typeof switchTab>[0])}tabs={[{ value: 'overview', label: 'Overview' },- ...(hasHistorySupport()- ? [{ value: 'history', label: 'History' } satisfies SubtabOption]- : []),{ value: 'manage', label: 'Manage' },]}- trailing={- <Show when={hasHistorySupport() && activeTab() === 'history'}>- <GuestDrawerHistoryRangeSelect range={historyRange()} onRangeChange={setHistoryRange} />- </Show>- }/>{/* Use CSS hidden instead of Show to avoid mount/unmount which causes scroll jumps.@@ -143,23 +134,14 @@ const GuestDrawerContent: Component<GuestDrawerProps> = (props) => {memoryDisplayBasis={props.memoryDisplayBasis}alerts={props.alerts}historyTarget={hasHistorySupport() ? historyTarget() : null}- trendsEnabled={activeTab() === 'overview'}+ historyRange={historyRange()}+ onHistoryRangeChange={setHistoryRange}+ historyEnabled={activeTab() === 'overview'}currentMetrics={historyCurrentMetrics()}deferredMetrics={historyDeferredMetrics()}/></div>- {hasHistorySupport() && activeTab() === 'history' && (- <div class="[overflow-anchor:none]">- <GuestDrawerHistory- target={historyTarget()}- range={historyRange()}- currentMetrics={historyCurrentMetrics()}- deferredMetrics={historyDeferredMetrics()}- />- </div>- )}-<div class={`[overflow-anchor:none] ${activeTab() === 'manage' ? '' : 'hidden'}`}><Show when={activeTab() === 'manage'}><GuestDrawerManagediff --git a/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx b/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsxindex 59b41b66e1..25caeea179 100644--- a/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx+++ b/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx@@ -43,12 +43,23 @@ import {createGuestDrawerHistorySource,} from './guestDrawerHistoryQuery';+/** An active alert on one charted metric; a numeric trigger draws a dashed line. */+export interface GuestDrawerHistoryAlert {+ severity: 'warning' | 'critical';+ value?: number;+}+interface GuestDrawerHistoryProps {currentMetrics?: Record<string, number | null | undefined>;deferredMetrics?: Record<string, GuestDrawerHistoryDeferredMetric | undefined>;groups?: GuestDrawerHistoryGroupConfig[];range: HistoryTimeRange;target: GuestDrawerHistoryTarget | null;+ /** Shows the range picker beside the charts, for hosts without a tab strip slot. */+ onRangeChange?: (range: HistoryTimeRange) => void;+ /** False while the charts are hidden (another drawer tab), so they do not poll. */+ enabled?: boolean;+ alerts?: Record<string, GuestDrawerHistoryAlert | undefined>;}interface GuestDrawerHistoryRangeSelectProps {@@ -57,6 +68,7 @@ interface GuestDrawerHistoryRangeSelectProps {}interface GuestDrawerHistoryGroupChartProps {+ alerts?: Record<string, GuestDrawerHistoryAlert | undefined>;currentMetrics?: Record<string, number | null | undefined>;deferredMetrics?: Record<string, GuestDrawerHistoryDeferredMetric | undefined>;group: GuestDrawerHistoryGroupConfig;@@ -98,24 +110,30 @@ const formatRangeLabel = (range: HistoryTimeRange): string => {}};+// A guest and a node drawer can be open together, so each picker owns its id.export const GuestDrawerHistoryRangeSelect: Component<GuestDrawerHistoryRangeSelectProps> = (props,-) => (- <FormSelect- id="guest-history-range"- label="History range"- labelClass="sr-only"- fieldBaseClass="contents"- selectBaseClass={`${filterSelectClass} h-7 min-h-11 py-0 text-[11px] sm:min-h-0`}- data-testid="guest-history-range-control"- value={props.range}- onChange={(event) => props.onRangeChange(event.currentTarget.value as HistoryTimeRange)}- >- <For each={HISTORY_CHART_RANGES}>- {(option) => <option value={option}>{formatRangeLabel(option)}</option>}- </For>- </FormSelect>-);+) => {+ // Created once: a getter prop would mint a new id on every read, splitting+ // the label from its select.+ const id = `guest-history-range-${createUniqueId()}`;+ return (+ <FormSelect+ id={id}+ label="History range"+ labelClass="sr-only"+ fieldBaseClass="contents"+ selectBaseClass={`${filterSelectClass} h-7 min-h-11 py-0 text-[11px] sm:min-h-0`}+ data-testid="guest-history-range-control"+ value={props.range}+ onChange={(event) => props.onRangeChange(event.currentTarget.value as HistoryTimeRange)}+ >+ <For each={HISTORY_CHART_RANGES}>+ {(option) => <option value={option}>{formatRangeLabel(option)}</option>}+ </For>+ </FormSelect>+ );+};// Gridline labels state the scale's actual value at each line, so a reader// can tell a KB/s peak from a MB/s one. ("Avg" used to mark the midpoint of@@ -132,6 +150,13 @@ const getAxisLabel = (return `${Math.round(value)}`;};+const alertToneClass = (severity: GuestDrawerHistoryAlert['severity'] | undefined) =>+ severity === 'critical'+ ? 'font-semibold text-red-700 dark:text-red-300'+ : severity === 'warning'+ ? 'font-semibold text-amber-700 dark:text-amber-300'+ : '';+const clampNumber = (value: number, min: number, max: number): number =>Math.min(Math.max(value, min), max);@@ -326,7 +351,49 @@ const GuestDrawerHistoryGroupChart: Component<GuestDrawerHistoryGroupChartProps>const singleObservation = createMemo(() =>observationTimes().length === 1 ? { timestamp: observationTimes()[0] } : null,);- const scale = createMemo(() => getGuestDrawerHistoryScale(series(), props.group.unit));+ const thresholds = createMemo(() =>+ series().flatMap((item) => {+ const alert = props.alerts?.[item.metric];+ return alert && typeof alert.value === 'number' && Number.isFinite(alert.value)+ ? [{ metric: item.metric, label: item.label, severity: alert.severity, value: alert.value }]+ : [];+ }),+ );+ const alertDescription = createMemo(() =>+ series()+ .flatMap((item) => {+ const alert = props.alerts?.[item.metric];+ if (!alert) return [];+ const trigger =+ typeof alert.value === 'number' && Number.isFinite(alert.value)+ ? ` at ${formatHistoryChartTooltipValue(alert.value, item.unit)}`+ : '';+ return [`${item.label} ${alert.severity} alert${trigger}.`];+ })+ .join(' '),+ );+ // An alert trigger outside the observed range widens the scale, so the+ // dashed line sits at its real value, not clamped to an edge.+ const scale = createMemo(() =>+ getGuestDrawerHistoryScale(+ [+ ...series(),+ ...(observationTimes().length > 0+ ? thresholds().map((threshold) => ({+ points: [+ {+ timestamp: observationTimes()[0],+ value: threshold.value,+ min: threshold.value,+ max: threshold.value,+ },+ ],+ }))+ : []),+ ],+ props.group.unit,+ ),+ );const bounds = () => props.timeBounds;const hasStoredData = createMemo(() => observationTimes().length > 0 && bounds() !== null);const hoveredSeries = createMemo(() => {@@ -421,7 +488,7 @@ const GuestDrawerHistoryGroupChart: Component<GuestDrawerHistoryGroupChartProps><Show when={readoutTime()}>{(time) => (<time- class="text-[10px] font-semibold tabular-nums text-base-content"+ class="text-[10px] tabular-nums text-muted"data-testid="guest-history-hover-time"dateTime={time().dateTime}title={time().fullLabel}@@ -433,7 +500,7 @@ const GuestDrawerHistoryGroupChart: Component<GuestDrawerHistoryGroupChartProps>)}</Show></div>- <div class="flex flex-wrap justify-end gap-x-3 gap-y-1 text-[11px] text-muted">+ <div class="flex flex-wrap justify-end gap-x-3 gap-y-1 text-xs text-muted"><For each={displaySeries()}>{(item) => (<span@@ -447,7 +514,9 @@ const GuestDrawerHistoryGroupChart: Component<GuestDrawerHistoryGroupChartProps><circle cx="5" cy="5" r="4" fill={item.color} /></svg><span class="font-medium text-base-content">{item.label}</span>- <span>{item.valueLabel}</span>+ <span class={alertToneClass(props.alerts?.[item.metric]?.severity)}>+ {item.valueLabel}+ </span><Show when={item.isCurrent}><span>current</span></Show>@@ -515,6 +584,24 @@ const GuestDrawerHistoryGroupChart: Component<GuestDrawerHistoryGroupChartProps>/>)}</For>+ <For each={thresholds()}>+ {(threshold) => (+ <line+ data-history-threshold={threshold.metric}+ x1={GUEST_DRAWER_HISTORY_PLOT_LEFT}+ x2={GUEST_DRAWER_HISTORY_CHART_WIDTH - GUEST_DRAWER_HISTORY_PLOT_RIGHT}+ y1={getGuestDrawerHistoryY(threshold.value, scale())}+ y2={getGuestDrawerHistoryY(threshold.value, scale())}+ stroke="currentColor"+ class={threshold.severity === 'critical' ? 'text-red-500' : 'text-amber-500'}+ stroke-width="1"+ stroke-dasharray="4 4"+ vector-effect="non-scaling-stroke"+ >+ <title>{`${threshold.label} alert at ${formatHistoryChartTooltipValue(threshold.value, props.group.unit)}`}</title>+ </line>+ )}+ </For><Show when={bounds()}>{(rangeBounds) => (<>@@ -625,6 +712,7 @@ const GuestDrawerHistoryGroupChart: Component<GuestDrawerHistoryGroupChartProps></Show><p id={`${inspectionId}-description`} class="sr-only">{chartDescription()}+ {alertDescription() ? ` ${alertDescription()}` : ''}</p><Show when={gapMessage()}>{(message) => (@@ -699,7 +787,7 @@ export const GuestDrawerHistory: Component<GuestDrawerHistoryProps> = (props) =>const historySource = createGuestDrawerHistorySource(() => props.target,() => props.range,- () => !locked(),+ () => !locked() && props.enabled !== false,);const historyQuery = createGuestDrawerHistoryQuery(historySource);@@ -736,32 +824,29 @@ export const GuestDrawerHistory: Component<GuestDrawerHistoryProps> = (props) =>if (event.pointerType === 'mouse') setTouchInspection(false);}}>- <Show- when={!locked()}- fallback={- <div class="rounded-xs border border-border bg-surface p-5 text-sm text-muted">- {formatRangeLabel(props.range)} history requires a higher license plan. This- instance's plan retains {maxHistoryDays()} days.- </div>- }- >- <div class="flex flex-wrap items-start justify-end gap-3">- <div- class="min-w-0 flex-1"- role="status"- aria-label="History refresh status"- aria-live="polite"- aria-atomic="true"- >- <Show when={historyQuery.error()}>- <InlineNotice tone={hasHistoryPoints() ? 'warning' : 'danger'}>- {getAPIReadAccessErrorMessage(historyQuery.error()) ||- (hasHistoryPoints()- ? 'History refresh failed. Showing previously loaded history.'- : 'Failed to load history data')}- </InlineNotice>- </Show>- </div>+ <div class="flex flex-wrap items-start justify-end gap-2">+ <div+ class="min-w-0 flex-1"+ role="status"+ aria-label="History refresh status"+ aria-live="polite"+ aria-atomic="true"+ >+ <Show when={!locked() && historyQuery.error()}>+ <InlineNotice tone={hasHistoryPoints() ? 'warning' : 'danger'}>+ {getAPIReadAccessErrorMessage(historyQuery.error()) ||+ (hasHistoryPoints()+ ? 'History refresh failed. Showing previously loaded history.'+ : 'Failed to load history data')}+ </InlineNotice>+ </Show>+ </div>+ <Show when={props.onRangeChange}>+ {(onRangeChange) => (+ <GuestDrawerHistoryRangeSelect range={props.range} onRangeChange={onRangeChange()} />+ )}+ </Show>+ <Show when={!locked()}><Buttonsize="sm"class="min-h-11 shrink-0 aria-disabled:opacity-50 sm:min-h-8"@@ -778,12 +863,25 @@ export const GuestDrawerHistory: Component<GuestDrawerHistoryProps> = (props) =></Show>{historyQuery.error() ? 'Retry history' : 'Refresh history'}</Button>- </div>+ </Show>+ </div>+ <Show+ when={!locked()}+ fallback={+ <div class="rounded-xs border border-border bg-surface p-5 text-sm text-muted">+ {formatRangeLabel(props.range)} history requires a higher license plan. This+ instance's plan retains {maxHistoryDays()} days.+ </div>+ }+ ><Show when={!historyQuery.error() || hasHistoryPoints()}>- <div class={`grid gap-3 ${groups().length > 3 ? 'xl:grid-cols-4' : 'xl:grid-cols-3'}`}>+ <div+ class={`grid gap-3 md:grid-cols-2 ${groups().length > 3 ? 'xl:grid-cols-4' : 'xl:grid-cols-3'}`}+ ><For each={groups()}>{(group) => (<GuestDrawerHistoryGroupChart+ alerts={props.alerts}group={group}loading={historyQuery.loading() && !historyQuery.resolvedOnce()}metrics={metrics()}diff --git a/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx b/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsxindex 4a56820db0..7b8d8c238c 100644--- a/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx+++ b/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx@@ -25,7 +25,9 @@ import {} from '@/utils/workloadGuestPresentation';import { buildWorkloadsDiskPresentation } from './diskListModel';+import type { HistoryTimeRange } from '@/api/charts';import {+ GUEST_DRAWER_HISTORY_DEFAULT_RANGE,GUEST_DRAWER_HISTORY_GROUPS,getGuestDrawerAlertAttention,getGuestDrawerMemoryRows,@@ -38,11 +40,10 @@ import {} from './guestDrawerModel';import {collectDrawerExceptionRows,- getDrawerMetricAlert,+ getDrawerChartAlerts,isDrawerAvailabilityHealthy,withoutDrawerExceptionRows,} from './drawerOverviewModel';-import type { DrawerTrendCardConfig } from './DrawerTrendCards';import type { NestedWorkloadContext } from './nestedWorkloadContext';import { WORKLOAD_ACTION_AGENT_LABEL } from './workloadAgentReadiness';import { getWorkloadAlertResourceIdCandidates } from './workloadTopology';@@ -59,14 +60,17 @@ const GuestPhysicalDisks = lazy(() =>})),);-// The 24h trend cards read metrics history only once a drawer is open; keep-// their chart code out of the WorkloadsSurface table chunk the same way.-const DrawerTrendCards = lazy(() => import('./DrawerTrendCards'));+// The charts read metrics history only once a drawer is open; keep their code+// out of the WorkloadsSurface table chunk the same way.+const GuestDrawerHistory = lazy(() =>+ import('./GuestDrawerHistory').then(({ GuestDrawerHistory }) => ({+ default: GuestDrawerHistory,+ })),+);-const historySeriesColor = (metric: string): string =>- GUEST_DRAWER_HISTORY_GROUPS.flatMap((group) => group.series).find(- (series) => series.metric === metric,- )?.color ?? 'currentColor';+const GUEST_DRAWER_CHARTED_METRICS = GUEST_DRAWER_HISTORY_GROUPS.flatMap((group) =>+ group.series.map((series) => series.metric),+);interface GuestDrawerOverviewProps {guest: GuestDrawerProps['guest'];@@ -91,8 +95,10 @@ interface GuestDrawerOverviewProps {memoryDisplayBasis?: GuestDrawerProps['memoryDisplayBasis'];alerts?: Alert[];historyTarget?: GuestDrawerHistoryTarget | null;- /** True while Overview is the visible tab; hidden trends do not poll. */- trendsEnabled?: boolean;+ historyRange?: HistoryTimeRange;+ onHistoryRangeChange?: (range: HistoryTimeRange) => void;+ /** True while Overview is the visible tab; hidden charts do not poll. */+ historyEnabled?: boolean;currentMetrics?: Record<string, number | undefined>;deferredMetrics?: Record<string, GuestDrawerHistoryDeferredMetric | undefined>;}@@ -380,58 +386,38 @@ export function GuestDrawerOverview(props: GuestDrawerOverviewProps) {hasAvailability() &&availabilityChecks().every((check) => isDrawerAvailabilityHealthy(check, now()));- const memoryDetail = () => {+ // The amounts the charts' percentages are of. A withdrawn memory reading+ // shows no bytes either, the same decision as its percentage.+ const memoryFact = () => {const memory = props.guest.memory;- // Bytes follow the same decision as the percentage: a withdrawn reading- // shows neither, a last-known one shows both.const hasReading =typeof props.currentMetrics?.memory === 'number' ||typeof props.deferredMetrics?.memory?.lastKnownValue === 'number';if (!memory || !hasReading || memory.usageUnavailable || !((memory.total ?? 0) > 0)) {- return undefined;+ return '';}- const bytes = `${formatBytes(memory.used ?? 0)} of ${formatBytes(memory.total ?? 0)}`;- // The short qualifier sits on the number it qualifies; the full note (why,+ // The short qualifier sits on the size it qualifies; the full note (why,// and what to do) is the Details row "About this reading".- return memoryReading()?.mayIncludeCache ? `${bytes} · may include cache` : bytes;+ const size = `${formatBytes(memory.used ?? 0)} of ${formatBytes(memory.total ?? 0)} RAM`;+ return memoryReading()?.mayIncludeCache ? `${size} (may include cache)` : size;};- const diskDetail = () => {+ const diskFact = () => {const disk = props.guest.disk;if (!disk || !((disk.total ?? 0) > 0) || typeof props.currentMetrics?.disk !== 'number') {- return undefined;+ return '';}- return `${formatBytes(disk.used ?? 0)} of ${formatBytes(disk.total ?? 0)}`;- };- const trendCards = (): DrawerTrendCardConfig[] => {- const card = (metric: string, label: string, detail?: string): DrawerTrendCardConfig => {- const alert = getDrawerMetricAlert(props.alerts, metric);- return {- metric,- label,- unit: '%',- color: historySeriesColor(metric),- current: props.currentMetrics?.[metric],- deferred: props.deferredMetrics?.[metric],- detail,- alertSeverity: alert?.severity,- alertThreshold: alert?.threshold,- };- };- // With no disk reading at all, the Filesystems section below already says- // why; an empty Disk card would only repeat it.- const diskReading =- typeof props.currentMetrics?.disk === 'number' ||- typeof props.deferredMetrics?.disk?.lastKnownValue === 'number';- return [- card('cpu', 'CPU', props.guest.cpus ? `${props.guest.cpus} vCPU` : undefined),- card('memory', 'Memory', memoryDetail()),- ...(diskReading ? [card('disk', 'Disk', diskDetail())] : []),- ];+ return `${formatBytes(disk.used ?? 0)} of ${formatBytes(disk.total ?? 0)} disk`;};+ const chartAlerts = createMemo(() =>+ getDrawerChartAlerts(props.alerts, GUEST_DRAWER_CHARTED_METRICS),+ );const facts = () =>[props.hasOsInfo ? props.guestOsSummary : '',+ props.guest.cpus ? `${props.guest.cpus} vCPU` : '',+ memoryFact(),+ diskFact(),props.ipAddresses[0] ?? '',// A late or missing backup is listed under Worth checking instead.protectionPresentation().tone === 'success'@@ -472,11 +458,15 @@ export function GuestDrawerOverview(props: GuestDrawerOverviewProps) {<DrawerExceptionList testId="guest-drawer-exceptions" rows={exceptionRows()} /><Show when={props.historyTarget}>- <Suspense fallback={<div class="h-28" aria-hidden="true" />}>- <DrawerTrendCards+ <Suspense fallback={<div class="h-48" aria-hidden="true" />}>+ <GuestDrawerHistorytarget={props.historyTarget ?? null}- enabled={props.trendsEnabled ?? true}- cards={trendCards()}+ range={props.historyRange ?? GUEST_DRAWER_HISTORY_DEFAULT_RANGE}+ onRangeChange={props.onHistoryRangeChange}+ enabled={props.historyEnabled ?? true}+ currentMetrics={props.currentMetrics}+ deferredMetrics={props.deferredMetrics}+ alerts={chartAlerts()}/></Suspense></Show>diff --git a/frontend-modern/src/components/Workloads/NodeDrawer.test.tsx b/frontend-modern/src/components/Workloads/NodeDrawer.test.tsxindex 14aa39ee19..1079d3848b 100644--- a/frontend-modern/src/components/Workloads/NodeDrawer.test.tsx+++ b/frontend-modern/src/components/Workloads/NodeDrawer.test.tsx@@ -25,6 +25,9 @@ vi.mock('@/stores/license', () => ({}));import { NodeDrawer } from './NodeDrawer';+// Overview loads its charts lazily; warm the module so a cold transform does+// not outlast the tests' waits.+import './GuestDrawerHistory';// Details is closed by default; a warning row is lifted out of it into// Worth checking, so read the whole Overview with Details open.@@ -152,7 +155,7 @@ describe('NodeDrawer', () => {const technical = openTechnicalDetails();expect(screen.getByText('Overview')).toBeInTheDocument();- expect(screen.getByText('History')).toBeInTheDocument();+ expect(screen.queryByRole('tab', { name: 'History' })).toBeNull();expect(screen.getByText('Manage')).toBeInTheDocument();expect(technical.queryByText('System')).toBeNull();expect(technical.getAllByText('Platform').length).toBeGreaterThan(0);@@ -319,13 +322,12 @@ describe('NodeDrawer', () => {})}/>));- await fireEvent.click(screen.getByText('History'));await waitFor(() =>expect(chartsApiMocks.getMetricsHistory).toHaveBeenCalledWith(expect.objectContaining({resourceType: 'node',resourceId: 'cluster-pve-native',- range: '7d',+ range: '24h',}),),);@@ -345,14 +347,12 @@ describe('NodeDrawer', () => {/>));- await fireEvent.click(screen.getByText('History'));-await waitFor(() => {expect(chartsApiMocks.getMetricsHistory).toHaveBeenCalledWith(expect.objectContaining({resourceType: 'node',resourceId: 'homelab-pve-node-1',- range: '7d',+ range: '24h',}),);});@@ -374,14 +374,12 @@ describe('NodeDrawer', () => {it('keeps agent history and disk throughput when a Unified Agent is linked', async () => {render(() => <NodeDrawer node={makeNode({ linkedAgentId: 'agent:pve-node-1' })} />);- await fireEvent.click(screen.getByText('History'));-await waitFor(() => {expect(chartsApiMocks.getMetricsHistory).toHaveBeenCalledWith(expect.objectContaining({resourceType: 'agent',resourceId: 'pve-node-1',- range: '7d',+ range: '24h',}),);});@@ -396,8 +394,23 @@ describe('NodeDrawer', () => {});});-describe('NodeDrawer Overview trends', () => {- it('lists Worth checking as one line under the alerts line, above the trend cards', async () => {+const EMPTY_HISTORY = {+ resourceType: 'agent',+ resourceId: 'pve-node-1',+ range: '24h',+ start: 1,+ end: 3,+ metrics: {},+ source: 'store',+};++const utilizationChart = async () =>+ (await screen.findAllByTestId('guest-history-group-chart')).find(+ (chart) => chart.dataset.historyGroup === 'utilization',+ )!;++describe('NodeDrawer Overview charts', () => {+ it('lists Worth checking as one line under the alerts line, above the charts', async () => {render(() => (<NodeDrawernode={makeNode({@@ -406,10 +419,10 @@ describe('NodeDrawer Overview trends', () => {})}/>));- const cpu = await screen.findByTestId('drawer-trend-card-cpu');+ const chart = await utilizationChart();const worth = screen.getByTestId('node-drawer-exceptions');expect(- worth.compareDocumentPosition(cpu) & window.Node.DOCUMENT_POSITION_FOLLOWING,+ worth.compareDocumentPosition(chart) & window.Node.DOCUMENT_POSITION_FOLLOWING,).toBeTruthy();const row = within(worth).getByText('Updates').closest('tr')!;expect(row).toHaveTextContent('Unavailable · Proxmox source unavailable');@@ -428,29 +441,32 @@ describe('NodeDrawer Overview trends', () => {threshold: 85,});- it("marks a trend card only for the node's own alert, not a guest's on the same node", async () => {+ it("draws an alert line only for the node's own alert, not a guest's on the same node", async () => {render(() => <NodeDrawer node={makeNode()} alerts={[guestAlert]} />);- const memory = await screen.findByTestId('drawer-trend-card-memory');+ const chart = await utilizationChart();// The guest's alert is still listed under Needs attention.expect(screen.getByText('VM memory at 85.4%')).toBeInTheDocument();- expect(memory).not.toHaveClass('border-amber-400');- expect(screen.queryByTestId('drawer-trend-threshold')).toBeNull();+ expect(chart.querySelector('[data-history-threshold]')).toBeNull();});- it("draws the node's own memory alert on its memory card", async () => {+ it("draws the node's own memory alert on the utilization chart", async () => {render(() => <NodeDrawer node={makeNode()} alerts={[makeAlert(), guestAlert]} />);- const memory = await screen.findByTestId('drawer-trend-card-memory');- expect(memory).toHaveClass('border-amber-400');- expect(await within(memory).findByTestId('drawer-trend-threshold')).toBeInTheDocument();+ const chart = await utilizationChart();+ const line = chart.querySelector('[data-history-threshold="memory"]');+ expect(line).toHaveClass('text-amber-500');+ expect(line).toHaveTextContent('Memory alert at 90.0%');});it("does not present an offline node's last readings as live", async () => {- render(() => <NodeDrawer node={makeNode({ status: 'offline' })} />);- const cpu = await screen.findByTestId('drawer-trend-card-cpu');- expect(within(cpu).getByText('not current')).toBeInTheDocument();- expect(cpu).toHaveTextContent('Node is offline. Showing its history only.');- // No used-of-total bytes beside a withheld reading.- expect(screen.getByTestId('drawer-trend-card-memory').textContent).not.toMatch(/ of /);+ chartsApiMocks.getMetricsHistory.mockResolvedValue(EMPTY_HISTORY);+ render(() => <NodeDrawer node={makeNode({ status: 'offline', cpuTemperature: 65 })} />);+ await waitFor(() => expect(chartsApiMocks.getMetricsHistory).toHaveBeenCalled());+ expect(screen.getByTestId('node-drawer-readings-withheld')).toHaveTextContent(+ 'Node is offline. Showing its history only.',+ );+ await screen.findAllByText('No stored history in this range');+ expect(document.querySelector('[data-history-current]')).toBeNull();+ expect(document.querySelector('[data-history-last-known]')).toBeNull();});it('keeps NVMe and GPU sensor readings visible rather than inside closed Details', () => {@@ -478,12 +494,12 @@ describe('NodeDrawer Overview trends', () => {threshold: 95,});render(() => <NodeDrawer node={makeNode()} alerts={[nodeAlert]} ownAlerts={[nodeAlert]} />);- const memory = await screen.findByTestId('drawer-trend-card-memory');- expect(memory).toHaveClass('border-red-400');- expect(await within(memory).findByTestId('drawer-trend-threshold')).toBeInTheDocument();+ const chart = await utilizationChart();+ expect(chart.querySelector('[data-history-threshold="memory"]')).toHaveClass('text-red-500');});it('labels retained node memory as last known instead of live', async () => {+ chartsApiMocks.getMetricsHistory.mockResolvedValue(EMPTY_HISTORY);render(() => (<NodeDrawernode={makeNode({@@ -497,24 +513,31 @@ describe('NodeDrawer Overview trends', () => {})}/>));- const memory = await screen.findByTestId('drawer-trend-card-memory');- expect(within(memory).getByText('last known')).toBeInTheDocument();- expect(within(memory).getByText('40.0%')).toBeInTheDocument();+ const chart = await utilizationChart();+ await within(chart).findByText('No stored history in this range');+ expect(chart.querySelector('[data-history-last-known="memory"]')).toHaveTextContent(+ 'Memory40.0%last known',+ );+ expect(chart.querySelector('[data-history-current="memory"]')).toBeNull();});it('does not show a filled-in zero for a node with no disk measurement', async () => {+ chartsApiMocks.getMetricsHistory.mockResolvedValue(EMPTY_HISTORY);render(() => (<NodeDrawer node={makeNode({ disk: { total: 0, used: 0, free: 0, usage: 0 } })} />));- const disk = await screen.findByTestId('drawer-trend-card-disk');- expect(within(disk).queryByText('0.0%')).toBeNull();- expect(within(disk).getByText('—')).toBeInTheDocument();+ const chart = await utilizationChart();+ await within(chart).findByText('No stored history in this range');+ expect(chart).toHaveTextContent('Disk-');+ expect(chart).not.toHaveTextContent('Disk0.0%');+ expect(screen.getByTestId('node-drawer-facts')).not.toHaveTextContent('root disk');});- it("headlines the backend's primary CPU temperature, the reading its line records", async () => {+ it("charts the backend's primary CPU temperature, the reading its history records", async () => {// The details carry a hotter core than the backend's primary reading. The- // card must show the backend value: the history beneath it was recorded- // under the backend rule, so a recomputed headline would disagree with it.+ // chart must fall back to the backend value: its history is recorded under+ // the backend rule, so a recomputed reading would disagree with it.+ chartsApiMocks.getMetricsHistory.mockResolvedValue(EMPTY_HISTORY);render(() => (<NodeDrawernode={makeNode({@@ -530,29 +553,91 @@ describe('NodeDrawer Overview trends', () => {})}/>));- const temperature = await screen.findByTestId('drawer-trend-card-temperature');- expect(within(temperature).getByText('44°C')).toBeInTheDocument();- expect(temperature.textContent).not.toContain('51');+ const charts = await screen.findAllByTestId('guest-history-group-chart');+ const thermals = charts.find((chart) => chart.dataset.historyGroup === 'thermals')!;+ await within(thermals).findByText('No stored history in this range');+ const reading = thermals.querySelector('[data-history-current="temperature"]');+ expect(reading).toHaveTextContent('44°C');+ expect(reading?.textContent).not.toContain('51');+ });++ it('shows live readings on a healthy node before any history is stored', async () => {+ chartsApiMocks.getMetricsHistory.mockResolvedValue(EMPTY_HISTORY);+ render(() => (+ <NodeDrawer+ node={makeNode({+ cpu: 37,+ memory: { total: 8000, used: 4000, free: 4000, usage: 50 },+ disk: { total: 1000, used: 250, free: 750, usage: 25 },+ })}+ />+ ));+ const chart = await utilizationChart();+ await within(chart).findByText('No stored history in this range');+ expect(chart.querySelector('[data-history-current="cpu"]')).toHaveTextContent(+ 'CPU37.0%current',+ );+ expect(chart.querySelector('[data-history-current="disk"]')).toHaveTextContent(+ 'Disk25.0%current',+ );+ const facts = screen.getByTestId('node-drawer-facts');+ expect(facts).toHaveTextContent(/of 7\.81 KB RAM/);+ expect(facts).toHaveTextContent(/250 B of 1000 B root disk/);+ });++ it("states only an offline node's capacity, not a used amount that reads as live", async () => {+ render(() => <NodeDrawer node={makeNode({ status: 'offline' })} />);+ const facts = screen.getByTestId('node-drawer-facts');+ expect(facts).toHaveTextContent('RAM');+ expect(facts.textContent).not.toMatch(/ of .*RAM/);});- it('opens History on the week, since the Overview cards already cover 24 hours', async () => {+ it('tones a reading for an alert that carries no numeric trigger, without a line', async () => {+ const nodeAlert = makeAlert({ threshold: undefined, level: 'critical' });+ render(() => <NodeDrawer node={makeNode()} alerts={[nodeAlert]} ownAlerts={[nodeAlert]} />);+ const chart = await utilizationChart();+ await waitFor(() => expect(chart.querySelector('path[data-history-series]')).not.toBeNull());+ expect(chart.querySelector('[data-history-threshold]')).toBeNull();+ const memoryReading = chart.querySelector('span[class*="text-red-700"]');+ expect(memoryReading).not.toBeNull();+ });++ it('describes an alert trigger to assistive technology, not only in an SVG title', async () => {+ render(() => <NodeDrawer node={makeNode()} alerts={[makeAlert()]} ownAlerts={[makeAlert()]} />);+ const chart = await utilizationChart();+ const plot = within(chart).getByRole('img', { name: 'Utilization history' });+ await waitFor(() =>+ expect(plot).toHaveAccessibleDescription(/Memory warning alert at 90\.0%\./),+ );+ });++ it('opens the charts on 24 hours with the range picker beside them', async () => {render(() => <NodeDrawer node={makeNode()} />);- await screen.findByTestId('drawer-trend-card-cpu');- fireEvent.click(screen.getByRole('tab', { name: 'History' }));+ await utilizationChart();+ expect(screen.getByTestId('guest-history-range-control')).toHaveValue('24h');+ fireEvent.change(screen.getByTestId('guest-history-range-control'), {+ target: { value: '7d' },+ });await waitFor(() =>expect(chartsApiMocks.getMetricsHistory.mock.calls.map(([params]) => params.range)).toEqual(['24h','7d',]),);- expect(screen.getByTestId('guest-history-range-control')).toHaveValue('7d');});- it('reads the 24h trend once while Overview shows and mounts History only on demand', async () => {- render(() => <NodeDrawer node={makeNode()} />);- await screen.findByTestId('drawer-trend-card-cpu');- await waitFor(() => expect(chartsApiMocks.getMetricsHistory).toHaveBeenCalledTimes(1));- expect(chartsApiMocks.getMetricsHistory.mock.calls[0][0]).toMatchObject({ range: '24h' });- expect(screen.queryByTestId('guest-history-group-chart')).toBeNull();+ it('reads history once while Overview shows and stops reading behind Manage', async () => {+ vi.useFakeTimers({ shouldAdvanceTime: true });+ try {+ render(() => <NodeDrawer node={makeNode()} />);+ await utilizationChart();+ await waitFor(() => expect(chartsApiMocks.getMetricsHistory).toHaveBeenCalledTimes(1));+ expect(chartsApiMocks.getMetricsHistory.mock.calls[0][0]).toMatchObject({ range: '24h' });+ fireEvent.click(screen.getByRole('tab', { name: 'Manage' }));+ await vi.advanceTimersByTimeAsync(120_000);+ expect(chartsApiMocks.getMetricsHistory).toHaveBeenCalledTimes(1);+ } finally {+ vi.useRealTimers();+ }});});diff --git a/frontend-modern/src/components/Workloads/NodeDrawer.tsx b/frontend-modern/src/components/Workloads/NodeDrawer.tsxindex 2a10007705..699e1d6e97 100644--- a/frontend-modern/src/components/Workloads/NodeDrawer.tsx+++ b/frontend-modern/src/components/Workloads/NodeDrawer.tsx@@ -12,8 +12,7 @@ import type { MetricDisplayThresholds } from '@/utils/metricThresholds';import { getNodeDisplayName } from '@/utils/nodes';import { getSimpleStatusIndicator } from '@/utils/status';-import { GuestDrawerHistory, GuestDrawerHistoryRangeSelect } from './GuestDrawerHistory';-import { TRENDED_DRAWER_HISTORY_DEFAULT_RANGE } from './guestDrawerModel';+import { GUEST_DRAWER_HISTORY_DEFAULT_RANGE } from './guestDrawerModel';import { NodeDrawerOverview } from './NodeDrawerOverview';import {getNodeDrawerCurrentMetrics,@@ -34,12 +33,12 @@ interface NodeDrawerProps {onClose?: () => void;}-type NodeDrawerTab = 'overview' | 'history' | 'manage';+type NodeDrawerTab = 'overview' | 'manage';export const NodeDrawer: Component<NodeDrawerProps> = (props) => {const [activeTab, setActiveTab] = createSignal<NodeDrawerTab>('overview');const [historyRange, setHistoryRange] = createSignal<HistoryTimeRange>(- TRENDED_DRAWER_HISTORY_DEFAULT_RANGE,+ GUEST_DRAWER_HISTORY_DEFAULT_RANGE,);const alertsActivation = useAlertsActivation();@@ -49,7 +48,7 @@ export const NodeDrawer: Component<NodeDrawerProps> = (props) => {const historyGroups = createMemo(() => getNodeDrawerHistoryGroups(props.node));const currentMetrics = createMemo(() => getNodeDrawerCurrentMetrics(props.node));// The drawer lists alerts for the node's guests too; only the node's own- // alerts describe the metrics on its trend cards.+ // alerts describe the metrics on its charts.const ownAlerts = createMemo(() => {if (props.ownAlerts) return props.ownAlerts;const ids = new Set(nodeOverrideIdCandidates(props.node));@@ -101,14 +100,8 @@ export const NodeDrawer: Component<NodeDrawerProps> = (props) => {onChange={(value) => setActiveTab(value as NodeDrawerTab)}tabs={[{ value: 'overview', label: 'Overview' },- { value: 'history', label: 'History' },{ value: 'manage', label: 'Manage' },]}- trailing={- <Show when={activeTab() === 'history'}>- <GuestDrawerHistoryRangeSelect range={historyRange()} onRangeChange={setHistoryRange} />- </Show>- }/>{/* Use CSS hidden instead of Show to avoid mount/unmount which causes scroll jumps.@@ -120,24 +113,15 @@ export const NodeDrawer: Component<NodeDrawerProps> = (props) => {temperatureThresholds={temperatureThresholds()}alerts={props.alerts}historyTarget={historyTarget()}- trendsEnabled={activeTab() === 'overview'}+ historyRange={historyRange()}+ onHistoryRangeChange={setHistoryRange}+ historyGroups={historyGroups()}+ currentMetrics={currentMetrics()}+ historyEnabled={activeTab() === 'overview'}metricAlerts={ownAlerts()}/></div>- {/* Mounted on demand, like the guest drawer's History: a hidden History- would poll the same resource the Overview trends already read. */}- <Show when={activeTab() === 'history'}>- <div class="[overflow-anchor:none]">- <GuestDrawerHistory- currentMetrics={currentMetrics()}- groups={historyGroups()}- range={historyRange()}- target={historyTarget()}- />- </div>- </Show>-<div class={`[overflow-anchor:none] ${activeTab() === 'manage' ? '' : 'hidden'}`}><Show when={activeTab() === 'manage'}><div data-testid="node-manage-tab">diff --git a/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx b/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsxindex cdc3c7b619..56cc5031f0 100644--- a/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx+++ b/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx@@ -8,6 +8,7 @@ import {TechnicalDetailsSection,} from '@/components/shared/TechnicalDetailsDisclosure';import { HOST_METRICS_HISTORY_GROUPS } from '@/components/shared/hostMetricsHistoryModel';+import type { HistoryTimeRange } from '@/api/charts';import { DrawerAttentionSection } from '@/components/shared/DrawerAttentionSection';import { DrawerExceptionList } from './DrawerExceptionList';import {@@ -28,24 +29,24 @@ import { getProxmoxUpdateEvidencePresentation } from '@/utils/proxmoxUpdateEvideimport { formatTemperature, getTemperatureTextClass } from '@/utils/temperature';import { buildDrawerDiskListItems } from './DrawerDiskListCard';-import type { DrawerTrendCardConfig } from './DrawerTrendCards';import {collectDrawerExceptionRows,- getDrawerMetricAlert,+ getDrawerChartAlerts,withoutDrawerExceptionRows,} from './drawerOverviewModel';-import type {- GuestDrawerHistoryDeferredMetric,- GuestDrawerHistoryTarget,+import {+ GUEST_DRAWER_HISTORY_DEFAULT_RANGE,+ type GuestDrawerHistoryDeferredMetric,+ type GuestDrawerHistoryGroupConfig,+ type GuestDrawerHistoryTarget,} from './guestDrawerModel';// Loaded once a node drawer opens, so the Proxmox table chunk does not carry it.-const DrawerTrendCards = lazy(() => import('./DrawerTrendCards'));--const hostSeriesColor = (metric: string): string =>- HOST_METRICS_HISTORY_GROUPS.flatMap((group) => group.series).find(- (series) => series.metric === metric,- )?.color ?? 'currentColor';+const GuestDrawerHistory = lazy(() =>+ import('./GuestDrawerHistory').then(({ GuestDrawerHistory }) => ({+ default: GuestDrawerHistory,+ })),+);const finitePercent = (value: number | null | undefined): number | undefined =>typeof value === 'number' && Number.isFinite(value) && value >= 0@@ -58,9 +59,14 @@ interface NodeDrawerOverviewProps {temperatureThresholds?: MetricDisplayThresholds | null;alerts?: Alert[];historyTarget?: GuestDrawerHistoryTarget | null;- /** True while Overview is the visible tab; hidden trends do not poll. */- trendsEnabled?: boolean;- /** The node's own alerts, without its guests', for the trend cards. */+ historyRange?: HistoryTimeRange;+ onHistoryRangeChange?: (range: HistoryTimeRange) => void;+ historyGroups?: GuestDrawerHistoryGroupConfig[];+ /** Live readings the charts fall back to before any history is stored. */+ currentMetrics?: Record<string, number | undefined>;+ /** True while Overview is the visible tab; hidden charts do not poll. */+ historyEnabled?: boolean;+ /** The node's own alerts, without its guests', for the charts' alert lines. */metricAlerts?: Alert[];}@@ -454,8 +460,8 @@ export function NodeDrawerOverview(props: NodeDrawerOverviewProps) {collectDrawerExceptionRows([...overviewSections(), ...technicalSections()]),);- // The table withholds readings from an offline or stale node; the trend- // cards do the same instead of presenting the last numbers as live.+ // The table withholds readings from an offline or stale node; the charts do+ // the same instead of presenting the last numbers as live.const liveReadingsWithheld = (): string | null => {const health = (props.node.connectionHealth || '').trim().toLowerCase();if (props.node.status === 'offline') return 'Node is offline. Showing its history only.';@@ -470,85 +476,63 @@ export function NodeDrawerOverview(props: NodeDrawerOverviewProps) {return null;};- const trendCards = (): DrawerTrendCardConfig[] => {- const card = (- metric: string,- label: string,- unit: DrawerTrendCardConfig['unit'],- current: number | undefined,- detail?: string,- deferred?: GuestDrawerHistoryDeferredMetric,- ): DrawerTrendCardConfig => {- const alert = getDrawerMetricAlert(props.metricAlerts, metric);- const withheld = liveReadingsWithheld();+ // The adapter fills missing usage with zero; a known total is the evidence+ // that a percentage was measured at all.+ const memoryValue = () => {+ const memory = props.node.memory;+ return memory?.usageUnavailable || !((memory?.total ?? 0) > 0)+ ? undefined+ : finitePercent(memory?.usage);+ };+ const diskMeasured = () => (props.node.disk?.total ?? 0) > 0;+ // A retained or undated memory reading is shown as last known, the same rule+ // the guest drawer follows, rather than as a live value.+ const deferredMetrics = createMemo(+ (): Record<string, GuestDrawerHistoryDeferredMetric | undefined> | undefined => {+ if (liveReadingsWithheld()) return undefined;+ const memoryReading = getMemoryObservationPresentation(+ memoryValue(),+ props.node.memory?.observation,+ );+ if (!memoryReading || memoryReading.state === 'current') return undefined;return {- metric,- label,- unit,- color: hostSeriesColor(metric),- current: withheld ? undefined : current,- deferred: withheld ? { message: withheld } : deferred,- detail: withheld ? undefined : detail,- alertSeverity: alert?.severity,- alertThreshold: alert?.threshold,+ memory: {+ lastKnownValue: memoryReading.state === 'unavailable' ? undefined : memoryValue(),+ ...(memoryReading.state === 'unknown'+ ? { valueLabel: 'freshness unknown' as const }+ : {}),+ message: memoryReading.message,+ },};+ },+ );+ // Live readings the charts show before any history is stored. A withheld+ // node offers none, and deferred memory is qualified above instead.+ const liveMetrics = createMemo((): Record<string, number | undefined> | undefined => {+ if (liveReadingsWithheld()) return undefined;+ return {+ ...props.currentMetrics,+ cpu: finitePercent(props.node.cpu),+ memory: deferredMetrics()?.memory ? undefined : memoryValue(),+ disk: diskMeasured() ? finitePercent(props.node.disk?.usage) : undefined,};- const memory = props.node.memory;- const disk = props.node.disk;- // The adapter fills missing usage with zero; a known total is the- // evidence that a percentage was measured at all.- const memoryValue =- memory?.usageUnavailable || !((memory?.total ?? 0) > 0)- ? undefined- : finitePercent(memory?.usage);- // A retained or undated reading is shown as last known, the same rule the- // guest cards follow, rather than as a live value.- const memoryReading = getMemoryObservationPresentation(memoryValue, memory?.observation);- const memoryDeferred: GuestDrawerHistoryDeferredMetric | undefined =- memoryReading && memoryReading.state !== 'current'- ? {- lastKnownValue: memoryReading.state === 'unavailable' ? undefined : memoryValue,- ...(memoryReading.state === 'unknown'- ? { valueLabel: 'freshness unknown' as const }- : {}),- message: memoryReading.message,- }- : undefined;- const memoryCurrent = memoryDeferred ? undefined : memoryValue;- const diskMeasured = (disk?.total ?? 0) > 0;- // The backend's primary reading, recorded under the same rule as the line.- const temperature = props.node.cpuTemperature;- return [- card(- 'cpu',- 'CPU',- '%',- finitePercent(props.node.cpu),- loadAverageLabel() !== '-' ? `load ${props.node.loadAverage?.[0]?.toFixed(2)}` : undefined,- ),- card(- 'memory',- 'Memory',- '%',- memoryCurrent,- (memoryCurrent ?? memoryDeferred?.lastKnownValue) !== undefined- ? `${formatBytes(memory.used ?? 0)} of ${formatBytes(memory.total)}`- : undefined,- memoryDeferred,- ),- ...(typeof temperature === 'number'- ? [card('temperature', 'CPU temperature', 'C', temperature)]- : []),- card(- 'disk',- 'Root disk',- '%',- diskMeasured ? finitePercent(disk?.usage) : undefined,- diskMeasured- ? `${formatBytes(disk?.used ?? 0)} of ${formatBytes(disk?.total ?? 0)}`- : undefined,+ });+ const chartAlerts = createMemo(() =>+ getDrawerChartAlerts(+ props.metricAlerts,+ (props.historyGroups ?? HOST_METRICS_HISTORY_GROUPS).flatMap((group) =>+ group.series.map((series) => series.metric),),- ];+ ),+ );++ // The sizes the charts' percentages are of. A withheld node states only its+ // capacity, not a used amount that would read as live.+ const sizeFact = (total: number | undefined, used: number | undefined, label: string) => {+ if (!((total ?? 0) > 0)) return '';+ return !liveReadingsWithheld() && typeof used === 'number' && used >= 0+ ? `${formatBytes(used)} of ${formatBytes(total ?? 0)} ${label}`+ : `${formatBytes(total ?? 0)} ${label}`;};const facts = () => {@@ -561,7 +545,12 @@ export function NodeDrawerOverview(props: NodeDrawerOverviewProps) {return [versionLabel() ? `Proxmox VE ${versionLabel()}` : '',[model, hasPositiveNumber(cores) ? `${cores} logical CPUs` : ''].filter(Boolean).join(' · '),- (props.node.memory?.total ?? 0) > 0 ? `${formatBytes(props.node.memory.total)} RAM` : '',+ sizeFact(+ props.node.memory?.total,+ memoryValue() !== undefined ? props.node.memory?.used : undefined,+ 'RAM',+ ),+ diskMeasured() ? sizeFact(props.node.disk?.total, props.node.disk?.used, 'root disk') : '',firstAddress ?? '',clusterLabel() && clusterLabel() !== 'Standalone' ? `Cluster ${clusterLabel()}` : '',].filter((fact) => fact.trim().length > 0);@@ -592,11 +581,23 @@ export function NodeDrawerOverview(props: NodeDrawerOverviewProps) {<DrawerExceptionList testId="node-drawer-exceptions" rows={exceptionRows()} /><Show when={props.historyTarget}>- <Suspense fallback={<div class="h-28" aria-hidden="true" />}>- <DrawerTrendCards+ <Show when={liveReadingsWithheld()}>+ {(message) => (+ <p data-testid="node-drawer-readings-withheld" class="text-xs text-muted">+ {message()}+ </p>+ )}+ </Show>+ <Suspense fallback={<div class="h-48" aria-hidden="true" />}>+ <GuestDrawerHistorytarget={props.historyTarget ?? null}- enabled={props.trendsEnabled ?? true}- cards={trendCards()}+ range={props.historyRange ?? GUEST_DRAWER_HISTORY_DEFAULT_RANGE}+ onRangeChange={props.onHistoryRangeChange}+ enabled={props.historyEnabled ?? true}+ groups={props.historyGroups}+ currentMetrics={liveMetrics()}+ deferredMetrics={deferredMetrics()}+ alerts={chartAlerts()}/></Suspense></Show>diff --git a/frontend-modern/src/components/Workloads/__tests__/DrawerTrendCards.test.tsx b/frontend-modern/src/components/Workloads/__tests__/DrawerTrendCards.test.tsxdeleted file mode 100644index 76ee7a3c44..0000000000--- a/frontend-modern/src/components/Workloads/__tests__/DrawerTrendCards.test.tsx+++ /dev/null@@ -1,228 +0,0 @@-import { cleanup, render, screen, waitFor, within } from '@solidjs/testing-library';-import { createSignal } from 'solid-js';-import { afterEach, describe, expect, it, vi } from 'vitest';-import { ChartsAPI, type AllMetricsHistoryResponse } from '@/api/charts';-import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';-import DrawerTrendCards, { type DrawerTrendCardConfig } from '../DrawerTrendCards';--afterEach(() => {- cleanup();- resetCreateNonSuspendingQueryCacheForTest();- vi.restoreAllMocks();-});--const start = Date.UTC(2026, 9, 12, 12);-const target = { resourceType: 'vm' as const, resourceId: 'fixture:pve:281' };-const point = (hour: number, value: number) => ({- timestamp: start + hour * 3_600_000,- value,- min: value,- max: value,-});-const response = (metrics: AllMetricsHistoryResponse['metrics']): AllMetricsHistoryResponse => ({- ...target,- range: '24h',- start,- end: start + 24 * 3_600_000,- source: 'store',- metrics,-});-const memoryCard = (overrides: Partial<DrawerTrendCardConfig> = {}): DrawerTrendCardConfig => ({- metric: 'memory',- label: 'Memory',- unit: '%',- color: '#f59e0b',- current: 85.4,- detail: '3.42 GB of 4.00 GB',- ...overrides,-});-const card = (metric = 'memory') => screen.getByTestId(`drawer-trend-card-${metric}`);--describe('DrawerTrendCards', () => {- it('reads the 24h history once and shows the live value, the 24h range and the detail', async () => {- const fetch = vi- .spyOn(ChartsAPI, 'getMetricsHistory')- .mockResolvedValue(response({ memory: [point(0, 84), point(12, 84.6), point(23, 85.6)] }));- render(() => <DrawerTrendCards target={target} enabled cards={[memoryCard()]} />);-- await waitFor(() => expect(card()).toHaveTextContent('24h low–high: 84.0%–85.6%'));- expect(fetch).toHaveBeenCalledTimes(1);- expect(fetch.mock.calls[0][0]).toMatchObject({ ...target, range: '24h' });- expect(within(card()).getByText('85.4%')).toBeInTheDocument();- expect(card()).toHaveTextContent('3.42 GB of 4.00 GB');- expect(within(card()).getByRole('img')).toHaveAccessibleName(- 'Memory now 85.4%, 84.0% to 85.6% over 24 hours',- );- // A current reading is not drawn as a trend point; three stored points.- expect(card().querySelector('path')?.getAttribute('d')?.match(/[ML]/g)).toHaveLength(3);- });-- it("draws an active alert's own trigger and marks the card with its severity", async () => {- vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue(- response({ memory: [point(0, 84), point(23, 85.6)] }),- );- render(() => (- <DrawerTrendCards- target={target}- enabled- cards={[memoryCard({ alertSeverity: 'warning', alertThreshold: 85 })]}- />- ));-- const threshold = await screen.findByTestId('drawer-trend-threshold');- // 0-100% scale on a 48px plot: 85% sits at 7.2px.- expect(Number(threshold.getAttribute('y1'))).toBeCloseTo(7.2, 1);- expect(card()).toHaveClass('border-amber-400');- });-- it('labels a deferred reading as last known and says why, instead of calling it current', async () => {- vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue(- response({ memory: [point(0, 60), point(23, 62)] }),- );- render(() => (- <DrawerTrendCards- target={target}- enabled- cards={[- memoryCard({- current: undefined,- deferred: { lastKnownValue: 62, message: 'Guest reads are paused during a backup.' },- }),- ]}- />- ));-- expect(within(card()).getByText('last known')).toBeInTheDocument();- expect(within(card()).getByText('62.0%')).toBeInTheDocument();- expect(card()).toHaveTextContent('Guest reads are paused during a backup.');- // The chart's accessible name carries the same qualifier as the visible value.- expect(await within(card()).findByRole('img')).toHaveAccessibleName(- 'Memory last known 62.0%, 60.0% to 62.0% over 24 hours',- );- });-- it('says it is still collecting when no history has been stored', async () => {- vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue(response({}));- render(() => <DrawerTrendCards target={target} enabled cards={[memoryCard()]} />);- await waitFor(() => expect(card()).toHaveTextContent('Collecting history'));- });-- it('does not read history while its tab is hidden', async () => {- const fetch = vi- .spyOn(ChartsAPI, 'getMetricsHistory')- .mockResolvedValue(response({ memory: [point(0, 84), point(23, 85)] }));- const [enabled, setEnabled] = createSignal(false);- render(() => <DrawerTrendCards target={target} enabled={enabled()} cards={[memoryCard()]} />);-- await Promise.resolve();- expect(fetch).not.toHaveBeenCalled();- setEnabled(true);- await waitFor(() => expect(fetch).toHaveBeenCalledTimes(1));- });-- it('states a spike inside an averaged bucket, and does not call one reading steady', async () => {- vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue(- response({- memory: [- { timestamp: start, value: 50, min: 48, max: 99 },- { timestamp: start + 3_600_000, value: 51, min: 50, max: 52 },- ],- cpu: [point(0, 4)],- }),- );- render(() => (- <DrawerTrendCards- target={target}- enabled- cards={[memoryCard(), memoryCard({ metric: 'cpu', label: 'CPU', current: 4 })]}- />- ));- await waitFor(() => expect(card()).toHaveTextContent('24h low–high: 48.0%–99.0%'));- expect(card('cpu')).toHaveTextContent('24h: one reading so far');- });-- it("widens a temperature scale to the alert's trigger instead of clamping the line", async () => {- vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue(- response({ temperature: [point(0, 45), point(12, 55), point(23, 50)] }),- );- render(() => (- <DrawerTrendCards- target={target}- enabled- cards={[- {- metric: 'temperature',- label: 'CPU temperature',- unit: 'C',- color: '#ef4444',- current: 50,- alertSeverity: 'warning',- alertThreshold: 85,- },- ]}- />- ));- const threshold = await screen.findByTestId('drawer-trend-threshold');- const thresholdY = Number(threshold.getAttribute('y1'));- // Clamped to a 45-55°C scale the line would sit on the top edge (0).- expect(thresholdY).toBeGreaterThan(0);- const pathYs = (card('temperature').querySelector('path')?.getAttribute('d') ?? '')- .split(/[ML]/)- .filter(Boolean)- .map((pair) => Number(pair.split(',')[1]));- expect(Math.min(...pathYs)).toBeGreaterThan(thresholdY);- });-- it('keeps an earlier trend after a failed refresh, and says so', async () => {- const fetch = vi- .spyOn(ChartsAPI, 'getMetricsHistory')- .mockResolvedValueOnce(response({ memory: [point(0, 84), point(23, 85)] }))- .mockRejectedValue(new Error('boom'));- const [enabled, setEnabled] = createSignal(true);- render(() => <DrawerTrendCards target={target} enabled={enabled()} cards={[memoryCard()]} />);- await waitFor(() => expect(card()).toHaveTextContent('24h low–high: 84.0%–85.0%'));- setEnabled(false);- setEnabled(true);- await waitFor(() => expect(fetch).toHaveBeenCalledTimes(2));- await waitFor(() =>- expect(card()).toHaveTextContent('Refresh failed. Showing the last loaded trend.'),- );- expect(card()).toHaveTextContent('24h low–high: 84.0%–85.0%');- });-- it('stops polling while hidden and reads again when shown', async () => {- vi.useFakeTimers({ toFake: ['setInterval', 'clearInterval'] });- try {- const fetch = vi- .spyOn(ChartsAPI, 'getMetricsHistory')- .mockResolvedValue(response({ memory: [point(0, 84), point(23, 85)] }));- const [enabled, setEnabled] = createSignal(true);- render(() => <DrawerTrendCards target={target} enabled={enabled()} cards={[memoryCard()]} />);- const settle = async () => {- for (let i = 0; i < 5; i += 1) await Promise.resolve();- };- await settle();- expect(fetch).toHaveBeenCalledTimes(1);- vi.advanceTimersByTime(30_000);- await settle();- expect(fetch).toHaveBeenCalledTimes(2);- setEnabled(false);- vi.advanceTimersByTime(120_000);- await settle();- expect(fetch).toHaveBeenCalledTimes(2);- setEnabled(true);- await settle();- expect(fetch).toHaveBeenCalledTimes(3);- } finally {- vi.useRealTimers();- }- });-- it('says the trend is unavailable when the read fails, keeping the live value', async () => {- vi.spyOn(ChartsAPI, 'getMetricsHistory').mockRejectedValue(new Error('boom'));- render(() => <DrawerTrendCards target={target} enabled cards={[memoryCard()]} />);-- await waitFor(() => expect(card()).toHaveTextContent('Trend unavailable'));- expect(within(card()).getByText('85.4%')).toBeInTheDocument();- });-});diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.source-isolation.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.source-isolation.test.tsxindex 1186c2e96d..e5c16ba3d6 100644--- a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.source-isolation.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.source-isolation.test.tsx@@ -6,7 +6,6 @@ import {createNonSuspendingQuery,resetCreateNonSuspendingQueryCacheForTest,} from '@/hooks/createNonSuspendingQuery';-import DrawerTrendCards from '../DrawerTrendCards';import { GuestDrawerHistory } from '../GuestDrawerHistory';import type { GuestDrawerHistoryTarget } from '../guestDrawerModel';@@ -235,37 +234,4 @@ describe('GuestDrawerHistory source isolation', () => {view.unmount();expect(active!.aborted).toBe(true);});-- it.each([- ['opens on', '24h', 1],- ['does not borrow', '6h', 0],- ] as const)(- "%s the Overview trend's read for the same target when the range is %s",- async (_label, range, expectedPaths) => {- const fetch = vi- .spyOn(ChartsAPI, 'getMetricsHistory')- .mockResolvedValueOnce(response('host-shared'))- .mockImplementation(() => new Promise(() => {}));- const target = { resourceType: 'agent' as const, resourceId: 'host-shared' };- const overview = render(() => (- <DrawerTrendCards- target={target}- enabled- cards={[{ metric: 'cpu', label: 'CPU', unit: '%', color: '#8b5cf6', current: 88 }]}- />- ));- await waitFor(() =>- expect(screen.getByTestId('drawer-trend-card-cpu')).toHaveTextContent(- '24h low–high: 87.0%–88.0%',- ),- );- overview.unmount();-- // The History tab's own read never settles here: anything it draws came- // from the Overview's read through the shared query cache key.- const { container } = render(() => <GuestDrawerHistory target={target} range={range} />);- await waitFor(() => expect(fetch).toHaveBeenCalledTimes(2));- expect(paths(container)).toHaveLength(expectedPaths);- },- );});diff --git a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsxindex 621635fa86..4e665e2119 100644--- a/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/WorkloadsSurface.performance.contract.test.tsx@@ -1654,7 +1654,9 @@ describe('Workloads performance contract', () => {it('keeps guest drawer runtime and derivations in canonical drawer owners', () => {expect(guestDrawerSource).toContain('useGuestDrawerState');expect(guestDrawerSource).toContain('GuestDrawerOverview');- expect(guestDrawerSource).toContain('GuestDrawerHistoryRangeSelect');+ // The charts live on Overview; there is no History tab to carry a picker.+ expect(guestDrawerSource).not.toContain('GuestDrawerHistoryRangeSelect');+ expect(guestDrawerSource).not.toContain("label: 'History'");expect(guestDrawerSource).toContain('ObjectDrawerHeader');expect(guestDrawerSource).not.toContain('Open related infrastructure');expect(guestDrawerHistorySource).toContain('data-testid="guest-history-hover-time"');@@ -1668,7 +1670,8 @@ describe('Workloads performance contract', () => {expect(guestDrawerHistorySource).toContain('relative min-h-24 flex-1');expect(guestDrawerHistorySource).not.toContain('relative h-24');expect(nodeDrawerSource).toContain('NodeDrawerOverview');- expect(nodeDrawerSource).toContain('GuestDrawerHistoryRangeSelect');+ expect(nodeDrawerSource).not.toContain('GuestDrawerHistoryRangeSelect');+ expect(nodeDrawerSource).not.toContain("label: 'History'");expect(nodeDrawerSource).toContain('getNodeDrawerHistoryGroups');expect(nodeDrawerOverviewSource).toContain('Hardware');expect(nodeDrawerOverviewSource).toContain('Telemetry');@@ -1713,10 +1716,14 @@ describe('Workloads performance contract', () => {expect(filesystemsSectionIndex).toBeGreaterThan(-1);expect(guestDrawerOverviewSource).not.toContain("label: 'Tags'");expect(guestDrawerOverviewSource).toContain('dataTestId="guest-drawer-filesystems"');- // The 24h trend cards load with an open drawer, outside the table chunk.- expect(guestDrawerOverviewSource).toContain("import('./DrawerTrendCards')");+ // The Overview charts load with an open drawer, outside the table chunk.+ expect(guestDrawerOverviewSource).toContain("import('./GuestDrawerHistory')");expect(guestDrawerOverviewSource).not.toMatch(- /^import (?!type )[^;]*from '\.\/DrawerTrendCards';/m,+ /^import (?!type )[^;]*from '\.\/GuestDrawerHistory';/m,+ );+ expect(nodeDrawerOverviewSource).toContain("import('./GuestDrawerHistory')");+ expect(nodeDrawerOverviewSource).not.toMatch(+ /^import (?!type )[^;]*from '\.\/GuestDrawerHistory';/m,);// Filesystem rows delegate full-path presentation to the shared renderer.const filesystemSectionSource = guestDrawerOverviewSource.slice(diff --git a/frontend-modern/src/components/Workloads/__tests__/drawerOverviewModel.test.ts b/frontend-modern/src/components/Workloads/__tests__/drawerOverviewModel.test.tsindex 2e24d45884..9b6886b81d 100644--- a/frontend-modern/src/components/Workloads/__tests__/drawerOverviewModel.test.ts+++ b/frontend-modern/src/components/Workloads/__tests__/drawerOverviewModel.test.ts@@ -3,6 +3,7 @@ import type { DetailSection } from '@/components/shared/detailSectionModel';import type { Alert } from '@/types/api';import {collectDrawerExceptionRows,+ getDrawerChartAlerts,getDrawerMetricAlert,isDrawerAvailabilityHealthy,withoutDrawerExceptionRows,@@ -39,6 +40,45 @@ describe('getDrawerMetricAlert', () => {});});+describe('getDrawerChartAlerts', () => {+ it('converts I/O triggers from the alert engine MiB/s to the charts B/s', () => {+ expect(+ getDrawerChartAlerts(+ [+ alert({ type: 'diskRead', threshold: 100 }),+ alert({ type: 'networkIn', level: 'critical', threshold: 2 }),+ ],+ ['diskread', 'netin'],+ ),+ ).toEqual({+ diskread: { severity: 'warning', value: 100 * 1024 * 1024 },+ netin: { severity: 'critical', value: 2 * 1024 * 1024 },+ });+ });++ it('keeps percentage and temperature triggers in their own unit', () => {+ expect(+ getDrawerChartAlerts(+ [alert({ type: 'cpu', threshold: 90 }), alert({ type: 'temperature', threshold: 80 })],+ ['cpu', 'temperature'],+ ),+ ).toEqual({+ cpu: { severity: 'warning', value: 90 },+ temperature: { severity: 'warning', value: 80 },+ });+ });++ it('keeps the severity of an alert with no numeric trigger, without a line value', () => {+ expect(getDrawerChartAlerts([alert({ threshold: Number.NaN })], ['memory'])).toEqual({+ memory: { severity: 'warning' },+ });+ });++ it('ignores alerts on metrics the drawer does not chart', () => {+ expect(getDrawerChartAlerts([alert({ type: 'diskWrite' })], ['cpu', 'memory'])).toEqual({});+ });+});+describe('drawer exception rows', () => {const sections: DetailSection[] = [{diff --git a/frontend-modern/src/components/Workloads/__tests__/useWorkloadSelectionState.test.ts b/frontend-modern/src/components/Workloads/__tests__/useWorkloadSelectionState.test.tsindex 6f344eebe2..ae97926966 100644--- a/frontend-modern/src/components/Workloads/__tests__/useWorkloadSelectionState.test.ts+++ b/frontend-modern/src/components/Workloads/__tests__/useWorkloadSelectionState.test.ts@@ -532,15 +532,15 @@ describe('useWorkloadSelectionState', () => {] as WorkloadGuest[]);const { result } = renderHook(() => useWorkloadSelectionState({ filteredGuests: guests }));result.setSelectedGuestId('stable-resource');- result.selectedGuestDrawerState.setActiveTab('history');+ result.selectedGuestDrawerState.setActiveTab('manage');result.selectedGuestDrawerState.setHistoryRange('12h');setGuests([{ id: 'stable-resource', node: 'node-2' }] as WorkloadGuest[]);result.setSelectedGuestId('stable-resource');- expect(result.selectedGuestDrawerState.activeTab()).toBe('history');+ expect(result.selectedGuestDrawerState.activeTab()).toBe('manage');expect(result.selectedGuestDrawerState.historyRange()).toBe('12h');result.setSelectedGuestId('independent-clone');expect(result.selectedGuestDrawerState.activeTab()).toBe('overview');- expect(result.selectedGuestDrawerState.historyRange()).toBe('7d');+ expect(result.selectedGuestDrawerState.historyRange()).toBe('24h');result.selectedGuestDrawerState.setActiveTab('manage');result.clearPinnedSummaryScope();expect(result.selectedGuestDrawerState.activeTab()).toBe('overview');diff --git a/frontend-modern/src/components/Workloads/drawerOverviewModel.ts b/frontend-modern/src/components/Workloads/drawerOverviewModel.tsindex b636387df4..c458f291c2 100644--- a/frontend-modern/src/components/Workloads/drawerOverviewModel.ts+++ b/frontend-modern/src/components/Workloads/drawerOverviewModel.ts@@ -12,8 +12,8 @@ export interface DrawerMetricAlert {threshold?: number;}-// An active alert on a trend card's metric colours that card and draws the-// alert's own trigger. The most severe active alert wins.+// An active alert on a charted metric tones that metric's reading and draws+// the alert's own trigger. The most severe active alert wins.export const getDrawerMetricAlert = (alerts: readonly Alert[] | undefined,metric: string,@@ -34,6 +34,45 @@ export const getDrawerMetricAlert = (return result;};+// Alert types the Overview charts draw, keyed by chart metric. The alert engine+// judges I/O rates in MiB/s while the charts plot bytes per second, so those+// triggers are converted before they meet a chart scale.+const DRAWER_CHART_ALERT_TYPES: ReadonlyArray<{ type: string; metric: string; scale: number }> = [+ { type: 'cpu', metric: 'cpu', scale: 1 },+ { type: 'memory', metric: 'memory', scale: 1 },+ { type: 'disk', metric: 'disk', scale: 1 },+ { type: 'temperature', metric: 'temperature', scale: 1 },+ { type: 'diskread', metric: 'diskread', scale: 1024 * 1024 },+ { type: 'diskwrite', metric: 'diskwrite', scale: 1024 * 1024 },+ { type: 'networkin', metric: 'netin', scale: 1024 * 1024 },+ { type: 'networkout', metric: 'netout', scale: 1024 * 1024 },+];++export interface DrawerChartAlert {+ severity: DrawerMetricAlert['severity'];+ /** The trigger in the chart's own unit; absent when the alert carries none. */+ value?: number;+}++// Active alerts on the Overview charts' metrics, keyed by chart metric. Every+// alert tones its reading; only one with a numeric trigger draws a line.+export const getDrawerChartAlerts = (+ alerts: readonly Alert[] | undefined,+ metrics: readonly string[],+): Record<string, DrawerChartAlert> => {+ const result: Record<string, DrawerChartAlert> = {};+ for (const { type, metric, scale } of DRAWER_CHART_ALERT_TYPES) {+ if (!metrics.includes(metric)) continue;+ const alert = getDrawerMetricAlert(alerts, type);+ if (!alert) continue;+ result[metric] = {+ severity: alert.severity,+ ...(typeof alert.threshold === 'number' ? { value: alert.threshold * scale } : {}),+ };+ }+ return result;+};+const isExceptionRow = (row: DetailRow): boolean => row.tone === 'warning' || row.tone === 'danger';// The drawer demotes inventory to a collapsed Details section, but a fact thatdiff --git a/frontend-modern/src/components/Workloads/guestDrawerModel.ts b/frontend-modern/src/components/Workloads/guestDrawerModel.tsindex c54a43f1f2..0f0a52519f 100644--- a/frontend-modern/src/components/Workloads/guestDrawerModel.ts+++ b/frontend-modern/src/components/Workloads/guestDrawerModel.ts@@ -44,7 +44,7 @@ export interface GuestDrawerProps {alerts?: Alert[];}-export type GuestDrawerTab = 'overview' | 'history' | 'manage';+export type GuestDrawerTab = 'overview' | 'manage';export interface GuestDrawerViewState {activeTab: Accessor<GuestDrawerTab>;@@ -195,14 +195,6 @@ export const getGuestDrawerCurrentMetrics = (guest: Guest): Record<string, numbeexport const GUEST_DRAWER_HISTORY_DEFAULT_RANGE: HistoryTimeRange = '24h';-// The Overview's trend cards cover the last 24 hours.-export const DRAWER_TREND_RANGE: HistoryTimeRange = '24h';--// Drawers whose Overview already shows those 24h trend cards open History on-// the week, so the tab adds context instead of repeating them. The free plan-// keeps 7 days, so this range is never locked.-export const TRENDED_DRAWER_HISTORY_DEFAULT_RANGE: HistoryTimeRange = '7d';-export const GUEST_DRAWER_HISTORY_GROUPS: GuestDrawerHistoryGroupConfig[] = [{id: 'utilization',diff --git a/frontend-modern/src/components/Workloads/useGuestDrawerState.ts b/frontend-modern/src/components/Workloads/useGuestDrawerState.tsindex 30f9086c39..ac7dbbca0c 100644--- a/frontend-modern/src/components/Workloads/useGuestDrawerState.ts+++ b/frontend-modern/src/components/Workloads/useGuestDrawerState.ts@@ -1,4 +1,4 @@-import { createEffect, createMemo, createSignal } from 'solid-js';+import { createMemo, createSignal } from 'solid-js';import { useAlertsActivation } from '@/stores/alertsActivation';import type { HistoryTimeRange } from '@/api/charts';@@ -25,7 +25,7 @@ import {hasGuestDrawerFilesystemDetails,hasGuestDrawerOsInfo,normalizeGuestDrawerTags,- TRENDED_DRAWER_HISTORY_DEFAULT_RANGE,+ GUEST_DRAWER_HISTORY_DEFAULT_RANGE,type GuestDrawerViewState,type GuestDrawerProps,type GuestDrawerTab,@@ -39,7 +39,7 @@ import {export function createGuestDrawerViewState(): GuestDrawerViewState {const [activeTab, setActiveTab] = createSignal<GuestDrawerTab>('overview');const [historyRange, setHistoryRange] = createSignal<HistoryTimeRange>(- TRENDED_DRAWER_HISTORY_DEFAULT_RANGE,+ GUEST_DRAWER_HISTORY_DEFAULT_RANGE,);return {activeTab,@@ -48,7 +48,7 @@ export function createGuestDrawerViewState(): GuestDrawerViewState {setHistoryRange,reset: () => {setActiveTab('overview');- setHistoryRange(TRENDED_DRAWER_HISTORY_DEFAULT_RANGE);+ setHistoryRange(GUEST_DRAWER_HISTORY_DEFAULT_RANGE);},};}@@ -118,12 +118,6 @@ export function useGuestDrawerState(props: GuestDrawerProps) {setActiveTab(tab);};- createEffect(() => {- if (activeTab() === 'history' && !hasHistorySupport()) {- setActiveTab('overview');- }- });-return {activeTab,agentHeading,diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex 41a3c2f4dc..1d2ce1acc5 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -791,7 +791,9 @@ describe('shared primitive guardrails', () => {expect(source).not.toContain('<select');}- expect(guestDrawerHistorySource).toContain('id="guest-history-range"');+ expect(guestDrawerHistorySource).toContain(+ 'const id = `guest-history-range-${createUniqueId()}`;',+ );expect(guestDrawerHistorySource).toContain('data-testid="guest-history-range-control"');});@@ -1302,16 +1304,19 @@ describe('shared primitive guardrails', () => {});it('keeps object detail history behind the canonical Overview and History subtabs', () => {- for (const source of [- diskDetailSource,- guestDrawerSource,- nodeDrawerSource,- storagePoolDetailSource,- ]) {+ for (const source of [diskDetailSource, storagePoolDetailSource]) {expect(source).toContain('@/components/shared/Subtabs');expect(source).toContain("value: 'overview', label: 'Overview'");expect(source).toContain("value: 'history', label: 'History'");}+ // Guest and node drawers chart their history on Overview itself, with the+ // range picker beside the charts. A History tab there repeated Overview's+ // charts at another range.+ for (const source of [guestDrawerSource, nodeDrawerSource]) {+ expect(source).toContain('@/components/shared/Subtabs');+ expect(source).toContain("value: 'overview', label: 'Overview'");+ expect(source).not.toContain("value: 'history', label: 'History'");+ }expect(resourceDetailDrawerSource).toContain('@/components/shared/Subtabs');expect(resourceDetailDrawerSource).toContain('tabs={drawer.tabs().map');diff --git a/tests/integration/tests/64-workloads-proxmox-refresh-stability.spec.ts b/tests/integration/tests/64-workloads-proxmox-refresh-stability.spec.tsindex 666ae2340f..5ce67d63e5 100644--- a/tests/integration/tests/64-workloads-proxmox-refresh-stability.spec.ts+++ b/tests/integration/tests/64-workloads-proxmox-refresh-stability.spec.ts@@ -179,7 +179,7 @@ test.describe.serial("Workloads Proxmox refresh stability", () => {}});- test("keeps an expanded Proxmox VM on the History tab across a canonical refresh", async ({+ test("keeps an expanded Proxmox VM on the Manage tab across a canonical refresh", async ({page,}, testInfo) => {test.skip(@@ -218,19 +218,20 @@ test.describe.serial("Workloads Proxmox refresh stability", () => {await expect(detailRow).toBeVisible();// The drawer tab strip exposes proper tab roles.- // History is always present and is the tab users reported being reset by- // live refreshes. Discovery is optional and must not be a hidden fixture- // prerequisite for this polling regression proof.- const historyButton = detailRow.getByRole("tab", {- name: "History",+ // Manage is always present and, as the non-default tab, is the one a live+ // refresh would visibly reset (users reported this on the old History+ // tab, whose charts now sit on Overview). Discovery is optional and must+ // not be a hidden fixture prerequisite for this polling regression proof.+ const manageButton = detailRow.getByRole("tab", {+ name: "Manage",exact: true,});- await expect(historyButton).toBeVisible();- await historyButton.click();+ await expect(manageButton).toBeVisible();+ await manageButton.click();await expect.poll(() => readGuestDrawerActiveTab(detailRow))- .toBe("history");+ .toBe("manage");const beforeRefreshScrollTop = await readPrimaryViewportScrollTop(page);@@ -262,7 +263,7 @@ test.describe.serial("Workloads Proxmox refresh stability", () => {await expect(detailRow).toBeVisible();await expect.poll(() => readGuestDrawerActiveTab(detailRow), { timeout: 15_000 })- .toBe("history");+ .toBe("manage");const afterRefreshScrollTop = await readPrimaryViewportScrollTop(page);expect(afterRefreshScrollTop).toBeGreaterThanOrEqual(