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
Drop the history Refresh button and chart only a resource's own alerts
rcourtman86297b67ea64
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.mdindex e06a905b0b..043778c66f 100644--- a/docs/release-control/v6/internal/subsystems/alerts.md+++ b/docs/release-control/v6/internal/subsystems/alerts.md@@ -4671,7 +4671,18 @@ canonical lookup from one unified resource to its open alerts in the websocketresource (unified id, canonical primary and superseded ids, Proxmox source id,metrics target, and for agent and Docker hosts `agent:<id>` and`docker:<host source id>` plus the component alerts nested under them) and-orders them most severe first. The Machines/Infrastructure and Docker host+orders them most severe first. A Docker container answers to the key the+engine writes for it, `docker:<host source id>/<container id>` (or+`docker:<host source id>/name:<name>` without an ID, per+`DockerContainerResourceID`), so its drawer lists its own alerts; until+2026-10-14 the container drawer matched none of them.+`getOwnAlertsForUnifiedResource` returns only the exact-key alerts, without+the nested component alerts, and is what drawer charts use for dashed+triggers: a host's Needs attention lists its containers, but a container's+memory trigger is not the host's. Those rows use `getAlertAttentionCopy`, so a+latched or recovering alert, whose message keeps its breach-time value, reads+as "Memory 70% now, recovering" beside a chart showing 70%. The+Machines/Infrastructure and Docker hostdrawers build their "Needs attention" rows from it; resources no longer embedan alert list, so no drawer can silently read an always-empty copy.`getUnifiedResourceAlertStyles` computes row highlighting from that same set,diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex 96f4a1bd69..c864c521e0 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -5481,7 +5481,14 @@ picker (these drawers, storage disk and pool details) names its options throughin three places. Below the `sm` breakpoint the chart panels stack, so a phoneshows the first panel (Utilization) plus any panel carrying an active alert,and one full-width "Show <panel names>" button (`aria-expanded`, hidden from-`sm` up) reveals the rest; wider layouts always show every panel. Any+`sm` up) reveals the rest; wider layouts always show every panel. The charts+poll every 30 seconds and offer no manual refresh; a "Retry history" button+appears only while a read has failed, and when a successful retry removes it+keyboard focus moves to the history region rather than the page. A chart+draws alert triggers only from the resource's own alerts+(`getOwnAlertsForUnifiedResource`): a Docker host's Needs attention lists its+containers' alerts, but a container's memory trigger never lands on the host's+memory chart. Anywarning- 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. Guestdiff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 4a7f3d2170..1972b22717 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -4021,8 +4021,10 @@ reads the `min`/`max` each stored bucket already carries: one extra path perseries with any spread (none for flat data). Range picker option labels comefrom one lookup table (`formatHistoryRangeOptionLabel`). The phone collapse oflater chart panels is a CSS class below `sm` on panels that stay mounted: it-hides nothing from the shared history read and adds no read or timer. None-adds a read or timer.+hides nothing from the shared history read and adds no read or timer. The+removed "Refresh history" button took no read away: the 30-second poll is+unchanged and "Retry history" still appears for a failed read. 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 000d84410b..74169e7288 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -2392,7 +2392,10 @@ their open alerts. The matcher keys a resource on its unified id, canonicalprimary and superseded ids, Proxmox source id and metrics target (PBS, PMG,storage); agent and Docker hosts also answer to `agent:<id>` and`docker:<host source id>` and to the component alerts nested under those keys-(disks, RAID arrays, sensors, containers, services). A health reason counts as+(disks, RAID arrays, sensors, containers, services). An `app-container` answers+to `docker:<host source id>/<container id>` (or `/name:<name>`), the key the+alert engine writes for it. Drawer charts take triggers only from+`getOwnAlertsForUnifiedResource` (exact keys, no nested components). A health reason counts asstated when it is a whole sentence of an open alert's text, because a unifiedincident alert on storage with consumers joins the incident summary and itsimpact ("... above threshold. Affects 2 dependent resources: ...") and neitherdiff --git a/frontend-modern/browser-verification/d1bdb0e16558b3c3.json b/frontend-modern/browser-verification/d1bdb0e16558b3c3.jsonnew file mode 100644index 0000000000..6e06a4193a--- /dev/null+++ b/frontend-modern/browser-verification/d1bdb0e16558b3c3.json@@ -0,0 +1,53 @@+{+ "version": 1,+ "base_sha": "ba17533a03b32d8911564b3f5521540f62970f6a",+ "verified_at": "2026-10-14T09:18:00Z",+ "result": "passed",+ "changed_paths": [+ "frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx",+ "frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx",+ "frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx",+ "frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx",+ "frontend-modern/src/components/Workloads/drawerOverviewModel.ts",+ "frontend-modern/src/features/docker/DockerHostDrawerOverview.tsx",+ "frontend-modern/src/utils/alerts.ts"+ ],+ "content_sha256": {+ "frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx": "186da5e8e84f834a3d00b50212f4e33b8d06e923380fe20a5ecf211799fd8a8a",+ "frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx": "9364c5e65c111117409b30c1d6a50197d2a9e4a6a57dcc2df62964507065b0cc",+ "frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx": "f240101bd2197f51b65ee2eb59d494dadfd404e4886477f0b0d7497ad345e27b",+ "frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx": "09b6ccaef3aab12374f0ea295de6e048b783efc73d9277b7d9f5728e94ca2b82",+ "frontend-modern/src/components/Workloads/drawerOverviewModel.ts": "843ba7094b87e1968d2d025ba5e9c2a1a05f7767f31d98bf22e52a779fc96add",+ "frontend-modern/src/features/docker/DockerHostDrawerOverview.tsx": "05e86661c2bbba32b1f23b8d849473bc03bf454da27d6b2383bd6aded37d512e",+ "frontend-modern/src/utils/alerts.ts": "d4a0ba86b5429b4d2196a549e93cd1f1e86a39dc42e7b7d7be3627f816230232"+ },+ "routes": [+ "/proxmox/overview",+ "/docker/overview",+ "/docker/containers",+ "/standalone/machines",+ "/proxmox/storage",+ "/proxmox/storage?tab=disks"+ ],+ "viewports": [+ {+ "width": 1440,+ "height": 900+ },+ {+ "width": 390,+ "height": 844+ }+ ],+ "states": [+ "final built bytes of this tree (origin/main ba17533a03 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",+ "every drawer (guest, node, Docker host, container, agent machine) and storage detail (pool, disk) at 1440px and 390px: no \"Refresh history\" button anywhere; the guest toolbar holds only the range picker",+ "container sftp-ingest-2 with a live critical memory alert from the real alert engine (trigger 85%, breach value 99.5%, now recovering at 70%): Needs attention lists it as \"Memory 70% now, recovering / Clears after 5 minutes at 80% or lower\", the Utilization legend reads \"Memory 70.0% alert at 85.0%\" and a dashed red line sits at 85%; before this change the container drawer listed no alert at all",+ "Docker host App Platform 01 whose container redis-cache-2 carries a memory alert: Needs attention still lists the container alert, but the host Utilization chart draws no dashed line and its own memory reading is not toned",+ "a Sol (gpt-6.1-sol) review of the whole drawer series and these screenshots prompted the alert copy, mapping, empty-chart line, facts freshness, sticky phone panel and legend label fixes in this change"+ ],+ "interactions": [+ "expanded the first guest, node, Docker host and agent rows, the sftp-ingest-2 container row, a service pool row and the first physical disk row at both widths (the 390px container row did not expose its expand control under that label and was not captured)",+ "read each drawer for threshold lines, refresh buttons and the phone chart toggle via the DOM, and the screenshots by eye"+ ]+}diff --git a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsxindex d2b0287b0c..15c76961d2 100644--- a/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx+++ b/frontend-modern/src/components/Infrastructure/ResourceDetailDrawerOverviewTab.tsx@@ -9,8 +9,9 @@ import type {} from '@/types/resource';import { useWebSocket } from '@/contexts/appRuntime';import { alertTypeDisplayLabel } from '@/features/alerts/helpers';+import { getAlertAttentionCopy } from '@/features/alerts/metricAlertPresentation';import { useAlertsActivation } from '@/stores/alertsActivation';-import { getAlertsForUnifiedResource } from '@/utils/alerts';+import { getAlertsForUnifiedResource, getOwnAlertsForUnifiedResource } from '@/utils/alerts';import { GuestDrawerHistory } from '@/components/Workloads/GuestDrawerHistory';import { getDrawerChartAlerts } from '@/components/Workloads/drawerOverviewModel';import { formatUptime, formatRelativeTime } from '@/utils/format';@@ -332,16 +333,20 @@ export const ResourceDetailDrawerOverviewTab: Component<ResourceDetailDrawerOverconst alertsActivation = useAlertsActivation();const resourceAlerts = () =>getAlertsForUnifiedResource(resource(), activeAlerts, alertsActivation.detectionEnabled());+ // The charts describe this resource itself, so a nested resource's alert+ // (a machine's disk, a host's container) draws no trigger on them.const chartAlerts = () =>getDrawerChartAlerts(- resourceAlerts(),+ getOwnAlertsForUnifiedResource(resource(), activeAlerts, alertsActivation.detectionEnabled()),drawer.metricsHistoryGroups().flatMap((group) => group.series.map((series) => series.metric)),);const attentionItems = () => {const alerts = resourceAlerts();+ // The shared copy explains a latched or recovering alert, whose message+ // keeps its breach-time value while the chart below shows the current one.const items: DrawerAttentionItem[] = alerts.map((alert) => ({id: alert.id,- message: alert.message,+ ...getAlertAttentionCopy(alert, now),subject: alert.resourceName?.trim() || resource().displayName || resource().name,metric: alertTypeDisplayLabel(alert.type),severity: alert.level,diff --git a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsxindex 3ba2931efb..ac84659ac2 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/ResourceDetailDrawer.history.test.tsx@@ -1763,3 +1763,14 @@ describe('ResourceDetailDrawer change history section', () => {expect(actions).not.toHaveTextContent('Actions temporarily unavailable');});});++describe('ResourceDetailDrawer Overview alert sources', () => {+ it('charts only the resource own alerts and explains latched ones with the shared copy', () => {+ // Needs attention lists every alert for the resource and what nests under+ // it; a chart trigger must be the resource's own (a host's container+ // memory alert is not the host's memory trigger).+ expect(resourceDetailDrawerOverviewSource).toContain('getOwnAlertsForUnifiedResource(');+ expect(resourceDetailDrawerOverviewSource).toContain('...getAlertAttentionCopy(alert, now)');+ expect(resourceDetailDrawerOverviewSource).not.toContain('message: alert.message,');+ });+});diff --git a/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx b/frontend-modern/src/components/Workloads/GuestDrawer.test.tsxindex 9fbb67d401..f7e88c8f51 100644--- a/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx+++ b/frontend-modern/src/components/Workloads/GuestDrawer.test.tsx@@ -79,6 +79,7 @@ import { GuestDrawer } from './GuestDrawer';// Overview loads its charts lazily; warm the module so a cold transform does// not outlast the tests' waits.import './GuestDrawerHistory';+import { GUEST_DRAWER_HISTORY_POLL_MS } from './guestDrawerHistoryQuery';const render = (...args: Parameters<typeof solidRender>): ReturnType<typeof solidRender> => {const result = solidRender(...args);@@ -230,6 +231,7 @@ describe('GuestDrawer', () => {});it('keeps stored History gaps through live guest recovery without another read', async () => {+ vi.useFakeTimers({ toFake: ['setInterval', 'clearInterval'] });const points = makeHistoryPoints(10);const payload = {resourceType: 'vm',@@ -277,7 +279,7 @@ describe('GuestDrawer', () => {...payload,metrics: { cpu: points, memory: points },});- fireEvent.click(screen.getByRole('button', { name: 'Refresh history' }));+ await vi.advanceTimersByTimeAsync(GUEST_DRAWER_HISTORY_POLL_MS);await waitFor(() => expect(chart.querySelector('[data-history-gaps]')).toBeNull());expect(chart.querySelectorAll('path[data-history-series]')).toHaveLength(2);expect(chart.querySelector('[data-history-observation="memory"]')).toBeNull();@@ -1169,7 +1171,17 @@ describe('GuestDrawer', () => {<GuestDrawerguest={makeGuest({cpus: 4,- memory: { total: 4 * GiB, used: GiB, free: 3 * GiB, usage: 25 },+ memory: {+ total: 4 * GiB,+ used: GiB,+ free: 3 * GiB,+ usage: 25,+ observation: {+ state: 'current',+ source: 'status-mem',+ observedAt: new Date().toISOString(),+ },+ },disk: { total: 100 * GiB, used: 25 * GiB, free: 75 * GiB, usage: 25 },})}onClose={vi.fn()}@@ -1181,6 +1193,27 @@ describe('GuestDrawer', () => {expect(facts).toHaveTextContent(/25\.0 GB of 100 GB disk/);});+ it('states only the memory size for a retained reading, not a used amount', () => {+ const GiB = 1024 ** 3;+ solidRender(() => (+ <GuestDrawer+ guest={makeGuest({+ memory: {+ total: 4 * GiB,+ used: GiB,+ free: 3 * GiB,+ usage: 25,+ observation: { state: 'last-known', source: 'guest-agent-meminfo' },+ },+ })}+ onClose={vi.fn()}+ />+ ));+ const facts = screen.getByTestId('guest-drawer-facts');+ expect(facts).toHaveTextContent('4.00 GB RAM');+ expect(facts).not.toHaveTextContent(/of 4\.00 GB RAM/);+ });+it('shows no memory amount when the memory reading is withdrawn', () => {solidRender(() => (<GuestDrawerdiff --git a/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx b/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsxindex 95f723e349..4a6f532fcd 100644--- a/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx+++ b/frontend-modern/src/components/Workloads/GuestDrawerHistory.tsx@@ -419,8 +419,14 @@ const GuestDrawerHistoryGroupChart: Component<GuestDrawerHistoryGroupChartProps>point !== undefined &&activeTimestamp() !== null &&(point.max ?? point.value) - point.value >= 0.1 * (scale().maxValue - scale().minValue);+ const alert = props.alerts?.[item.metric];return {...item,+ // Names the dashed line: its metric's reading carries the trigger.+ alertLabel:+ alert && typeof alert.value === 'number' && Number.isFinite(alert.value)+ ? `alert at ${formatHistoryChartTooltipValue(alert.value, item.unit)}`+ : null,peakLabel:point && peakVisible? `peak ${formatHistoryChartTooltipValue(point.max ?? point.value, item.unit)}`@@ -519,6 +525,16 @@ const GuestDrawerHistoryGroupChart: Component<GuestDrawerHistoryGroupChartProps><Show when={item.peakLabel}>{(label) => <span data-history-peak={item.metric}>{label()}</span>}</Show>+ <Show when={item.alertLabel}>+ {(label) => (+ <span+ data-history-alert-label={item.metric}+ class={alertToneClass(props.alerts?.[item.metric]?.severity)}+ >+ {label()}+ </span>+ )}+ </Show><Show when={item.isCurrent}><span>current</span></Show>@@ -586,7 +602,9 @@ const GuestDrawerHistoryGroupChart: Component<GuestDrawerHistoryGroupChartProps>/>)}</For>- <For each={thresholds()}>+ {/* Before any history the scale is a placeholder, so a trigger line+ would sit at an arbitrary height (an I/O trigger clamps to the top). */}+ <For each={hasStoredData() ? thresholds() : []}>{(threshold) => (<linedata-history-threshold={threshold.metric}@@ -826,6 +844,21 @@ export const GuestDrawerHistory: Component<GuestDrawerHistoryProps> = (props) =>() => !locked() && props.enabled !== false,);const historyQuery = createGuestDrawerHistoryQuery(historySource);+ // A successful retry removes the focused Retry button with the error. Keep+ // keyboard focus in the history region instead of dropping it to the page.+ let regionRef: HTMLDivElement | undefined;+ let retryHasFocus = false;+ createEffect(+ on(+ () => historyQuery.error(),+ (error, previous) => {+ if (previous && !error && retryHasFocus) {+ retryHasFocus = false;+ regionRef?.focus();+ }+ },+ ),+ );const metrics = createMemo(() => historyQuery.value().metrics ?? {});const groups = createMemo(() => props.groups ?? GUEST_DRAWER_HISTORY_GROUPS);@@ -839,8 +872,18 @@ export const GuestDrawerHistory: Component<GuestDrawerHistoryProps> = (props) =>historyQuery.value(),),);- const groupHasAlert = (group: GuestDrawerHistoryGroupConfig) =>- group.series.some((series) => Boolean(props.alerts?.[series.metric]));+ // A panel shown on a phone because of an alert stays shown after the alert+ // clears, so a reader mid-inspection does not lose the chart under them.+ const alertedGroupIds = new Set<string>();+ const alertedGroups = createMemo(() => {+ for (const group of groups()) {+ if (group.series.some((series) => Boolean(props.alerts?.[series.metric]))) {+ alertedGroupIds.add(group.id);+ }+ }+ return new Set(alertedGroupIds);+ });+ const groupHasAlert = (group: GuestDrawerHistoryGroupConfig) => alertedGroups().has(group.id);const isPhoneCollapsed = (group: GuestDrawerHistoryGroupConfig, index: number) =>!showAllOnPhone() && index > 0 && !groupHasAlert(group);const phoneCollapsedGroups = createMemo(() =>@@ -861,7 +904,10 @@ export const GuestDrawerHistory: Component<GuestDrawerHistoryProps> = (props) =>fallback={<div class="py-6 text-center text-sm text-muted">History unavailable</div>}><div- class="space-y-3"+ ref={regionRef}+ tabIndex={-1}+ data-testid="guest-history-region"+ class="space-y-3 outline-none"onPointerDown={(event) => setTouchInspection(event.pointerType === 'touch')}onPointerMove={(event) => {if (event.pointerType === 'mouse') setTouchInspection(false);@@ -889,12 +935,16 @@ export const GuestDrawerHistory: Component<GuestDrawerHistoryProps> = (props) =><GuestDrawerHistoryRangeSelect range={props.range} onRangeChange={onRangeChange()} />)}</Show>- <Show when={!locked()}>+ {/* The charts poll every 30 seconds, so a manual refresh is offered+ only to recover from a failed read. */}+ <Show when={!locked() && historyQuery.error()}><Buttonsize="sm"class="min-h-11 shrink-0 aria-disabled:opacity-50 sm:min-h-8"aria-busy={historyQuery.loading()}aria-disabled={historyQuery.loading()}+ onFocus={() => (retryHasFocus = true)}+ onBlur={() => (retryHasFocus = false)}onClick={() => {// Keep the control focusable through a retry, but reject repeat// activation until the current read settles.@@ -904,7 +954,7 @@ export const GuestDrawerHistory: Component<GuestDrawerHistoryProps> = (props) =><Show when={historyQuery.loading()}><LoadingSpinner size="sm" tone="current" class="mr-2" /></Show>- {historyQuery.error() ? 'Retry history' : 'Refresh history'}+ Retry history</Button></Show></div>diff --git a/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx b/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsxindex 7b8d8c238c..719ec17018 100644--- a/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx+++ b/frontend-modern/src/components/Workloads/GuestDrawerOverview.tsx@@ -396,7 +396,10 @@ export function GuestDrawerOverview(props: GuestDrawerOverviewProps) {if (!memory || !hasReading || memory.usageUnavailable || !((memory.total ?? 0) > 0)) {return '';}- // The short qualifier sits on the size it qualifies; the full note (why,+ // A retained or undated reading is qualified in the chart; here it states+ // the size only, so no used amount reads as current.+ if (props.deferredMetrics?.memory) return `${formatBytes(memory.total ?? 0)} RAM`;+ // The short qualifier sits on the amount it qualifies; the full note (why,// and what to do) is the Details row "About this reading".const size = `${formatBytes(memory.used ?? 0)} of ${formatBytes(memory.total ?? 0)} RAM`;return memoryReading()?.mayIncludeCache ? `${size} (may include cache)` : size;diff --git a/frontend-modern/src/components/Workloads/NodeDrawer.test.tsx b/frontend-modern/src/components/Workloads/NodeDrawer.test.tsxindex 1079d3848b..9eef7b4938 100644--- a/frontend-modern/src/components/Workloads/NodeDrawer.test.tsx+++ b/frontend-modern/src/components/Workloads/NodeDrawer.test.tsx@@ -498,6 +498,25 @@ describe('NodeDrawer Overview charts', () => {expect(chart.querySelector('[data-history-threshold="memory"]')).toHaveClass('text-red-500');});+ it('states only the RAM size in the facts strip for retained node memory', () => {+ render(() => (+ <NodeDrawer+ node={makeNode({+ memory: {+ total: 8000,+ used: 3200,+ free: 4800,+ usage: 40,+ observation: { state: 'last-known', source: 'node-meminfo' },+ },+ })}+ />+ ));+ const facts = screen.getByTestId('node-drawer-facts');+ expect(facts).toHaveTextContent('RAM');+ expect(facts.textContent).not.toMatch(/ of .*RAM/);+ });+it('labels retained node memory as last known instead of live', async () => {chartsApiMocks.getMetricsHistory.mockResolvedValue(EMPTY_HISTORY);render(() => (diff --git a/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx b/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsxindex 56cc5031f0..dd8234950f 100644--- a/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx+++ b/frontend-modern/src/components/Workloads/NodeDrawerOverview.tsx@@ -547,7 +547,11 @@ export function NodeDrawerOverview(props: NodeDrawerOverviewProps) {[model, hasPositiveNumber(cores) ? `${cores} logical CPUs` : ''].filter(Boolean).join(' · '),sizeFact(props.node.memory?.total,- memoryValue() !== undefined ? props.node.memory?.used : undefined,+ // Only a current reading states a used amount; a retained one is+ // qualified in the chart and shows the size alone here.+ memoryValue() !== undefined && !deferredMetrics()?.memory+ ? props.node.memory?.used+ : undefined,'RAM',),diskMeasured() ? sizeFact(props.node.disk?.total, props.node.disk?.used, 'root disk') : '',diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.disk-provenance.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.disk-provenance.test.tsxindex 62f1012a27..783bd12592 100644--- a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.disk-provenance.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.disk-provenance.test.tsx@@ -1,12 +1,13 @@import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';import { createSignal } from 'solid-js';-import { afterEach, describe, expect, it, vi } from 'vitest';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { ChartsAPI, type AllMetricsHistoryResponse } from '@/api/charts';import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';import type { WorkloadGuest } from '@/types/workloads';import { GuestDrawerHistory } from '../GuestDrawerHistory';import { getGuestDrawerCurrentMetrics, getGuestDrawerDeferredMetrics } from '../guestDrawerModel';import { guestDiskDeferrals } from '../__fixtures__/guestDiskDeferrals';+import { GUEST_DRAWER_HISTORY_POLL_MS } from '../guestDrawerHistoryQuery';vi.mock('@/stores/license', () => ({loadRuntimeCapabilities: vi.fn(async () => undefined),@@ -14,12 +15,24 @@ vi.mock('@/stores/license', () => ({isRangeLocked: () => false,}));+beforeEach(() => {+ vi.useFakeTimers({ toFake: ['setInterval', 'clearInterval'] });+});afterEach(() => {+ vi.useRealTimers();cleanup();resetCreateNonSuspendingQueryCacheForTest();vi.restoreAllMocks();});+// The charts have no manual refresh while reads succeed; tests drive the+// 30-second poll on a fake interval clock (timeouts stay real for waitFor).+const settledHistory = () =>+ waitFor(() => {+ expect(ChartsAPI.getMetricsHistory).toHaveBeenCalled();+ expect(screen.queryByText('Loading history')).not.toBeInTheDocument();+ });+const guest = (reason: string, usage = 50): WorkloadGuest => ({id: 'fixture:pve-a:101',vmid: 101,@@ -292,13 +305,8 @@ describe('GuestDrawerHistory filesystem provenance', () => {.mockRejectedValueOnce(Object.assign(new Error('private refusal'), { status: 403 })).mockResolvedValueOnce(response());mount(() => guest('prev-vm-locked'));- await waitFor(() =>- expect(screen.getByRole('button', { name: 'Refresh history' })).toHaveAttribute(- 'aria-busy',- 'false',- ),- );- fireEvent.click(screen.getByRole('button', { name: 'Refresh history' }));+ await settledHistory();+ await vi.advanceTimersByTimeAsync(GUEST_DRAWER_HISTORY_POLL_MS);await waitFor(() =>expect(screen.getByRole('button', { name: 'Retry history' })).toBeInTheDocument(),);diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.gaps.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.gaps.test.tsxindex 295521efa9..6b5cc80dd2 100644--- a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.gaps.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.gaps.test.tsx@@ -1,16 +1,21 @@import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';import { createSignal } from 'solid-js';-import { afterEach, describe, expect, it, vi } from 'vitest';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { ChartsAPI, type AllMetricsHistoryResponse } from '@/api/charts';import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';import { GuestDrawerHistory } from '../GuestDrawerHistory';+import { GUEST_DRAWER_HISTORY_POLL_MS } from '../guestDrawerHistoryQuery';vi.mock('@/stores/license', () => ({loadRuntimeCapabilities: vi.fn(async () => undefined),maxHistoryDays: () => 90,isRangeLocked: () => false,}));+beforeEach(() => {+ vi.useFakeTimers({ toFake: ['setInterval', 'clearInterval'] });+});afterEach(() => {+ vi.useRealTimers();cleanup();resetCreateNonSuspendingQueryCacheForTest();vi.restoreAllMocks();@@ -47,7 +52,7 @@ const marks = (metric: string, id = 'utilization') =>group(id).querySelectorAll(`[data-history-observation="${metric}"]`);const note = (id = 'utilization') => group(id).querySelector('[data-history-gaps]');const mount = () => render(() => <GuestDrawerHistory target={target} range="1h" />);-const refresh = () => fireEvent.click(screen.getByRole('button', { name: 'Refresh history' }));+const refresh = () => vi.advanceTimersByTimeAsync(GUEST_DRAWER_HISTORY_POLL_MS);describe('drawer History does not join missing stored observations', () => {it('breaks only the affected metric and keeps isolated recovery observations visible', async () => {@@ -214,7 +219,7 @@ describe('drawer History does not join missing stored observations', () => {'aria-valuetext',expect.stringContaining('Memory no observation.'),);- refresh();+ await refresh();await waitFor(() => expect(note()).toBeNull());expect(group()).toBe(chart);expect(paths('#f59e0b')).toHaveLength(1);@@ -231,7 +236,7 @@ describe('drawer History does not join missing stored observations', () => {.mockRejectedValueOnce(Object.assign(new Error('private denial'), { status: 403 }));mount();await screen.findByRole('slider', { name: 'Inspect Utilization history' });- refresh();+ await refresh();await screen.findByRole('button', { name: 'Retry history' });expect(note()).toHaveTextContent('Memory, Disk');expect(paths('#10b981')).toHaveLength(0);diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.inspection.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.inspection.test.tsxindex 9984768f48..f4ba65479e 100644--- a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.inspection.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.inspection.test.tsx@@ -452,3 +452,37 @@ describe('drawer History on a phone', () => {expect(screen.getByTestId('history-phone-toggle')).toHaveTextContent('Show Network I/O');});});++describe('drawer History alert triggers', () => {+ it('labels the trigger in the legend and draws no line before any history exists', async () => {+ vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue({ ...response(), metrics: {} });+ render(() => (+ <GuestDrawerHistory+ target={target}+ range="24h"+ alerts={{ diskread: { severity: 'critical', value: 100 * 1024 * 1024 } }}+ />+ ));+ await screen.findAllByText('No stored history in this range');+ expect(document.querySelector('[data-history-threshold]')).toBeNull();+ expect(document.querySelector('[data-history-alert-label="diskread"]')).toHaveTextContent(+ /^alert at 100(\.0)? MB\/s$/,+ );+ });++ it('keeps a phone panel shown after the alert that revealed it clears', async () => {+ vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue(response());+ const [alerts, setAlerts] = createSignal<+ Record<string, { severity: 'warning' | 'critical'; value?: number } | undefined>+ >({ netin: { severity: 'warning', value: 1024 } });+ render(() => <GuestDrawerHistory target={target} range="24h" alerts={alerts()} />);+ const network = () =>+ screen+ .getAllByTestId('guest-history-group-chart')+ .find((chart) => chart.dataset.historyGroup === 'network')!;+ await screen.findAllByTestId('guest-history-group-chart');+ expect(network()).not.toHaveClass('max-sm:hidden');+ setAlerts({});+ expect(network()).not.toHaveClass('max-sm:hidden');+ });+});diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.memory-provenance.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.memory-provenance.test.tsxindex a3bd641608..a7722b4a67 100644--- a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.memory-provenance.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.memory-provenance.test.tsx@@ -1,6 +1,6 @@import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';import { createSignal } from 'solid-js';-import { afterEach, describe, expect, it, vi } from 'vitest';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { ChartsAPI, type AllMetricsHistoryResponse } from '@/api/charts';import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';import type { WorkloadGuest } from '@/types/workloads';@@ -11,17 +11,30 @@ import {getGuestDrawerMemoryRows,getGuestDrawerMemoryReading,} from '../guestDrawerModel';+import { GUEST_DRAWER_HISTORY_POLL_MS } from '../guestDrawerHistoryQuery';vi.mock('@/stores/license', () => ({loadRuntimeCapabilities: vi.fn(async () => undefined),maxHistoryDays: () => 90,isRangeLocked: () => false,}));+beforeEach(() => {+ vi.useFakeTimers({ toFake: ['setInterval', 'clearInterval'] });+});afterEach(() => {+ vi.useRealTimers();cleanup();resetCreateNonSuspendingQueryCacheForTest();vi.restoreAllMocks();});++// The charts have no manual refresh while reads succeed; tests drive the+// 30-second poll on a fake interval clock (timeouts stay real for waitFor).+const settledHistory = () =>+ waitFor(() => {+ expect(ChartsAPI.getMetricsHistory).toHaveBeenCalled();+ expect(screen.queryByText('Loading history')).not.toBeInTheDocument();+ });const original = '2026-10-04T14:00:00Z';const later = '2026-10-04T17:00:00Z';const annotation = (@@ -246,13 +259,8 @@ describe('guest memory original-observation provenance', () => {.mockResolvedValueOnce(response()).mockRejectedValueOnce(Object.assign(new Error('private backend refusal'), { status: 403 }));mount(() => guest(annotation('last-known')));- await waitFor(() =>- expect(screen.getByRole('button', { name: 'Refresh history' })).toHaveAttribute(- 'aria-busy',- 'false',- ),- );- fireEvent.click(screen.getByRole('button', { name: 'Refresh history' }));+ await settledHistory();+ await vi.advanceTimersByTimeAsync(GUEST_DRAWER_HISTORY_POLL_MS);await waitFor(() =>expect(screen.getByRole('button', { name: 'Retry history' })).toBeInTheDocument(),);diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.readout.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.readout.test.tsxindex efed674ef9..5ab19da12d 100644--- a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.readout.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.readout.test.tsx@@ -1,16 +1,21 @@import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';import { createSignal } from 'solid-js';-import { afterEach, describe, expect, it, vi } from 'vitest';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { ChartsAPI, type AllMetricsHistoryResponse } from '@/api/charts';import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';import { GuestDrawerHistory } from '../GuestDrawerHistory';+import { GUEST_DRAWER_HISTORY_POLL_MS } from '../guestDrawerHistoryQuery';vi.mock('@/stores/license', () => ({loadRuntimeCapabilities: vi.fn(async () => undefined),maxHistoryDays: () => 90,isRangeLocked: () => false,}));+beforeEach(() => {+ vi.useFakeTimers({ toFake: ['setInterval', 'clearInterval'] });+});afterEach(() => {+ vi.useRealTimers();cleanup();resetCreateNonSuspendingQueryCacheForTest();vi.restoreAllMocks();@@ -41,7 +46,7 @@ const group = (id = 'utilization') =>screen.getAllByTestId('guest-history-group-chart').find((el) => el.dataset.historyGroup === id)!;const readoutTime = (id = 'utilization') =>within(group(id)).getByTestId('guest-history-hover-time');-const refresh = () => fireEvent.click(screen.getByRole('button', { name: 'Refresh history' }));+const refresh = () => vi.advanceTimersByTimeAsync(GUEST_DRAWER_HISTORY_POLL_MS);const ready = () => screen.findByRole('slider', { name: 'Inspect Utilization history' });describe('drawer History default readout belongs to one stored time', () => {@@ -110,7 +115,7 @@ describe('drawer History default readout belongs to one stored time', () => {);expect(within(group()).queryByTestId('guest-history-hover-time')).toBeNull();fetch.mockResolvedValue(response({ cpu: [point(2, 22)] }));- refresh();+ await refresh();await waitFor(() => expect(group()).toHaveTextContent('CPU22.0%'));expect(group()).toHaveTextContent('Memoryno reading');expect(group()).toHaveTextContent('Diskno reading');@@ -137,7 +142,7 @@ describe('drawer History default readout belongs to one stored time', () => {expect(group()).not.toHaveTextContent('77.0%');expect(fetch).toHaveBeenCalledTimes(1);fetch.mockResolvedValue(response({ cpu: [point(2, 22)], memory: [point(3, 25)] }));- refresh();+ await refresh();await waitFor(() => expect(group()).toHaveTextContent('Memory25.0%'));expect(group()).toHaveTextContent('CPUno reading');expect(readoutTime()).toHaveAttribute('datetime', new Date(start + 180_000).toISOString());@@ -176,7 +181,7 @@ describe('drawer History default readout belongs to one stored time', () => {.mockRejectedValueOnce(Object.assign(new Error('private access detail'), { status: 403 }));render(() => <GuestDrawerHistory target={target} range="1h" />);await ready();- refresh();+ await refresh();await screen.findByRole('button', { name: 'Retry history' });expect(readoutTime()).toHaveAttribute('datetime', new Date(start + 120_000).toISOString());expect(group()).toHaveTextContent('Memoryno reading');diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.refresh.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.refresh.test.tsxindex db854a9504..a6157d513b 100644--- a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.refresh.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.refresh.test.tsx@@ -69,8 +69,8 @@ describe('GuestDrawerHistory refresh recovery', () => {expect(fetch.mock.calls[1][0]).toMatchObject({ ...target, range: '24h' });pending.resolve(response());await waitFor(() => expect(paths(container)).toHaveLength(1));- expect(retry).toHaveAttribute('aria-disabled', 'false');- expect(retry).toHaveAccessibleName('Refresh history');+ // The charts poll on their own; once recovered there is nothing to retry.+ expect(screen.queryByRole('button', { name: /history/i })).not.toBeInTheDocument();});it('retains only the current history on a failed poll and updates its already-mounted status region', async () => {@@ -92,7 +92,7 @@ describe('GuestDrawerHistory refresh recovery', () => {expect(screen.queryByText('Loading history')).not.toBeInTheDocument();});- it('keeps retry keyboard focus through successful recovery without losing retained points', async () => {+ it('moves keyboard focus into the history region when a successful retry removes its button', async () => {vi.useFakeTimers();const pending = deferred<AllMetricsHistoryResponse>();vi.spyOn(ChartsAPI, 'getMetricsHistory')@@ -110,35 +110,44 @@ describe('GuestDrawerHistory refresh recovery', () => {pending.resolve(response(12));await vi.advanceTimersByTimeAsync(0);expect(paths(container)[0]).not.toHaveAttribute('d', original);- expect(screen.getByRole('button', { name: 'Refresh history' })).toBe(retry);- expect(retry).toHaveFocus();+ expect(screen.queryByRole('button', { name: /history/i })).not.toBeInTheDocument();+ expect(screen.getByTestId('guest-history-region')).toHaveFocus();expect(screen.getByRole('status', { name: 'History refresh status' })).toBeEmptyDOMElement();});- it('settles retry loading when a background poll supersedes a slow manual refresh', async () => {+ it('settles a slow retry when a background poll supersedes it', async () => {vi.useFakeTimers();const pending = deferred<AllMetricsHistoryResponse>();const fetch = vi.spyOn(ChartsAPI, 'getMetricsHistory')- .mockResolvedValueOnce(response())+ .mockRejectedValueOnce(new Error('Unavailable')).mockReturnValueOnce(pending.promise).mockResolvedValueOnce(response(12));const { container } = render(() => <GuestDrawerHistory target={target} range="24h" />);await vi.advanceTimersByTimeAsync(0);- const refresh = screen.getByRole('button', { name: 'Refresh history' });- fireEvent.click(refresh);- expect(refresh).toHaveAttribute('aria-disabled', 'true');+ const retry = screen.getByRole('button', { name: 'Retry history' });+ fireEvent.click(retry);+ expect(retry).toHaveAttribute('aria-disabled', 'true');await vi.advanceTimersByTimeAsync(30_000);expect(fetch).toHaveBeenCalledTimes(3);expect(fetch.mock.calls[1][0].signal!.aborted).toBe(true);- expect(refresh).toHaveAttribute('aria-disabled', 'false');- expect(refresh).toHaveAttribute('aria-busy', 'false');+ // The poll recovered, so the retry control is gone rather than stuck busy.+ expect(screen.queryByRole('button', { name: /history/i })).not.toBeInTheDocument();const latest = paths(container)[0].getAttribute('d');pending.resolve(response(99));await vi.advanceTimersByTimeAsync(0);expect(paths(container)[0]).toHaveAttribute('d', latest);});+ it('offers no manual refresh while history loads normally', async () => {+ vi.useFakeTimers();+ vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValue(response());+ const { container } = render(() => <GuestDrawerHistory target={target} range="24h" />);+ await vi.advanceTimersByTimeAsync(0);+ expect(paths(container)).toHaveLength(1);+ expect(screen.queryByRole('button', { name: /history/i })).not.toBeInTheDocument();+ });+it('retains the failure after a failed retry and allows another attempt', async () => {vi.spyOn(ChartsAPI, 'getMetricsHistory').mockRejectedValueOnce(new Error('Unavailable'))@@ -297,7 +306,9 @@ describe('drawer History access failures', () => {await settleAccess();expect(accessPaths(view.container)).toHaveLength(1);expect(region).toBeEmptyDOMElement();- expect(retry).toHaveFocus();+ // Recovered: the Retry button goes, and keyboard focus stays in the charts.+ expect(screen.queryByRole('button', { name: 'Retry history' })).not.toBeInTheDocument();+ expect(screen.getByTestId('guest-history-region')).toHaveFocus();},);diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.sparse.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.sparse.test.tsxindex 36744c6f53..15e77f3237 100644--- a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.sparse.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.sparse.test.tsx@@ -1,10 +1,11 @@import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';import { createSignal } from 'solid-js';-import { afterEach, describe, expect, it, vi } from 'vitest';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import { ChartsAPI, type AllMetricsHistoryResponse, type HistoryTimeRange } from '@/api/charts';import { HOST_METRICS_HISTORY_GROUPS } from '@/components/shared/hostMetricsHistoryModel';import { resetCreateNonSuspendingQueryCacheForTest } from '@/hooks/createNonSuspendingQuery';import { GuestDrawerHistory } from '../GuestDrawerHistory';+import { GUEST_DRAWER_HISTORY_POLL_MS } from '../guestDrawerHistoryQuery';vi.mock('@/stores/license', () => ({loadRuntimeCapabilities: vi.fn(async () => undefined),@@ -12,12 +13,24 @@ vi.mock('@/stores/license', () => ({isRangeLocked: (range: HistoryTimeRange) => ['14d', '30d', '90d'].includes(range),}));+beforeEach(() => {+ vi.useFakeTimers({ toFake: ['setInterval', 'clearInterval'] });+});afterEach(() => {+ vi.useRealTimers();cleanup();resetCreateNonSuspendingQueryCacheForTest();vi.restoreAllMocks();});+// The charts have no manual refresh while reads succeed; tests drive the+// 30-second poll on a fake interval clock (timeouts stay real for waitFor).+const settledHistory = () =>+ waitFor(() => {+ expect(ChartsAPI.getMetricsHistory).toHaveBeenCalled();+ expect(screen.queryByText('Loading history')).not.toBeInTheDocument();+ });+const start = Date.UTC(2026, 9, 1, 11);const time = start + 30 * 60_000;const end = start + 60 * 60_000;@@ -56,12 +69,7 @@ describe('GuestDrawerHistory sparse observations and current provenance', () =>render(() => (<GuestDrawerHistory target={source()} range="1h" currentMetrics={{ memory: usage() }} />));- await waitFor(() =>- expect(screen.getByRole('button', { name: 'Refresh history' })).toHaveAttribute(- 'aria-busy',- 'false',- ),- );+ await settledHistory();const chart = group();setSource({ ...target });setUsage(35);@@ -260,7 +268,7 @@ describe('GuestDrawerHistory sparse observations and current provenance', () =>.mockResolvedValueOnce(response({ cpu: [point(time, 0), point(end, 5)] }));mount();await waitFor(() => expect(dots()).toHaveLength(1));- fireEvent.click(screen.getByRole('button', { name: 'Refresh history' }));+ await vi.advanceTimersByTimeAsync(GUEST_DRAWER_HISTORY_POLL_MS);await screen.findByText('History refresh failed. Showing previously loaded history.');expect(dots()).toHaveLength(1);expect(group()).toHaveTextContent('Single observation. No trend yet.');diff --git a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.window.test.tsx b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.window.test.tsxindex 2822bb2d6e..034d046980 100644--- a/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.window.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/GuestDrawerHistory.window.test.tsx@@ -9,6 +9,7 @@ import {getGuestDrawerHistoryRangeBounds,normalizeGuestDrawerHistoryPoints,} from '../guestDrawerModel';+import { GUEST_DRAWER_HISTORY_POLL_MS } from '../guestDrawerHistoryQuery';vi.mock('@/stores/license', () => ({loadRuntimeCapabilities: vi.fn(async () => undefined),@@ -107,6 +108,7 @@ describe('GuestDrawerHistory shared time window', () => {});it('retains the last fulfilled window with its data after a failed refresh', async () => {+ vi.useFakeTimers({ toFake: ['setInterval', 'clearInterval'] });vi.spyOn(ChartsAPI, 'getMetricsHistory').mockResolvedValueOnce(response()).mockRejectedValueOnce(new Error('Private fixture detail'));@@ -115,7 +117,7 @@ describe('GuestDrawerHistory shared time window', () => {const before = group('utilization').querySelector('path[data-history-series]')!.getAttribute('d');- fireEvent.click(screen.getByRole('button', { name: 'Refresh history' }));+ await vi.advanceTimersByTimeAsync(GUEST_DRAWER_HISTORY_POLL_MS);await screen.findByText('History refresh failed. Showing previously loaded history.');expect(group('utilization').querySelector('path[data-history-series]')).toHaveAttribute('d',diff --git a/frontend-modern/src/components/Workloads/__tests__/HistoryResponse.contract.test.tsx b/frontend-modern/src/components/Workloads/__tests__/HistoryResponse.contract.test.tsxindex 85cb5ee0f2..05a6e1c673 100644--- a/frontend-modern/src/components/Workloads/__tests__/HistoryResponse.contract.test.tsx+++ b/frontend-modern/src/components/Workloads/__tests__/HistoryResponse.contract.test.tsx@@ -7,6 +7,7 @@ import { useHistoryChartState } from '@/components/shared/useHistoryChartState';import type { WorkloadGuest } from '@/types/workloads';import { GuestDrawerHistory } from '../GuestDrawerHistory';import { useWorkloadTableMetricHistory } from '../useWorkloadTableMetricHistory';+import { GUEST_DRAWER_HISTORY_POLL_MS } from '../guestDrawerHistoryQuery';// Mock the transport, not ChartsAPI: every production consumer uses the real// response-admission boundary and its existing retention/error policy.@@ -78,7 +79,7 @@ describe('production History consumers reject unbound response evidence', () =>expect(plots(view.container)).toHaveLength(1);expect(view.container).toHaveTextContent('0.0%');transport.mockResolvedValueOnce({ ...body(), metrics: {} });- fireEvent.click(screen.getByRole('button', { name: 'Refresh history' }));+ await vi.advanceTimersByTimeAsync(GUEST_DRAWER_HISTORY_POLL_MS);await settle();expect(plots(view.container)).toHaveLength(0);expect(view.container).toHaveTextContent('No stored history in this range');@@ -91,7 +92,7 @@ describe('production History consumers reject unbound response evidence', () =>const view = render(() => <GuestDrawerHistory target={target} range="24h" />);await settle();transport.mockResolvedValueOnce({ ...body(97), resourceId: 'wrong-pbs' });- fireEvent.click(screen.getByRole('button', { name: 'Refresh history' }));+ await vi.advanceTimersByTimeAsync(GUEST_DRAWER_HISTORY_POLL_MS);await settle();expect(plots(view.container)).toHaveLength(1);expect(view.container).toHaveTextContent('42.0%');@@ -129,7 +130,7 @@ describe('production History consumers reject unbound response evidence', () =>const view = render(() => <GuestDrawerHistory target={target} range="24h" />);await settle();transport.mockResolvedValueOnce({ ...body(97), resourceId: 'wrong', status: 403 });- fireEvent.click(screen.getByRole('button', { name: 'Refresh history' }));+ await vi.advanceTimersByTimeAsync(GUEST_DRAWER_HISTORY_POLL_MS);await settle();expect(view.container).toHaveTextContent('previously loaded history');transport.mockRejectedValueOnce(Object.assign(new Error('private denial'), { status: 403 }));diff --git a/frontend-modern/src/components/Workloads/__tests__/drawerOverviewModel.test.ts b/frontend-modern/src/components/Workloads/__tests__/drawerOverviewModel.test.tsindex 9b6886b81d..457207f3b2 100644--- a/frontend-modern/src/components/Workloads/__tests__/drawerOverviewModel.test.ts+++ b/frontend-modern/src/components/Workloads/__tests__/drawerOverviewModel.test.ts@@ -74,6 +74,25 @@ describe('getDrawerChartAlerts', () => {});});+ it('maps disk temperature and storage capacity alerts onto the charts that show them', () => {+ expect(+ getDrawerChartAlerts(+ [+ alert({ type: 'diskTemperature', threshold: 55 }),+ alert({ type: 'usage', threshold: 90 }),+ ],+ ['smart_temp', 'usage'],+ ),+ ).toEqual({+ smart_temp: { severity: 'warning', value: 55 },+ usage: { severity: 'warning', value: 90 },+ });+ // A Proxmox disk's temperature alert reaches the same disk chart.+ expect(+ getDrawerChartAlerts([alert({ type: 'temperature', threshold: 60 })], ['smart_temp']),+ ).toEqual({ smart_temp: { severity: 'warning', value: 60 } });+ });+it('ignores alerts on metrics the drawer does not chart', () => {expect(getDrawerChartAlerts([alert({ type: 'diskWrite' })], ['cpu', 'memory'])).toEqual({});});diff --git a/frontend-modern/src/components/Workloads/drawerOverviewModel.ts b/frontend-modern/src/components/Workloads/drawerOverviewModel.tsindex c458f291c2..155eefe4c3 100644--- a/frontend-modern/src/components/Workloads/drawerOverviewModel.ts+++ b/frontend-modern/src/components/Workloads/drawerOverviewModel.ts@@ -42,6 +42,12 @@ const DRAWER_CHART_ALERT_TYPES: ReadonlyArray<{ type: string; metric: string; sc{ type: 'memory', metric: 'memory', scale: 1 },{ type: 'disk', metric: 'disk', scale: 1 },{ type: 'temperature', metric: 'temperature', scale: 1 },+ // A physical disk charts its temperature as smart_temp; Proxmox disks alert+ // as temperature and agent disks as diskTemperature.+ { type: 'temperature', metric: 'smart_temp', scale: 1 },+ { type: 'disktemperature', metric: 'smart_temp', scale: 1 },+ // Storage pools chart their capacity as usage, the alert's own metric.+ { type: 'usage', metric: 'usage', scale: 1 },{ type: 'diskread', metric: 'diskread', scale: 1024 * 1024 },{ type: 'diskwrite', metric: 'diskwrite', scale: 1024 * 1024 },{ type: 'networkin', metric: 'netin', scale: 1024 * 1024 },diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex 92dac51ef7..949c2cc2c6 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -330,6 +330,7 @@ import vsphereActivityTableSource from '@/features/vmware/VsphereActivityTable.timport vsphereAlertsTableSource from '@/features/vmware/VsphereAlertsTable.tsx?raw';import vsphereDatastoresTableSource from '@/features/vmware/VsphereDatastoresTable.tsx?raw';import vsphereNetworksTableSource from '@/features/vmware/VsphereNetworksTable.tsx?raw';+import dockerHostDrawerOverviewSource from '@/features/docker/DockerHostDrawerOverview.tsx?raw';const sharedSources = import.meta.glob(['./*.tsx', './cards/*.tsx', './responsive/*.tsx'], {query: '?raw',@@ -1319,6 +1320,12 @@ describe('shared primitive guardrails', () => {expect(source).not.toContain("value: 'history', label: 'History'");}expect(resourceDetailDrawerSource).not.toContain("activeTab() === 'history'");+ // Drawer charts draw triggers from the resource's own alerts; Needs+ // attention may list nested resources, the charts never do.+ expect(resourceDetailDrawerOverviewTabSource).toContain('getOwnAlertsForUnifiedResource(');+ expect(dockerHostDrawerOverviewSource).toContain('getOwnAlertsForUnifiedResource(');+ expect(dockerHostDrawerOverviewSource).toContain('getAlertAttentionCopy(alert, now)');+ expect(resourceDetailDrawerOverviewTabSource).toContain('getAlertAttentionCopy(alert, now)');// Range pickers name their options from one table, never a local list.expect(guestDrawerHistorySource).toContain('formatHistoryRangeOptionLabel(option)');expect(guestDrawerHistorySource).not.toContain('const formatRangeLabel');diff --git a/frontend-modern/src/features/docker/DockerHostDrawer.test.tsx b/frontend-modern/src/features/docker/DockerHostDrawer.test.tsxindex 479d6f3423..a628e3e7d4 100644--- a/frontend-modern/src/features/docker/DockerHostDrawer.test.tsx+++ b/frontend-modern/src/features/docker/DockerHostDrawer.test.tsx@@ -18,9 +18,11 @@ vi.mock('@/components/Workloads/GuestDrawerHistory', () => ({range: string;enabled?: boolean;onRangeChange?: (range: string) => void;+ alerts?: Record<string, unknown>;}) => (<divdata-testid="docker-host-history"+ data-alert-metrics={Object.keys(props.alerts ?? {}).join(',')}data-target={props.target.resourceId}data-range={props.range}data-enabled={String(props.enabled)}@@ -110,6 +112,24 @@ describe('DockerHostDrawer open alerts', () => {});describe('DockerHostDrawer history', () => {+ it("lists a container's memory alert but draws no trigger for it on the host's charts", () => {+ wsActiveAlerts.container = {+ ...openAlert(+ 'container',+ 'docker:docker-source-1/abc123',+ 'Container memory at 97%',+ 'critical',+ ),+ type: 'memory',+ threshold: 85,+ };+ render(() => <DockerHostDrawer host={host()} />);+ expect(screen.getByTestId('drawer-attention-section')).toHaveTextContent(+ 'Container memory at 97%',+ );+ expect(screen.getByTestId('docker-host-history')).toHaveAttribute('data-alert-metrics', '');+ });+it('charts history on Overview with its range picker, and pauses it behind Manage', () => {render(() => <DockerHostDrawer host={host()} />);expect(screen.queryByRole('tab', { name: 'History' })).toBeNull();diff --git a/frontend-modern/src/features/docker/DockerHostDrawerOverview.tsx b/frontend-modern/src/features/docker/DockerHostDrawerOverview.tsxindex 66cda41757..5189c5cd23 100644--- a/frontend-modern/src/features/docker/DockerHostDrawerOverview.tsx+++ b/frontend-modern/src/features/docker/DockerHostDrawerOverview.tsx@@ -19,10 +19,11 @@ import { useResourceDetailDrawerDockerActionsState } from '@/components/Infrastrimport { useWebSocket } from '@/contexts/appRuntime';import { hostOverrideIdCandidates } from '@/features/alerts/alertOverridesModel';import { alertTypeDisplayLabel } from '@/features/alerts/helpers';+import { getAlertAttentionCopy } from '@/features/alerts/metricAlertPresentation';import { areSystemSettingsLoaded, shouldHideDockerUpdateActions } from '@/stores/systemSettings';import { useAlertsActivation } from '@/stores/alertsActivation';import type { Resource } from '@/types/resource';-import { getAlertsForUnifiedResource } from '@/utils/alerts';+import { getAlertsForUnifiedResource, getOwnAlertsForUnifiedResource } from '@/utils/alerts';import {formatBytes,formatRelativeTime,@@ -192,6 +193,7 @@ export function DockerHostDrawerManagement(props: DockerHostDrawerOverviewProps)}export function DockerHostDrawerOverview(props: DockerHostDrawerOverviewProps) {+ const now = useRelativeTimeNow();const { activeAlerts } = useWebSocket();const alertsActivation = useAlertsActivation();const docker = () => props.host.docker;@@ -200,9 +202,11 @@ export function DockerHostDrawerOverview(props: DockerHostDrawerOverviewProps) {const summaryOnly = () => cleanText(docker()?.collectionMode) === 'typed-helper-summary';const hostAlerts = () =>getAlertsForUnifiedResource(props.host, activeAlerts, alertsActivation.detectionEnabled());+ // Needs attention lists the host's containers and services too; the charts+ // describe the host itself, so only its own alerts draw a trigger.const chartAlerts = () =>getDrawerChartAlerts(- hostAlerts(),+ getOwnAlertsForUnifiedResource(props.host, activeAlerts, alertsActivation.detectionEnabled()),(props.historyGroups ?? []).flatMap((group) => group.series.map((series) => series.metric)),);const temperatureThresholds = createMemo(() =>@@ -396,7 +400,7 @@ export function DockerHostDrawerOverview(props: DockerHostDrawerOverviewProps) {: []),...hostAlerts().map((alert) => ({id: alert.id,- message: alert.message,+ ...getAlertAttentionCopy(alert, now),subject: cleanText(alert.resourceName) || props.host.displayName || props.host.name,metric: alertTypeDisplayLabel(alert.type),severity: alert.level,diff --git a/frontend-modern/src/utils/__tests__/alerts.test.ts b/frontend-modern/src/utils/__tests__/alerts.test.tsindex f57a32613a..dd5994b993 100644--- a/frontend-modern/src/utils/__tests__/alerts.test.ts+++ b/frontend-modern/src/utils/__tests__/alerts.test.ts@@ -2,6 +2,7 @@ import { describe, expect, it } from 'vitest';import {getAlertsForResource,getAlertsForUnifiedResource,+ getOwnAlertsForUnifiedResource,getAlertStyles,getUnifiedResourceAlertStyles,} from '@/utils/alerts';@@ -288,6 +289,60 @@ describe('getAlertsForUnifiedResource', () => {expect(getAlertsForUnifiedResource(host, active, false)).toEqual([]);});+ it("matches a Docker container's alerts on its host and container ID, or its name", () => {+ const container = resource({+ id: 'app-container-b858bc8f1caf601a',+ type: 'app-container',+ name: 'sftp-ingest-2',+ metricsTarget: { resourceType: 'app-container', resourceId: 'aurora-3-a68e33cfc81c' },+ docker: { hostSourceId: 'aurora-3-mock', containerId: 'aurora-3-a68e33cfc81c' },+ } as Partial<Resource>);+ const active = byId(+ alert('memory', 'docker:aurora-3-mock/aurora-3-a68e33cfc81c', { type: 'memory' }),+ alert('host', 'docker:aurora-3-mock'),+ alert('other', 'docker:aurora-3-mock/aurora-3-ffffffffffff'),+ );+ expect(ids(getAlertsForUnifiedResource(container, active, true))).toEqual(['memory']);+ expect(ids(getOwnAlertsForUnifiedResource(container, active, true))).toEqual(['memory']);++ const unnamedId = resource({+ id: 'app-container-2',+ type: 'app-container',+ name: '/batch-job',+ docker: { hostSourceId: 'aurora-3-mock' },+ } as Partial<Resource>);+ expect(+ ids(+ getAlertsForUnifiedResource(+ unnamedId,+ byId(alert('by-name', 'docker:aurora-3-mock/name:batch-job')),+ true,+ ),+ ),+ ).toEqual(['by-name']);+ });++ it("keeps a host's own alerts apart from its containers' and disks' for charts", () => {+ const host = resource({+ id: 'agent-4406b8737ed55d92',+ agent: { agentId: 'app-platform-01' },+ docker: { hostSourceId: 'orion-2-mock' },+ } as Partial<Resource>);+ const active = byId(+ alert('own-cpu', 'agent:app-platform-01', { type: 'cpu' }),+ alert('own-offline', 'docker:orion-2-mock', { type: 'docker-host-offline' }),+ alert('container-memory', 'docker:orion-2-mock/orion-2-af2ca82947cd', { type: 'memory' }),+ alert('disk', 'agent:app-platform-01/disk:root', { type: 'disk' }),+ );+ expect(ids(getAlertsForUnifiedResource(host, active, true)).sort()).toEqual(+ ['container-memory', 'disk', 'own-cpu', 'own-offline'].sort(),+ );+ expect(ids(getOwnAlertsForUnifiedResource(host, active, true)).sort()).toEqual(+ ['own-cpu', 'own-offline'].sort(),+ );+ expect(getOwnAlertsForUnifiedResource(host, active, false)).toEqual([]);+ });+it('matches a Proxmox node agent by node id and by its linked agent key', () => {const node = resource({id: 'agent-85d79ff9b7a2cc0e',diff --git a/frontend-modern/src/utils/alerts.ts b/frontend-modern/src/utils/alerts.tsindex b292e10c40..0677a13fbf 100644--- a/frontend-modern/src/utils/alerts.ts+++ b/frontend-modern/src/utils/alerts.ts@@ -194,6 +194,16 @@ const getUnifiedResourceAlertKeys = (resource.canonicalIdentity?.supersededIds?.forEach(add);add(resource.proxmox?.sourceId);add(resource.metricsTarget?.resourceId);+ // The alert engine keys a Docker container's alerts on its host and+ // container ID ("docker:<host>/<container ID>"), or on its name when it has+ // no ID (internal/alerts DockerContainerResourceID).+ if (resource.type === 'app-container') {+ const dockerHostId = resource.docker?.hostSourceId?.trim();+ const containerId = resource.docker?.containerId?.trim();+ const containerName = resource.name?.trim().replace(/^\/+/, '');+ if (dockerHostId && containerId) add(`docker:${dockerHostId}/${containerId}`);+ else if (dockerHostId && containerName) add(`docker:${dockerHostId}/name:${containerName}`);+ }const machine = new Set<string>();if (resource.type === 'agent' || resource.type === 'docker-host') {@@ -243,6 +253,21 @@ export function getAlertsForUnifiedResource();}+/**+ * Alerts raised on the resource itself, not on anything nested under it (a+ * Docker host's containers and services, a machine's disks). A drawer chart+ * draws only these: a container's memory trigger is not its host's.+ */+export function getOwnAlertsForUnifiedResource(+ resource: Resource,+ activeAlerts: Record<string, Alert>,+ alertsEnabled: boolean | undefined = isAlertsDetectionEnabled(),+): Alert[] {+ if (!alertsEnabled) return [];+ const { exact } = getUnifiedResourceAlertKeys(resource);+ return Object.values(activeAlerts).filter((alert) => exact.has(alert.resourceId));+}+// Alert types representing binary or enumerated state conditions rather// than a metric crossing a threshold. For these, "current value vs// threshold" is meaningless (both come through as 0 from the backend) and