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
Make TrueNAS memory composition available to keyboard and touch
pulse-triage[bot]e40e87c18787
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex ab727162e9..3e03903d50 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -10621,3 +10621,26 @@ invalid instants. Browser proof must inspect the actual consuming record atdesktop and narrow widths, including UTC text, keyboard/touch disclosure andrefresh/recovery with the open record preserved. This is evidence inspection,not original incident recovery.++### TrueNAS memory composition is inspectable without hover++The existing TrueNAS system memory bar opts in to a resource-named native button+and the shared accessible Dialog. Keyboard and touch expose the same live+`stackedMemoryBarModel` rows as pointer hover, not a second calculation or a+snapshot captured when opening. A measured zero stays zero, percentage-only+readings do not acquire byte/free/cache rows, and absent ARC never gains a+fabricated cache row. Metric withdrawal removes its open breakdown. The native+button stops the enclosing system-row action; closing/Escape/backdrop returns+focus through the existing dialog owner. Its 44px phone target and wrapping+labels must fit narrow viewports. Shared hover suppression remains unchanged;+other consumers do not opt in automatically. No collector, freshness, alert,+permission, API call, polling cadence or native recovery guarantee changes.++Normal-suite `TrueNASSystemMemory.test.tsx` uses the actual table, bar, model and+dialog for known/missing/zero cache, measured zero, percent-only/unreported+readings, live resource changes, row isolation and unavailable withdrawal.+`StackedMemoryBar.test.tsx` retains unavailable explanations without fabricated+usage and `Dialog.test.tsx` owns modal isolation/focus. Browser proof exercises+the consuming TrueNAS table with ordinary keyboard/phone taps, hover parity,+updates and dismissal, and natively inspected desktop/narrow pixels. This repairs+composition access, not the reporter's missing native ARC or I/O/History source.diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 4b1ecce048..7c315b07a6 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -4600,3 +4600,26 @@ percentage-only evidence, severity and live current/retained/unavailable changesDesktop/narrow consuming proof uses production poll/broadcast frames throughcanonical resource and Workloads projection. No collection, query, resourceidentity, read cadence or native guest operation changes.++### TrueNAS memory composition is inspectable without hover++The existing TrueNAS system memory bar opts in to a resource-named native button+and the shared accessible Dialog. Keyboard and touch expose the same live+`stackedMemoryBarModel` rows as pointer hover, not a second calculation or a+snapshot captured when opening. A measured zero stays zero, percentage-only+readings do not acquire byte/free/cache rows, and absent ARC never gains a+fabricated cache row. Metric withdrawal removes its open breakdown. The native+button stops the enclosing system-row action; closing/Escape/backdrop returns+focus through the existing dialog owner. Its 44px phone target and wrapping+labels must fit narrow viewports. Shared hover suppression remains unchanged;+other consumers do not opt in automatically. No collector, freshness, alert,+permission, API call, polling cadence or native recovery guarantee changes.++Normal-suite `TrueNASSystemMemory.test.tsx` uses the actual table, bar, model and+dialog for known/missing/zero cache, measured zero, percent-only/unreported+readings, live resource changes, row isolation and unavailable withdrawal.+`StackedMemoryBar.test.tsx` retains unavailable explanations without fabricated+usage and `Dialog.test.tsx` owns modal isolation/focus. Browser proof exercises+the consuming TrueNAS table with ordinary keyboard/phone taps, hover parity,+updates and dismissal, and natively inspected desktop/narrow pixels. This repairs+composition access, not the reporter's missing native ARC or I/O/History source.diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 8c12b0b6a1..4daf4c28c3 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -8985,3 +8985,26 @@ invalid instants. Browser proof must inspect the actual consuming record atdesktop and narrow widths, including UTC text, keyboard/touch disclosure andrefresh/recovery with the open record preserved. This is evidence inspection,not original incident recovery.++### TrueNAS memory composition is inspectable without hover++The existing TrueNAS system memory bar opts in to a resource-named native button+and the shared accessible Dialog. Keyboard and touch expose the same live+`stackedMemoryBarModel` rows as pointer hover, not a second calculation or a+snapshot captured when opening. A measured zero stays zero, percentage-only+readings do not acquire byte/free/cache rows, and absent ARC never gains a+fabricated cache row. Metric withdrawal removes its open breakdown. The native+button stops the enclosing system-row action; closing/Escape/backdrop returns+focus through the existing dialog owner. Its 44px phone target and wrapping+labels must fit narrow viewports. Shared hover suppression remains unchanged;+other consumers do not opt in automatically. No collector, freshness, alert,+permission, API call, polling cadence or native recovery guarantee changes.++Normal-suite `TrueNASSystemMemory.test.tsx` uses the actual table, bar, model and+dialog for known/missing/zero cache, measured zero, percent-only/unreported+readings, live resource changes, row isolation and unavailable withdrawal.+`StackedMemoryBar.test.tsx` retains unavailable explanations without fabricated+usage and `Dialog.test.tsx` owns modal isolation/focus. Browser proof exercises+the consuming TrueNAS table with ordinary keyboard/phone taps, hover parity,+updates and dismissal, and natively inspected desktop/narrow pixels. This repairs+composition access, not the reporter's missing native ARC or I/O/History source.diff --git a/frontend-modern/src/components/Workloads/StackedMemoryBar.test.tsx b/frontend-modern/src/components/Workloads/StackedMemoryBar.test.tsxindex 0a07147148..626ac846a8 100644--- a/frontend-modern/src/components/Workloads/StackedMemoryBar.test.tsx+++ b/frontend-modern/src/components/Workloads/StackedMemoryBar.test.tsx@@ -1,5 +1,5 @@import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';-import { render, screen, cleanup } from '@solidjs/testing-library';+import { render, screen, cleanup, fireEvent, within } from '@solidjs/testing-library';import { createSignal } from 'solid-js';import type { MemoryObservationPresentation } from '@/utils/memoryObservation';import { StackedMemoryBar } from './StackedMemoryBar';@@ -55,6 +55,29 @@ describe('StackedMemoryBar', () => {expect(getSegments(container)).toHaveLength(0);});+ it('keeps unavailable usage and its explanation in the opted-in accessible breakdown', () => {+ render(() => (+ <StackedMemoryBar+ used={0}+ total={32 * 1024 ** 3}+ cache={20 * 1024 ** 3}+ reading={{ state: 'unavailable', message: 'No current memory reading.' }}+ detailsLabel="Memory composition for unavailable host"+ />+ ));+ fireEvent.click(+ screen.getByRole('button', { name: 'Memory composition for unavailable host' }),+ );+ const dialog = screen.getByRole('dialog');+ expect(within(dialog).getByText('Unavailable', { exact: true })).toBeInTheDocument();+ expect(within(dialog).getByText('No current memory reading.')).toBeInTheDocument();+ expect(within(dialog).getByText('Total', { exact: true }).nextElementSibling).toHaveTextContent(+ '32.0 GB',+ );+ expect(within(dialog).queryByText('Free', { exact: true })).toBeNull();+ expect(within(dialog).queryByText('Reclaimable cache')).toBeNull();+ });+it.each(['last-known', 'unknown'] as const)('uses neutral %s bars and restores live decoration only with a current reading',(state) => {diff --git a/frontend-modern/src/components/Workloads/StackedMemoryBar.tsx b/frontend-modern/src/components/Workloads/StackedMemoryBar.tsxindex a049d0c2fa..86cd886b3f 100644--- a/frontend-modern/src/components/Workloads/StackedMemoryBar.tsx+++ b/frontend-modern/src/components/Workloads/StackedMemoryBar.tsx@@ -1,5 +1,6 @@-import { Show, For } from 'solid-js';+import { Show, For, createSignal } from 'solid-js';import { AnimatedNumber } from '@/components/shared/AnimatedNumber';+import { Dialog } from '@/components/shared/Dialog';import { TooltipPortal } from '@/components/shared/TooltipPortal';import { formatPercent } from '@/utils/format';import { type StackedMemoryBarProps } from './stackedMemoryBarModel';@@ -8,6 +9,8 @@ import { useStackedMemoryBarState } from './useStackedMemoryBarState';export function StackedMemoryBar(props: StackedMemoryBarProps) {const state = useStackedMemoryBarState(props);const presentation = state.presentation;+ const [detailsOpen, setDetailsOpen] = createSignal(false);+ let detailsTrigger: HTMLButtonElement | undefined;const swapBarWidth = () => String(Math.max(0, Math.min(presentation().swapBarPercent, 100)));const segmentEdge = (leftPercent: number, widthPercent: number) =>String(Math.max(0, Math.min(leftPercent + widthPercent, 100)));@@ -15,13 +18,11 @@ export function StackedMemoryBar(props: StackedMemoryBarProps) {return (<divref={state.setContainerRef}- class="metric-text w-full h-4 flex items-center justify-center"+ class={`metric-text relative w-full flex items-center justify-center ${props.detailsLabel ? 'h-11 sm:h-6' : 'h-4'}`}+ onMouseEnter={state.handleMouseEnter}+ onMouseLeave={state.handleMouseLeave}>- <div- class="relative w-full h-full overflow-hidden bg-surface-hover rounded-sm"- onMouseEnter={state.handleMouseEnter}- onMouseLeave={state.handleMouseLeave}- >+ <div class="relative w-full h-4 overflow-hidden bg-surface-hover rounded-sm"><svgaria-hidden="true"class="absolute inset-0 h-full w-full"@@ -94,7 +95,65 @@ export function StackedMemoryBar(props: StackedMemoryBarProps) {</span></div>- <TooltipPortal when={state.tooltipVisible()} x={state.tip.pos().x} y={state.tip.pos().y}>+ <Show when={props.detailsLabel}>+ {(label) => (+ <>+ <button+ ref={detailsTrigger}+ type="button"+ class="absolute inset-0 w-full cursor-pointer rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-blue-500"+ aria-label={label()}+ aria-haspopup="dialog"+ aria-expanded={detailsOpen()}+ onClick={(event) => {+ event.stopPropagation();+ state.tip.setShow(false);+ setDetailsOpen(true);+ }}+ />+ <Dialog+ isOpen={detailsOpen()}+ onClose={() => setDetailsOpen(false)}+ returnFocus={() => detailsTrigger}+ ariaLabel={label()}+ panelClass="max-w-sm"+ >+ <div class="overflow-y-auto p-4 text-sm">+ <h2 class="mb-3 whitespace-normal font-semibold text-base-content">{label()}</h2>+ <Show when={presentation().tooltipMessage}>+ <p class="mb-3 whitespace-normal text-muted">{presentation().tooltipMessage}</p>+ </Show>+ <dl>+ <For each={presentation().tooltipRows}>+ {(row) => (+ <div+ class="flex flex-wrap justify-between gap-x-4 gap-y-1 py-2"+ classList={{ 'border-t border-border': row.borderTop }}+ >+ <dt class={`whitespace-normal ${row.labelClass}`}>{row.label}</dt>+ <dd class="whitespace-nowrap text-base-content">{row.value}</dd>+ </div>+ )}+ </For>+ </dl>+ <button+ type="button"+ class="mt-3 min-h-11 w-full rounded-sm border border-border px-3 text-base-content hover:bg-surface-hover focus-visible:outline-2 focus-visible:outline-blue-500"+ onClick={() => setDetailsOpen(false)}+ >+ Close+ </button>+ </div>+ </Dialog>+ </>+ )}+ </Show>++ <TooltipPortal+ when={!detailsOpen() && state.tooltipVisible()}+ x={state.tip.pos().x}+ y={state.tip.pos().y}+ ><div class="min-w-[140px]"><div class="font-medium mb-1 text-base-content border-b border-border pb-1">{presentation().tooltipTitle}diff --git a/frontend-modern/src/components/Workloads/stackedMemoryBarModel.ts b/frontend-modern/src/components/Workloads/stackedMemoryBarModel.tsindex cae008ad2b..a496eb7f75 100644--- a/frontend-modern/src/components/Workloads/stackedMemoryBarModel.ts+++ b/frontend-modern/src/components/Workloads/stackedMemoryBarModel.ts@@ -31,6 +31,8 @@ export interface StackedMemoryBarProps {/** Render a direct used-vs-total comparison instead of composition/free rows. */comparisonTotalLabel?: string;tooltipTitle?: string;+ /** Opt in to a keyboard/touch breakdown, named by the consuming resource. */+ detailsLabel?: string;}export interface StackedMemorySegment {diff --git a/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsx b/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsxindex 6b47ddc64c..db6fa39884 100644--- a/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsx+++ b/frontend-modern/src/features/truenas/TrueNASSystemsTable.tsx@@ -409,6 +409,7 @@ export const TrueNASSystemsTable: Component<{total={memoryTotal()}cache={memoryCache()}cacheInclusiveLabel="Used with ARC cache"+ detailsLabel={`Memory composition for ${name()}`}percentOnly={memoryPercentOnly()}thresholds={memoryThresholds()}/>diff --git a/frontend-modern/src/features/truenas/__tests__/TrueNASSystemMemory.test.tsx b/frontend-modern/src/features/truenas/__tests__/TrueNASSystemMemory.test.tsxnew file mode 100644index 0000000000..d95e0b4bce--- /dev/null+++ b/frontend-modern/src/features/truenas/__tests__/TrueNASSystemMemory.test.tsx@@ -0,0 +1,162 @@+import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';+import { createStore } from 'solid-js/store';+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';+import { StackedMemoryBar } from '@/components/Workloads/StackedMemoryBar';+import type { Resource } from '@/types/resource';+import { TrueNASSystemsTable } from '../TrueNASSystemsTable';++vi.mock('@/contexts/appRuntime', () => ({+ useWebSocket: () => ({ activeAlerts: {} }),+}));+vi.mock('@/stores/alertsActivation', () => ({+ useAlertsActivation: () => ({+ detectionEnabled: () => true,+ getMetricThresholds: () => ({ warning: 80, critical: 85 }),+ }),+}));++const GB = 1024 ** 3;+const system = (overrides: Partial<Resource> = {}): Resource => ({+ id: 'nas-core',+ name: 'nas-core',+ type: 'agent',+ platformId: 'nas-core',+ platformType: 'truenas',+ sourceType: 'api',+ status: 'online',+ lastSeen: 1_700_000_000_000,+ cpu: { current: 12 },+ memory: { current: 31.25, used: 10 * GB, total: 32 * GB },+ agent: { osVersion: 'TrueNAS-13.3', memory: { cache: 20 * GB } },+ ...overrides,+});++function mount(resources = [system()]) {+ const [systems, setSystems] = createStore(resources);+ const result = render(() => (+ <TrueNASSystemsTable+ systems={systems}+ scope={systems}+ emptyIcon={<span />}+ emptyTitle="No systems"+ emptyDescription="No systems"+ showToolbar={false}+ />+ ));+ return { ...result, setSystems };+}++const rowValue = (dialog: HTMLElement, label: string) =>+ within(dialog).getByText(label, { exact: true }).nextElementSibling;++beforeEach(() => {+ vi.stubGlobal(+ 'ResizeObserver',+ class {+ observe() {}+ unobserve() {}+ disconnect() {}+ },+ );+});+afterEach(() => {+ cleanup();+ vi.unstubAllGlobals();+});++describe('TrueNAS system memory inspection through the actual table', () => {+ it('opens the existing composition without expanding the system and returns focus on Escape', async () => {+ const { container } = mount();+ const trigger = screen.getByRole('button', { name: 'Memory composition for nas-core' });+ expect(trigger).toHaveAttribute('aria-haspopup', 'dialog');+ expect(trigger).toHaveAttribute('aria-expanded', 'false');+ trigger.focus();+ fireEvent.click(trigger);+ const dialog = screen.getByRole('dialog', { name: 'Memory composition for nas-core' });+ expect(trigger).toHaveAttribute('aria-expanded', 'true');+ expect(rowValue(dialog, 'Used')).toHaveTextContent('10.0 GB');+ expect(rowValue(dialog, 'Reclaimable cache')).toHaveTextContent('20.0 GB');+ expect(rowValue(dialog, 'Free')).toHaveTextContent('2.00 GB');+ expect(rowValue(dialog, 'Used with ARC cache')).toHaveTextContent('94%');+ expect(container.querySelector('[data-inline-platform-resource-detail-for]')).toBeNull();+ await waitFor(() =>+ expect(within(dialog).getByRole('button', { name: 'Close' })).toHaveFocus(),+ );+ fireEvent.keyDown(document, { key: 'Escape' });+ expect(screen.queryByRole('dialog')).toBeNull();+ expect(trigger).toHaveFocus();+ expect(trigger).toHaveAttribute('aria-expanded', 'false');+ });++ it.each([undefined, 0])('does not invent an ARC row for cache %s', (cache) => {+ mount([+ system({+ memory: { current: 93.75, used: 30 * GB, total: 32 * GB },+ agent: { memory: cache === undefined ? undefined : { cache } },+ }),+ ]);+ fireEvent.click(screen.getByRole('button', { name: 'Memory composition for nas-core' }));+ const dialog = screen.getByRole('dialog');+ expect(rowValue(dialog, 'Used')).toHaveTextContent('30.0 GB');+ expect(rowValue(dialog, 'Free')).toHaveTextContent('2.00 GB');+ expect(within(dialog).queryByText('Reclaimable cache')).toBeNull();+ expect(within(dialog).queryByText('Used with ARC cache')).toBeNull();+ fireEvent.click(within(dialog).getByRole('button', { name: 'Close' }));+ expect(screen.queryByRole('dialog')).toBeNull();+ });++ it('retains a measured zero and does not turn percentage-only readings into bytes', () => {+ mount([+ system({+ id: 'zero',+ name: 'zero',+ memory: { current: 0, used: 0, total: 32 * GB },+ agent: {},+ }),+ system({ id: 'percent', name: 'percent', memory: { current: 73 }, agent: {} }),+ ]);+ fireEvent.click(screen.getByRole('button', { name: 'Memory composition for zero' }));+ let dialog = screen.getByRole('dialog');+ expect(rowValue(dialog, 'Used')).toHaveTextContent('0 B');+ expect(rowValue(dialog, 'Free')).toHaveTextContent('32.0 GB');+ fireEvent.click(within(dialog).getByRole('button', { name: 'Close' }));+ fireEvent.click(screen.getByRole('button', { name: 'Memory composition for percent' }));+ dialog = screen.getByRole('dialog');+ expect(rowValue(dialog, 'Utilization')).toHaveTextContent('73%');+ expect(within(dialog).queryByText('Used', { exact: true })).toBeNull();+ expect(within(dialog).queryByText('Free', { exact: true })).toBeNull();+ expect(within(dialog).queryByText('Reclaimable cache')).toBeNull();+ });++ it('updates the open record from its owning resource and withdraws unavailable metrics', () => {+ const { setSystems } = mount();+ const trigger = screen.getByRole('button', { name: 'Memory composition for nas-core' });+ fireEvent.click(trigger);+ const dialog = screen.getByRole('dialog');+ setSystems(0, 'memory', 'used', 12 * GB);+ setSystems(0, 'agent', 'memory', 'cache', 18 * GB);+ expect(screen.getByRole('dialog')).toBe(dialog);+ expect(screen.getByRole('button', { name: 'Memory composition for nas-core' })).toBe(trigger);+ expect(rowValue(dialog, 'Used')).toHaveTextContent('12.0 GB');+ expect(rowValue(dialog, 'Reclaimable cache')).toHaveTextContent('18.0 GB');+ expect(rowValue(dialog, 'Free')).toHaveTextContent('2.00 GB');+ setSystems(0, 'agent', 'memory', 'cache', undefined);+ expect(within(dialog).queryByText('Reclaimable cache')).toBeNull();+ expect(rowValue(dialog, 'Free')).toHaveTextContent('20.0 GB');+ setSystems(0, 'status', 'offline');+ expect(screen.queryByRole('dialog')).toBeNull();+ expect(screen.queryByRole('button', { name: 'Memory composition for nas-core' })).toBeNull();+ expect(document.body.style.overflow).not.toBe('hidden');+ });++ it('offers no composition from an unreported metric or disconnected system', () => {+ mount([system({ memory: undefined }), system({ id: 'offline', status: 'offline' })]);+ expect(screen.queryByRole('button', { name: /Memory composition for/ })).toBeNull();+ });++ it('leaves non-opted-in shared bars without new controls', () => {+ render(() => <StackedMemoryBar used={10 * GB} total={32 * GB} cache={20 * GB} />);+ expect(screen.queryByRole('button')).toBeNull();+ expect(screen.queryByRole('dialog')).toBeNull();+ });+});diff --git a/frontend-modern/src/features/truenas/__tests__/TrueNASSystemsTable.test.tsx b/frontend-modern/src/features/truenas/__tests__/TrueNASSystemsTable.test.tsxindex 0fcaff7766..36c9ed863f 100644--- a/frontend-modern/src/features/truenas/__tests__/TrueNASSystemsTable.test.tsx+++ b/frontend-modern/src/features/truenas/__tests__/TrueNASSystemsTable.test.tsx@@ -2,7 +2,9 @@ import { cleanup, fireEvent, render, screen, within } from '@solidjs/testing-libimport { afterEach, describe, expect, it, vi } from 'vitest';vi.mock('@/components/Workloads/StackedMemoryBar', () => ({- StackedMemoryBar: () => <div data-testid="stacked-memory-bar" />,+ StackedMemoryBar: (props: { detailsLabel?: string }) => (+ <div data-testid="stacked-memory-bar" data-details-label={props.detailsLabel} />+ ),}));vi.mock('@/components/shared/responsive', () => ({@@ -51,6 +53,33 @@ afterEach(() => {});describe('TrueNASSystemsTable', () => {+ it('names each inspectable memory record after its own system rather than its connection', () => {+ const systems = [+ makeSystem({ id: 'nas-1', name: 'core-east' }),+ makeSystem({ id: 'nas-2', name: 'core-west' }),+ ];+ const { container } = render(() => (+ <TrueNASSystemsTable+ systems={systems}+ scope={systems}+ emptyIcon={<span />}+ emptyTitle="No systems"+ emptyDescription="No systems"+ showToolbar={false}+ />+ ));+ for (const [id, name] of [+ ['nas-1', 'core-east'],+ ['nas-2', 'core-west'],+ ]) {+ expect(+ container.querySelector(+ `[data-truenas-system-row="${id}"] [data-testid="stacked-memory-bar"]`,+ ),+ ).toHaveAttribute('data-details-label', `Memory composition for ${name}`);+ }+ });+it('updates both the reading and compact temperature heading with the display preference', async () => {temperatureStore.setUnit('celsius');const system = makeSystem({ id: 'nas-temperature', temperature: 40 });