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
fix(frontend): reveal inline drawers on row focus
rcourtman8189903ea8ab
diff --git a/docs/release-control/v6/internal/subsystems/cloud-paid.md b/docs/release-control/v6/internal/subsystems/cloud-paid.mdindex b9f55d2a42..01d3209991 100644--- a/docs/release-control/v6/internal/subsystems/cloud-paid.md+++ b/docs/release-control/v6/internal/subsystems/cloud-paid.md@@ -136,6 +136,12 @@ Legacy Cloud plan aliases are now expected to canonicalize to the `cloud_*`contract not only when Stripe metadata is parsed, but also when persisted planversions are consumed at hosted entitlement and workspace-limit enforcementboundaries.+That same hosted browser bootstrap boundary now owns browser-only lifecycle+attachment too. `frontend-modern/src/useAppRuntimeState.ts` must register its+auth bootstrap, theme sync, and post-reconnect hosted refresh work through+Solid `onMount(...)` inside the runtime owner instead of letting `App.tsx`,+`AppLayout.tsx`, or module-evaluation side effects reach directly into browser+APIs before the hosted shell has mounted.Persisted billing state is now also part of that canonical boundary: when arecognized Cloud/MSP plan version is loaded or saved, the stored `plan_version`must canonicalize and `limits.max_monitored_systems` must reconcile to the authoritative@@ -1009,3 +1015,9 @@ Until thatcandidate lane lands, newcommercial account work must extend the governed Pulse account shape ratherthan spawning additional one-off recovery or billing pages.+The same owned shell/runtime boundary also keeps signed-in bootstrap free of+feature-local telemetry collectors. `frontend-modern/src/useAppRuntimeState.ts`+may start shared app-shell services, auth refresh, and websocket recovery, but+it must not boot a storage-only disk history collector now that storage+drawers read the canonical backend metrics-history contract through shared+chart primitives.diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.mdindex d464537c04..49336a07ff 100644--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md@@ -148,8 +148,8 @@ work extends shared components instead of creating new local variants.7. Keep top-of-page summary interaction on shared primitives. Infrastructure, workloads, and storage summary cards must route sticky-shell behavior through `frontend-modern/src/components/shared/StickySummarySection.tsx` and route row-hover or focused-series rendering through shared chart primitives such as `frontend-modern/src/components/shared/InteractiveSparkline.tsx` and `frontend-modern/src/components/shared/DensityMap.tsx`, rather than page-local sticky wrappers or metric-card-specific hover logic.8. Keep summary chart interaction identity on one shared helper. Summary surfaces that expose row-hover, group-hover, chart-hover, or route-focus-driven chart emphasis must derive page/group/entity scope through `frontend-modern/src/components/shared/summaryCardInteraction.ts` and pass that same resolved scope into card-state, sparkline, and density-map primitives, rather than letting cards read `hovered || focused` while charts listen to a different page-local ID source. Hovering one summary chart must promote that series into the shared active entity so sibling cards highlight the same object instead of keeping chart-local hover islands, and hovering a grouped header must scope every card to that group without forking a workloads-local summary filter path.9. Keep page summaries page-scoped when table rows enter contextual focus. Route-backed row selection may add a focused label and shared series emphasis, but infrastructure, workloads, and storage summary cards must continue to render the page-level series set instead of collapsing the summary down to the selected row or replacing the global trend view with row-local empty states.-10. Keep contextual row focus on the shared summary primitive. Summary surfaces and same-route table drill-ins must reuse `frontend-modern/src/components/shared/contextualFocus.ts` for interactive-series filtering, focused-name lookup, active-series derivation, and local scroll preservation instead of rebuilding page-local `Set` filters, focused-label scans, or ad hoc scroll restoration in each surface.-11. Keep summary-to-table coordination deliberate and reversible. Shared summary hover may highlight the matching table row when it is already visible, but transient chart hover must not auto-filter tables, auto-scroll the page, or reshuffle table ordering. When the active row is off-screen, page owners must route through `frontend-modern/src/components/shared/summaryTableFocus.ts` and surface a lightweight `Jump to row` affordance that reveals and scrolls only on explicit user action.+10. Keep contextual row focus on the shared summary primitive. Summary surfaces and same-route table drill-ins must reuse `frontend-modern/src/components/shared/contextualFocus.ts` for interactive-series filtering, focused-name lookup, active-series derivation, local scroll preservation, and deliberate inline-detail reveal instead of rebuilding page-local `Set` filters, focused-label scans, drawer-aware scroll math, or ad hoc scroll restoration in each surface.+11. Keep summary-to-table coordination deliberate and reversible. Shared summary hover may highlight the matching table row when it is already visible, but transient chart hover must not auto-filter tables, auto-scroll the page, or reshuffle table ordering. When the active row is off-screen, page owners must route through `frontend-modern/src/components/shared/summaryTableFocus.ts` and surface a lightweight `Jump to row` affordance that reveals and scrolls only on explicit user action. Deliberate row focus may reveal inline detail automatically, but that reveal must be drawer-aware: preserve already-good positions, avoid hard centering, and scroll only enough to keep the row header plus the top of the inline detail visible.12. Keep summary-linked table row emphasis on the shared primitive contract. Workloads, infrastructure, and storage rows that mirror the active summary entity must expose that state through `data-summary-row-active` and let the shared presentation in `frontend-modern/src/index.css` render the row emphasis, rather than carrying page-local sky or blue fill classes inside each row renderer.13. Keep retained-value data loading honest at the ownership boundary. Helpersthat prevent a feature surface from falling through the app-level Suspense@@ -1705,3 +1705,9 @@ detail presenters must describe the actual capability or identity gap thatprevents history from rendering, rather than reviving agent-install guidanceon API-backed platforms like TrueNAS when the canonical disk metrics target isalready the owning history path.+That same shared chart primitive boundary now also owns physical-disk live I/O+drawers. `frontend-modern/src/components/Storage/DiskDetail.tsx` must render+read, write, and busy charts through `HistoryChart` plus+`useHistoryChartState`, using the canonical physical-disk history resource id,+instead of reviving `diskMetricsHistory`, a page-local ring buffer, or another+storage-only live chart primitive for the same telemetry.diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 812cb96558..2f34ba9e0a 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -238,6 +238,13 @@ scroll-preserving row focus must extend`frontend-modern/src/components/shared/contextualFocus.ts` instead ofrebuilding page-local `Set` scans or scroll repair logic in dashboard,infrastructure, or workloads hot paths.+That same hot-path ownership now also covers deliberate inline-detail reveal.+When a focused workload or infrastructure row opens its inline detail, the hot+path may preserve scroll across same-route state writes, but the actual reveal+must still flow through the shared contextual-focus and summary-table helpers,+mark the movement as deliberate so route-state restore does not replay over it,+and scroll only enough to keep the row header plus the top of the detail+visible instead of hard-centering every expansion.That same hot-path ownership now includes summary cache invalidation.Infrastructure and workload summary caches may hydrate charts for fast remounts,but when the summary chart timeline contract changes, the cache version must@@ -640,3 +647,9 @@ constructor critical path. `NewStore` may initialize schema and return a usablestore, but restart-time retention cleanup and one-time auto-vacuum migrationmust run through the background worker so large historical databases do notblock application startup before the metrics store is even available.+That same metrics hot path now also owns compact physical-disk drawer charts.+Thirty-minute storage detail charts must query the same in-memory plus+store-backed disk history path as longer-term disk charts, with the backend+doing range selection and fallback. Feature-local polling loops or browser-side+disk ring buffers are forbidden because they duplicate live sampling work and+drift out of sync with the governed history timeline.diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.mdindex 5d1674474f..ffeb16b9c5 100644--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md@@ -303,6 +303,12 @@ When the active chart entity is off-screen or hidden behind the other storageview, the page must use the shared summary-table focus bridge and reveal thetarget row only through an explicit `Jump to row` action, switching views orexpanding the owning group only for that deliberate reveal path.+That same reveal contract now also owns inline-detail expansion. When a pool or+disk row is deliberately focused and its inline detail opens on the storage+page, the detail row must publish the same canonical summary series ID through+`data-inline-detail-for` and let the shared contextual-focus helper reveal only+enough of that drawer to show the row header plus the top of the detail,+instead of reverting to storage-local centering or a second row/detail ID map.The recovery backend is a real product boundary, not just a helper package:`internal/recovery/` owns per-tenant SQLite persistence, rollup derivation,@@ -1838,3 +1844,11 @@ Storage and recovery must not treat topology labels, datastore attachments, orguest identity as recovery ownership, restore targeting, protection grouping,or a new VMware-local storage/recovery taxonomy until a separately governedslice explicitly promotes them into recovery contracts.+That same storage/recovery surface now also owns physical-disk live I/O+presentation through the canonical chart boundary. Storage disk drawers may+show read, write, busy, and SMART history, but they must route every chart+through the shared `HistoryChart` API contract using the disk resource's+canonical history target. Storage must not keep a drawer-local live metrics+collector, agent-id/device fallback stream, or separate "real-time" history+store once monitoring and `/api/metrics-store/history` already own the disk+timeline.diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 6fa0d694af..bcd24ea4e6 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -277,6 +277,13 @@ interactive-series filtering, focused-resource naming, and active-seriesresolution so the infrastructure summary stays page-scoped while stillhighlighting the same canonical resource IDs used by the unified-resourcetable and route state.+That same infrastructure focus boundary now also owns deliberate drawer reveal.+When an infrastructure row opens inline detail on the same route, the page must+tag that detail with the canonical active resource ID and let the shared+summary-table/contextual-focus helpers reveal only enough of the drawer to show+the row header plus the start of the detail. `useUnifiedResourceTableViewportSync.ts`+must stay viewport-only; it may not grow a second selected-row reveal path or a+resource-local centering rule.That same unified-resource boundary now also owns stored metrics-targetcontinuity for provider-backed resources. When registry rebuild cannot derive afresh metrics target from raw source facets, `internal/unifiedresources/registry.go`diff --git a/frontend-modern/src/__tests__/App.architecture.test.ts b/frontend-modern/src/__tests__/App.architecture.test.tsindex 4e1f417e65..c4ec7cf044 100644--- a/frontend-modern/src/__tests__/App.architecture.test.ts+++ b/frontend-modern/src/__tests__/App.architecture.test.ts@@ -37,6 +37,11 @@ describe('App architecture', () => {expect(appLayoutSource).toContain('Preview');expect(appLayoutSource).not.toContain('props.connected()');expect(appLayoutSource).toContain('const utilityTabs = createMemo(() =>');+ expect(appSource).not.toContain("eventBus.on('theme_changed'");+ expect(appSource).not.toContain("eventBus.on('websocket_reconnected'");+ expect(appSource).not.toContain("apiFetch('/api/security/status')");+ expect(appLayoutSource).not.toContain("eventBus.on('theme_changed'");+ expect(appLayoutSource).not.toContain("apiFetch('/api/security/status')");expect(appRuntimeStateSource).toContain('export const useAppRuntimeState = () =>');expect(appRuntimeStateSource).toContain('const connectionStatus = createMemo<AppConnectionStatus>(() => {');expect(appRuntimeStateSource).toContain('const beginAuthenticatedRuntime = async () =>');@@ -47,6 +52,14 @@ describe('App architecture', () => {expect(appRuntimeStateSource).toContain('const [activeOrgID, setActiveOrgID] = createSignal(',);+ expect(appRuntimeStateSource).toContain('onMount(() => {');+ expect(appRuntimeStateSource).toContain('onMount(async () => {');+ expect(appRuntimeStateSource).toContain("eventBus.on('theme_changed', handleRemoteThemeChange);");+ expect(appRuntimeStateSource).toContain(+ "eventBus.on('websocket_reconnected', handleWebSocketReconnected);",+ );+ expect(appRuntimeStateSource).not.toContain("import { startMetricsCollector } from '@/stores/metricsCollector';");+ expect(appRuntimeStateSource).not.toContain('startMetricsCollector();');expect(appRuntimeStateSource).not.toContain('function AppLayout(');});});diff --git a/frontend-modern/src/__tests__/useAppRuntimeState.test.ts b/frontend-modern/src/__tests__/useAppRuntimeState.test.tsindex 2e7e149ce1..6842d702b1 100644--- a/frontend-modern/src/__tests__/useAppRuntimeState.test.ts+++ b/frontend-modern/src/__tests__/useAppRuntimeState.test.ts@@ -171,10 +171,6 @@ describe('useAppRuntimeState', () => {buildInfrastructurePath: () => '/infrastructure',}));- vi.doMock('@/stores/metricsCollector', () => ({- startMetricsCollector: vi.fn(),- }));-vi.doMock('@/stores/alertsActivation', () => ({useAlertsActivation: () => ({refreshConfig: vi.fn().mockResolvedValue(undefined),diff --git a/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx b/frontend-modern/src/components/Dashboard/WorkloadPanel.tsxindex ce4964d2f2..6f6cbe71b7 100644--- a/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx+++ b/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx@@ -167,7 +167,7 @@ export function WorkloadPanel(props: WorkloadPanelProps) {onHoverChange={props.setHoveredWorkloadId}/><Show when={props.selectedGuestId() === guestId()}>- <TableRow>+ <TableRow data-inline-detail-for={guestId()}><TableCellcolspan={props.totalColumns()}class="p-0 border-b border-border bg-surface-alt"diff --git a/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts b/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.tsindex 9a2313de62..4d43a80baf 100644--- a/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts+++ b/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts@@ -160,7 +160,7 @@ describe('useDashboardSelectionState', () => {);});- it('shows a deliberate jump affordance when the active workload row is off-screen', () => {+ it('shows a deliberate jump affordance when a hovered workload row is off-screen', () => {locationSearch = '?type=app-container&platform=truenas&agent=truenas-main';const [filteredGuests] = createSignal<WorkloadGuest[]>([{@@ -198,7 +198,7 @@ describe('useDashboardSelectionState', () => {document.body.appendChild(tableWrapper);result.setTableWrapperRef(tableWrapper as HTMLDivElement);- result.setSelectedGuestId('app-container:truenas-main:nextcloud');+ result.setHoveredWorkloadId('app-container:truenas-main:nextcloud');expect(result.activeSummaryWorkloadId()).toBe('app-container:truenas-main:nextcloud');expect(result.shouldShowJumpToActiveWorkloadRow()).toBe(true);@@ -209,6 +209,77 @@ describe('useDashboardSelectionState', () => {expect(row.scrollIntoView).toHaveBeenCalledWith({ behavior: 'smooth', block: 'center' });});+ it('reveals mounted workload detail after selecting a row', () => {+ locationSearch = '?type=app-container&platform=truenas&agent=truenas-main';+ const workloadId = 'app-container:truenas-main:nextcloud';+ const [filteredGuests] = createSignal<WorkloadGuest[]>([+ {+ id: workloadId,+ name: 'nextcloud',+ status: 'running',+ instance: 'truenas-main',+ node: 'truenas-main',+ } as unknown as WorkloadGuest,+ ]);++ const scrollToSpy = vi.fn();+ Object.defineProperty(window, 'scrollY', {+ configurable: true,+ value: 180,+ });+ window.scrollTo = scrollToSpy as typeof window.scrollTo;++ const { result } = renderHook(() =>+ useDashboardSelectionState({+ filteredGuests,+ setSelectedNode: vi.fn(),+ }),+ );++ const tableWrapper = document.createElement('div');+ const row = document.createElement('div');+ row.dataset.summarySeriesId = workloadId;+ row.getBoundingClientRect = vi.fn(() => ({+ top: 624,+ bottom: 664,+ left: 0,+ right: 320,+ width: 320,+ height: 40,+ x: 0,+ y: 624,+ toJSON: () => ({}),+ })) as unknown as typeof row.getBoundingClientRect;++ const detail = document.createElement('div');+ detail.dataset.inlineDetailFor = workloadId;+ detail.getBoundingClientRect = vi.fn(() => ({+ top: 668,+ bottom: 964,+ left: 0,+ right: 320,+ width: 320,+ height: 296,+ x: 0,+ y: 668,+ toJSON: () => ({}),+ })) as unknown as typeof detail.getBoundingClientRect;++ tableWrapper.appendChild(row);+ tableWrapper.appendChild(detail);+ document.body.appendChild(tableWrapper);++ result.setTableWrapperRef(tableWrapper as HTMLDivElement);+ result.setSelectedGuestId(workloadId);+ vi.runAllTimers();++ expect(scrollToSpy).toHaveBeenCalledWith(+ expect.objectContaining({+ behavior: 'smooth',+ }),+ );+ });+it('tracks hovered workload groups without letting them override entity selection outside scope', () => {const [filteredGuests] = createSignal<WorkloadGuest[]>([{diff --git a/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts b/frontend-modern/src/components/Dashboard/useDashboardSelectionState.tsindex 2f306802e3..6a0dd8cb86 100644--- a/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts+++ b/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts@@ -1,7 +1,11 @@import { useLocation, useNavigate } from '@solidjs/router';import { createEffect, createSignal, onCleanup, untrack, type Accessor } from 'solid-js';-import { preserveScrollableAncestorVerticalOffset } from '@/components/shared/contextualFocus';+import {+ findInlineDetailElement,+ preserveScrollableAncestorVerticalOffset,+ revealInlineDetailInViewport,+} from '@/components/shared/contextualFocus';import { useSummaryPageInteractionState } from '@/components/shared/summaryTableFocus';import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';import type { WorkloadGuest } from '@/types/workloads';@@ -33,7 +37,9 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOpconst [handledResourceId, setHandledResourceId] = createSignal<string | null>(null);const [revealedGuestId, setRevealedGuestId] = createSignal<string | null>(null);- let tableRef: HTMLDivElement | undefined;+ const [tableWrapperRef, setTableWrapperRefSignal] = createSignal<HTMLDivElement | undefined>(+ undefined,+ );const [tableBodyRef, setTableBodyRef] = createSignal<HTMLTableSectionElement | null>(null);const summaryInteraction = useSummaryPageInteractionState({hoveredSeriesId: hoveredWorkloadId,@@ -43,12 +49,12 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp});const setTableWrapperRef = (element: HTMLDivElement | undefined) => {- tableRef = element;+ setTableWrapperRefSignal(element);summaryInteraction.setTableRootRef(element);};const setSelectedGuestIdState = (id: string | null) => {- preserveScrollableAncestorVerticalOffset(tableRef, () => {+ preserveScrollableAncestorVerticalOffset(tableWrapperRef(), () => {setSelectedGuestIdRaw(id);});};@@ -111,6 +117,52 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp}});+ createEffect(() => {+ const selectedId = selectedGuestId();+ const root = tableWrapperRef();+ if (!selectedId || !root || typeof window === 'undefined') {+ return;+ }++ let rafId: number | undefined;+ let timeoutId: number | undefined;+ let settled = false;++ const cleanup = () => {+ settled = true;+ if (rafId !== undefined) {+ window.cancelAnimationFrame(rafId);+ }+ if (timeoutId !== undefined) {+ window.clearTimeout(timeoutId);+ }+ };++ const attemptReveal = (remainingFrames: number) => {+ if (settled) {+ return;+ }++ const row = root.querySelector<HTMLElement>(`[data-summary-series-id="${selectedId}"]`);+ const detail = findInlineDetailElement(root, selectedId);+ if (row && detail) {+ const didScroll = revealInlineDetailInViewport({ row, detail });+ if (!didScroll || remainingFrames <= 0) {+ cleanup();+ return;+ }+ } else if (remainingFrames <= 0) {+ cleanup();+ return;+ }++ rafId = window.requestAnimationFrame(() => attemptReveal(remainingFrames - 1));+ };++ rafId = window.requestAnimationFrame(() => attemptReveal(24));+ timeoutId = window.setTimeout(cleanup, 1500);+ });+onCleanup(() => {routeStateNavigate.cleanup();});diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsxindex 8acd22d7a3..80cf066a66 100644--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx@@ -263,7 +263,6 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCarreturn (<><TableRow- ref={(el) => table.registerRowRef(resource.id, el)}data-row-id={resource.id}data-summary-series-id={resource.id}data-summary-row-active={@@ -600,7 +599,7 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar</TableCell></TableRow><Show when={isExpanded()}>- <TableRow>+ <TableRow data-inline-detail-for={resource.id}><TableCellcolspan={9}class="bg-surface-alt px-4 py-4 border-b border-border-subtle shadow-inner"diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsxindex 41ea6b1d99..38dfe2373d 100644--- a/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx@@ -132,7 +132,6 @@ export const UnifiedResourcePBSTableSection: Component<UnifiedResourcePBSTableSereturn (<><TableRow- ref={(el) => table.registerRowRef(resource.id, el)}data-summary-series-id={resource.id}data-summary-row-active={(tableProps.hoveredResourceId === resource.id || isHighlighted()) &&@@ -294,7 +293,7 @@ export const UnifiedResourcePBSTableSection: Component<UnifiedResourcePBSTableSe</TableCell></TableRow><Show when={isExpanded()}>- <TableRow>+ <TableRow data-inline-detail-for={resource.id}><TableCellcolspan={7}class="bg-surface-alt px-4 py-4 border-b border-border-subtle shadow-inner"diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsxindex b57964e144..92efe36923 100644--- a/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx@@ -149,7 +149,6 @@ export const UnifiedResourcePMGTableSection: Component<UnifiedResourcePMGTableSereturn (<><TableRow- ref={(el) => table.registerRowRef(resource.id, el)}data-summary-series-id={resource.id}data-summary-row-active={(tableProps.hoveredResourceId === resource.id || isHighlighted()) &&@@ -333,7 +332,7 @@ export const UnifiedResourcePMGTableSection: Component<UnifiedResourcePMGTableSe</TableCell></TableRow><Show when={isExpanded()}>- <TableRow>+ <TableRow data-inline-detail-for={resource.id}><TableCellcolspan={9}class="bg-surface-alt px-4 py-4 border-b border-border-subtle shadow-inner"diff --git a/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts b/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.tsindex 69695fbff3..f313be12ec 100644--- a/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts+++ b/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts@@ -95,7 +95,6 @@ export function useUnifiedResourceTableState(props: UnifiedResourceTableProps) {),);const viewportSync = useUnifiedResourceTableViewportSync({- expandedResourceId: () => props.expandedResourceId,totalCount: () => hostTableItems().length,estimatedRowHeight: HOST_TABLE_ESTIMATED_ROW_HEIGHT,hostWindowing,diff --git a/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts b/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.tsindex ebb245558b..8c9cc24598 100644--- a/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts+++ b/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts@@ -2,7 +2,6 @@ import { createEffect, createSignal, onCleanup, type Accessor } from 'solid-js';import { useTableWindowing } from './useTableWindowing';interface UseUnifiedResourceTableViewportSyncOptions {- expandedResourceId: Accessor<string | null>;totalCount: Accessor<number>;estimatedRowHeight: number;hostWindowing: ReturnType<typeof useTableWindowing>;@@ -11,9 +10,8 @@ interface UseUnifiedResourceTableViewportSyncOptions {export function useUnifiedResourceTableViewportSync(options: UseUnifiedResourceTableViewportSyncOptions,) {- const { expandedResourceId, totalCount, estimatedRowHeight, hostWindowing } = options;+ const { totalCount, estimatedRowHeight, hostWindowing } = options;const [hostBodyRef, setHostBodyRef] = createSignal<HTMLTableSectionElement | null>(null);- const rowRefs = new Map<string, HTMLTableRowElement>();const syncHostWindowToViewport = () => {if (!hostWindowing.isWindowed() || typeof window === 'undefined') return;@@ -24,28 +22,6 @@ export function useUnifiedResourceTableViewportSync(hostWindowing.onScroll(scrollTop, window.innerHeight, estimatedRowHeight);};- const registerRowRef = (resourceId: string, element?: HTMLTableRowElement) => {- if (element) {- rowRefs.set(resourceId, element);- return;- }- rowRefs.delete(resourceId);- };-- createEffect(() => {- const selectedId = expandedResourceId();- if (!selectedId) return;- hostWindowing.startIndex();- hostWindowing.endIndex();- const row = rowRefs.get(selectedId);- if (row) {- const rect = row.getBoundingClientRect();- const fullyVisible = rect.top >= 0 && rect.bottom <= window.innerHeight;- if (fullyVisible) return;- row.scrollIntoView({ block: 'center', behavior: 'smooth' });- }- });-createEffect(() => {if (typeof window === 'undefined') return;totalCount();@@ -66,7 +42,6 @@ export function useUnifiedResourceTableViewportSync(});return {- registerRowRef,setHostBodyRef,};}diff --git a/frontend-modern/src/components/Storage/DiskList.tsx b/frontend-modern/src/components/Storage/DiskList.tsxindex d5f4ce10ba..26ca189bb3 100644--- a/frontend-modern/src/components/Storage/DiskList.tsx+++ b/frontend-modern/src/components/Storage/DiskList.tsx@@ -307,7 +307,7 @@ export const DiskList: Component<DiskListProps> = (props) => {</TableCell></TableRow><Show when={isSelected()}>- <TableRow>+ <TableRow data-inline-detail-for={summarySeriesId}><TableCell colSpan={9} class={PHYSICAL_DISK_DETAIL_ROW_CELL_CLASS}><DiskDetail disk={disk} nodes={props.nodes} /></TableCell>diff --git a/frontend-modern/src/components/Storage/StoragePoolDetail.tsx b/frontend-modern/src/components/Storage/StoragePoolDetail.tsxindex fadeb27472..08541120f4 100644--- a/frontend-modern/src/components/Storage/StoragePoolDetail.tsx+++ b/frontend-modern/src/components/Storage/StoragePoolDetail.tsx@@ -37,6 +37,7 @@ import { useStoragePoolDetailModel } from './useStoragePoolDetailModel';interface StoragePoolDetailProps {record: StorageRecord;physicalDisks: Resource[];+ summarySeriesId: string;}export const StoragePoolDetail: Component<StoragePoolDetailProps> = (props) => {@@ -47,7 +48,7 @@ export const StoragePoolDetail: Component<StoragePoolDetailProps> = (props) => {});return (- <tr class={STORAGE_DETAIL_ROW_CLASS}>+ <tr class={STORAGE_DETAIL_ROW_CLASS} data-inline-detail-for={props.summarySeriesId}><td colSpan={99} class={STORAGE_DETAIL_CELL_CLASS}><div class={STORAGE_DETAIL_ROOT_GRID_CLASS}>{/* Left: Capacity trend chart */}diff --git a/frontend-modern/src/components/Storage/StoragePoolRow.tsx b/frontend-modern/src/components/Storage/StoragePoolRow.tsxindex 756c189ae7..2f5b82ab71 100644--- a/frontend-modern/src/components/Storage/StoragePoolRow.tsx+++ b/frontend-modern/src/components/Storage/StoragePoolRow.tsx@@ -172,7 +172,11 @@ export const StoragePoolRow: Component<StoragePoolRowProps> = (props) => {</td></tr><Show when={props.expanded}>- <StoragePoolDetail record={props.record} physicalDisks={props.physicalDisks} />+ <StoragePoolDetail+ record={props.record}+ physicalDisks={props.physicalDisks}+ summarySeriesId={props.summarySeriesId}+ /></Show></>);diff --git a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsxindex 3dbc5f7927..aea06939d4 100644--- a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx+++ b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx@@ -1059,6 +1059,112 @@ describe('Storage', () => {storageSummarySpy.mockRestore();});+ it('reveals opened pool detail without hard-centering the focused row', async () => {+ const storageSummarySpy = vi.spyOn(ChartsAPI, 'getStorageSummaryCharts').mockResolvedValue({+ pools: {+ 'pool:alpha': {+ name: 'Alpha-Store',+ usage: [+ { timestamp: Date.now() - 60_000, value: 45 },+ { timestamp: Date.now(), value: 47 },+ ],+ used: [+ { timestamp: Date.now() - 60_000, value: 450 },+ { timestamp: Date.now(), value: 470 },+ ],+ avail: [+ { timestamp: Date.now() - 60_000, value: 550 },+ { timestamp: Date.now(), value: 530 },+ ],+ },+ },+ disks: {},+ stats: {+ oldestDataTimestamp: Date.now() - 60_000,+ },+ });++ const scrollToSpy = vi.fn();+ Object.defineProperty(window, 'innerHeight', {+ configurable: true,+ value: 800,+ });+ Object.defineProperty(window, 'scrollY', {+ configurable: true,+ value: 180,+ });+ Object.defineProperty(window, 'scrollTo', {+ configurable: true,+ value: scrollToSpy,+ });++ const rowRect = {+ top: 680,+ bottom: 728,+ left: 0,+ right: 480,+ width: 480,+ height: 48,+ x: 0,+ y: 680,+ toJSON: () => ({}),+ } satisfies DOMRect;+ const detailRect = {+ top: 732,+ bottom: 1012,+ left: 0,+ right: 480,+ width: 480,+ height: 280,+ x: 0,+ y: 732,+ toJSON: () => ({}),+ } satisfies DOMRect;+ const rectSpy = vi+ .spyOn(HTMLElement.prototype, 'getBoundingClientRect')+ .mockImplementation(function mockRect(this: HTMLElement) {+ if (this.dataset.summarySeriesId === 'pool:alpha') {+ return rowRect;+ }+ if (this.dataset.inlineDetailFor === 'pool:alpha') {+ return detailRect;+ }+ return {+ top: 0,+ bottom: 32,+ left: 0,+ right: 32,+ width: 32,+ height: 32,+ x: 0,+ y: 0,+ toJSON: () => ({}),+ } satisfies DOMRect;+ });++ hookResources = [+ buildStorageResource('storage-display-alpha', 'Alpha-Store', 'pve1', {+ metricsTarget: {+ resourceType: 'storage',+ resourceId: 'pool:alpha',+ },+ }),+ ];++ render(() => <Storage />);++ await screen.findByTestId('storage-summary');+ fireEvent.click(screen.getByRole('button', { name: 'Toggle details for Alpha-Store' }));++ await waitFor(() => {+ expect(document.querySelector('[data-inline-detail-for="pool:alpha"]')).toBeTruthy();+ expect(scrollToSpy).toHaveBeenCalledWith({ top: 636, behavior: 'smooth' });+ });++ rectSpy.mockRestore();+ storageSummarySpy.mockRestore();+ });+it('restores canonical TrueNAS source filters from the storage route', async () => {nodeResources = [{diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.tsindex 8ff5ecfd9f..ad4864a8d3 100644--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts@@ -271,10 +271,14 @@ describe('shared primitive guardrails', () => {expect(contextualFocusSource).toContain('export const preserveScrollableAncestorVerticalOffset',);+ expect(contextualFocusSource).toContain('export const findInlineDetailElement');+ expect(contextualFocusSource).toContain('export const revealInlineDetailInViewport');expect(contextualFocusSource).toContain('export function useSummaryContextualFocusState');expect(contextualFocusSource).toContain('chartHoveredSeriesId');expect(contextualFocusSource).toContain('hoveredGroupScope');expect(contextualFocusSource).toContain('filterSeriesForActiveScope');+ expect(contextualFocusSource).toContain('markRouteStateDeliberateScroll');+ expect(contextualFocusSource).toContain('data-inline-detail-for');expect(summaryCardInteractionSource).toContain('chartHoveredSeriesId');expect(summaryCardInteractionSource).toContain('SummarySeriesGroupScope');expect(summaryCardInteractionSource).toContain('resolveSummaryGroupScope');@@ -294,6 +298,10 @@ describe('shared primitive guardrails', () => {expect(summaryTableFocusSource).toContain('export function useSummaryTableFocusBridge');expect(summaryTableFocusSource).toContain('export function useSummaryPageInteractionState');expect(summaryTableFocusSource).toContain('resolveSummaryActiveSeriesId');+ expect(summaryTableFocusSource).toContain('focusedSeriesId');+ expect(summaryTableFocusSource).toContain('findInlineDetailElement');+ expect(summaryTableFocusSource).toContain('revealInlineDetailInViewport');+ expect(summaryTableFocusSource).toContain('MutationObserver');expect(summaryTableFocusSource).toContain('querySelector<HTMLElement>(');expect(summaryTableFocusSource).toContain("row.scrollIntoView({ behavior: 'smooth', block: 'center' })",diff --git a/frontend-modern/src/components/shared/__tests__/summaryTableFocus.test.tsx b/frontend-modern/src/components/shared/__tests__/summaryTableFocus.test.tsxindex 13f600e50a..65e7497a39 100644--- a/frontend-modern/src/components/shared/__tests__/summaryTableFocus.test.tsx+++ b/frontend-modern/src/components/shared/__tests__/summaryTableFocus.test.tsx@@ -118,4 +118,38 @@ describe('useSummaryPageInteractionState', () => {expect(revealActiveSeries).toHaveBeenCalledWith('pool-alpha');expect(scrollIntoView).toHaveBeenCalledWith({ behavior: 'smooth', block: 'center' });});++ it('reveals focused inline detail without hard-centering the row', () => {+ const [focusedSeriesId] = createSignal<string | null>('workload-a');+ const revealActiveSeries = vi.fn();+ const scrollTo = vi.fn();+ const root = document.createElement('div');+ const row = document.createElement('div');+ const detail = document.createElement('div');++ Object.defineProperty(window, 'scrollTo', {+ configurable: true,+ value: scrollTo,+ });+ vi.stubGlobal('scrollY', 0);++ row.setAttribute('data-summary-series-id', 'workload-a');+ row.getBoundingClientRect = vi.fn(() => buildRect(680, 40));+ detail.setAttribute('data-inline-detail-for', 'workload-a');+ detail.getBoundingClientRect = vi.fn(() => buildRect(724, 220));+ root.append(row, detail);+ document.body.appendChild(root);++ const { result } = renderHook(() =>+ useSummaryPageInteractionState({+ focusedSeriesId,+ revealActiveSeries,+ }),+ );++ result.setTableRootRef(root);++ expect(revealActiveSeries).toHaveBeenCalledWith('workload-a');+ expect(scrollTo).toHaveBeenCalledWith({ top: 456, behavior: 'smooth' });+ });});diff --git a/frontend-modern/src/components/shared/contextualFocus.ts b/frontend-modern/src/components/shared/contextualFocus.tsindex 29d07ffcdd..3cf40bfca7 100644--- a/frontend-modern/src/components/shared/contextualFocus.ts+++ b/frontend-modern/src/components/shared/contextualFocus.ts@@ -1,4 +1,5 @@import { createMemo, type Accessor } from 'solid-js';+import { markRouteStateDeliberateScroll } from '@/utils/routeStateNavigation';import {filterSummarySeriesByGroupScope,resolveSummaryActiveSeriesId,@@ -13,6 +14,10 @@ type ContextualFocusSeries = {name?: string | null;};+const INLINE_DETAIL_TARGET_TOP_RATIO = 0.28;+const INLINE_DETAIL_MIN_TOP_MARGIN = 72;+const INLINE_DETAIL_MIN_DETAIL_PEEK = 160;+export interface SummaryChartHoverSync {sourceKey: string;seriesId: string;@@ -47,6 +52,133 @@ const resolveScrollableAncestor = (element: Element | null | undefined): HTMLElereturn null;};+const isWindowScroller = (scroller: Window | HTMLElement): scroller is Window => {+ return typeof window !== 'undefined' && scroller === window;+};++const resolveVerticalScroller = (element: Element | null | undefined): Window | HTMLElement => {+ if (typeof window === 'undefined') {+ throw new Error('resolveVerticalScroller requires a browser environment');+ }+ return resolveScrollableAncestor(element) ?? window;+};++const getScrollerMetrics = (scroller: Window | HTMLElement) => {+ if (isWindowScroller(scroller) || typeof (scroller as HTMLElement).getBoundingClientRect !== 'function') {+ return {+ top: 0,+ bottom: window.innerHeight,+ height: window.innerHeight,+ scrollTop: window.scrollY,+ };+ }++ const rect = scroller.getBoundingClientRect();+ return {+ top: rect.top,+ bottom: rect.bottom,+ height: scroller.clientHeight,+ scrollTop: scroller.scrollTop,+ };+};++const scrollVerticalScroller = (+ scroller: Window | HTMLElement,+ top: number,+ behavior: ScrollBehavior,+) => {+ const clampedTop = Math.max(0, top);+ markRouteStateDeliberateScroll();+ const canUseScrollTo = (() => {+ if (typeof scroller.scrollTo !== 'function') {+ return false;+ }+ if (+ isWindowScroller(scroller) &&+ typeof window !== 'undefined' &&+ /jsdom/i.test(window.navigator.userAgent) &&+ !('mock' in scroller.scrollTo)+ ) {+ return false;+ }+ try {+ return !Function.prototype.toString.call(scroller.scrollTo).includes('notImplemented');+ } catch {+ return true;+ }+ })();+ try {+ if (isWindowScroller(scroller)) {+ if (canUseScrollTo) {+ scroller.scrollTo({ top: clampedTop, behavior });+ return;+ }+ document.documentElement.scrollTop = clampedTop;+ document.body.scrollTop = clampedTop;+ return;+ }+ if (!canUseScrollTo) {+ scroller.scrollTop = clampedTop;+ return;+ }+ scroller.scrollTo({ top: clampedTop, behavior });+ } catch {+ // JSDOM can throw for unimplemented scroll APIs. Ignore that path in tests.+ }+};++export const findInlineDetailElement = (+ root: ParentNode | null | undefined,+ seriesId: string | null | undefined,+): HTMLElement | null => {+ const normalizedId = seriesId?.trim() || '';+ if (!root || !normalizedId) {+ return null;+ }+ return root.querySelector<HTMLElement>(`[data-inline-detail-for="${normalizedId}"]`);+};++export const revealInlineDetailInViewport = (options: {+ row: HTMLElement;+ detail?: HTMLElement | null;+ behavior?: ScrollBehavior;+}): boolean => {+ if (typeof window === 'undefined') {+ return false;+ }++ const scroller = resolveVerticalScroller(options.row);+ const metrics = getScrollerMetrics(scroller);+ const rowRect = options.row.getBoundingClientRect();+ const detailRect = options.detail?.getBoundingClientRect() ?? null;+ const minTopMargin = Math.max(+ INLINE_DETAIL_MIN_TOP_MARGIN,+ Math.round(metrics.height * 0.12),+ );+ const preferredTop = Math.max(+ minTopMargin,+ Math.round(metrics.height * INLINE_DETAIL_TARGET_TOP_RATIO),+ );+ const detailPeek = Math.max(+ INLINE_DETAIL_MIN_DETAIL_PEEK,+ Math.round(metrics.height * 0.24),+ );+ const currentRowOffset = rowRect.top - metrics.top;+ const rowHasBreathingRoom = currentRowOffset >= minTopMargin;+ const detailHasPeek =+ !detailRect || detailRect.top - metrics.top <= metrics.height - detailPeek;++ if (rowHasBreathingRoom && detailHasPeek) {+ return false;+ }++ const desiredRowOffset =+ currentRowOffset > preferredTop ? preferredTop : Math.max(minTopMargin, currentRowOffset);+ const nextScrollTop = metrics.scrollTop + currentRowOffset - desiredRowOffset;+ scrollVerticalScroller(scroller, nextScrollTop, options.behavior ?? 'smooth');+ return true;+};+export const preserveScrollableAncestorVerticalOffset = (anchor: Element | null | undefined,apply: () => void,diff --git a/frontend-modern/src/components/shared/summaryTableFocus.ts b/frontend-modern/src/components/shared/summaryTableFocus.tsindex 801523f9ab..99f988f618 100644--- a/frontend-modern/src/components/shared/summaryTableFocus.ts+++ b/frontend-modern/src/components/shared/summaryTableFocus.ts@@ -1,5 +1,9 @@-import { createMemo, createSignal, type Accessor } from 'solid-js';-import type { SummaryChartHoverSync } from './contextualFocus';+import { createEffect, createMemo, createSignal, onCleanup, type Accessor } from 'solid-js';+import {+ findInlineDetailElement,+ revealInlineDetailInViewport,+ type SummaryChartHoverSync,+} from './contextualFocus';import {resolveSummaryActiveSeriesId,resolveSummaryGroupScope,@@ -44,11 +48,13 @@ const isElementVisibleWithinViewport = (element: HTMLElement): boolean => {export interface UseSummaryTableFocusBridgeOptions {activeSeriesId: Accessor<string | null | undefined>;+ focusedSeriesId?: Accessor<string | null | undefined>;revealActiveSeries?: (seriesId: string) => void;}export function useSummaryTableFocusBridge(options: UseSummaryTableFocusBridgeOptions) {const [tableRoot, setTableRoot] = createSignal<HTMLElement | null>(null);+ const focusedSeriesId = options.focusedSeriesId ?? (() => null);const normalizedActiveSeriesId = createMemo<string | null>(() => {const normalized = normalizeSeriesId(options.activeSeriesId());@@ -66,6 +72,17 @@ export function useSummaryTableFocusBridge(options: UseSummaryTableFocusBridgeOp);};+ const focusedRow = (): HTMLElement | null => {+ const root = tableRoot();+ const focusedId = normalizeSeriesId(focusedSeriesId());+ if (!root || !focusedId) {+ return null;+ }+ return root.querySelector<HTMLElement>(+ `[data-summary-series-id="${escapeAttributeSelectorValue(focusedId)}"]`,+ );+ };+const isActiveRowVisible = createMemo<boolean>(() => {const row = activeRow();if (!row) {@@ -101,6 +118,101 @@ export function useSummaryTableFocusBridge(options: UseSummaryTableFocusBridgeOpattemptScroll(6);};+ createEffect(() => {+ const focusedId = normalizeSeriesId(focusedSeriesId());+ const root = tableRoot();+ if (!focusedId || !root || typeof window === 'undefined') {+ return;+ }++ options.revealActiveSeries?.(focusedId);++ let settled = false;+ let rafId: number | undefined;+ let observer: MutationObserver | undefined;+ let timeoutId: number | undefined;++ const cleanup = () => {+ settled = true;+ if (rafId !== undefined) {+ window.cancelAnimationFrame(rafId);+ }+ if (timeoutId !== undefined) {+ window.clearTimeout(timeoutId);+ }+ observer?.disconnect();+ };++ const settleReveal = (remainingFrames: number) => {+ if (settled) {+ return;+ }+ const row = focusedRow();+ const detail = findInlineDetailElement(root, focusedId);+ if (!row || !detail) {+ cleanup();+ return;+ }++ const didScroll = revealInlineDetailInViewport({+ row,+ detail,+ });++ if (remainingFrames <= 0 || !didScroll) {+ cleanup();+ return;+ }++ rafId = window.requestAnimationFrame(() => {+ settleReveal(remainingFrames - 1);+ });+ };++ const attemptReveal = (): boolean => {+ if (settled) {+ return true;+ }+ const row = focusedRow();+ if (!row || !root) {+ return false;+ }++ const detail = findInlineDetailElement(root, focusedId);+ if (!detail) {+ return false;+ }++ settleReveal(2);+ return true;+ };++ if (attemptReveal()) {+ return;+ }++ observer = new MutationObserver(() => {+ attemptReveal();+ });+ observer.observe(root, { childList: true, subtree: true });++ let remainingFrames = 24;+ const scheduleAttempt = () => {+ if (attemptReveal() || remainingFrames <= 0) {+ return;+ }+ remainingFrames -= 1;+ rafId = window.requestAnimationFrame(scheduleAttempt);+ };++ rafId = window.requestAnimationFrame(scheduleAttempt);+ timeoutId = window.setTimeout(() => {+ cleanup();+ }, 1200);++ onCleanup(cleanup);+ });+return {activeRow,isActiveRowVisible,@@ -143,6 +255,7 @@ export function useSummaryPageInteractionState(options: UseSummaryPageInteractioconst tableFocus = useSummaryTableFocusBridge({activeSeriesId,+ focusedSeriesId,revealActiveSeries: options.revealActiveSeries,});diff --git a/frontend-modern/src/features/infrastructure/__tests__/InfrastructurePageSurface.guardrails.test.ts b/frontend-modern/src/features/infrastructure/__tests__/InfrastructurePageSurface.guardrails.test.tsindex 1bdf2b3aa9..7faec73f09 100644--- a/frontend-modern/src/features/infrastructure/__tests__/InfrastructurePageSurface.guardrails.test.ts+++ b/frontend-modern/src/features/infrastructure/__tests__/InfrastructurePageSurface.guardrails.test.ts@@ -3,6 +3,8 @@ import infrastructurePageSurfaceSource from '@/features/infrastructure/Infrastruimport infrastructurePageModelSource from '@/features/infrastructure/infrastructurePageModel.ts?raw';import infrastructurePageStateSource from '@/features/infrastructure/useInfrastructurePageState.ts?raw';import infrastructurePageRouteStateSource from '@/features/infrastructure/useInfrastructurePageRouteState.ts?raw';+import unifiedResourceTableStateSource from '@/components/Infrastructure/useUnifiedResourceTableState.ts?raw';+import unifiedResourceTableViewportSyncSource from '@/components/Infrastructure/useUnifiedResourceTableViewportSync.ts?raw';describe('InfrastructurePageSurface guardrails', () => {it('keeps the feature shell separate from route-sync and page-model ownership', () => {@@ -54,4 +56,14 @@ describe('InfrastructurePageSurface guardrails', () => {expect(infrastructurePageRouteStateSource).not.toContain('useSummaryPageInteractionState');expect(infrastructurePageRouteStateSource).not.toContain('setSummaryTableRootRef');});++ it('keeps inline-detail reveal out of infrastructure viewport sync helpers', () => {+ expect(unifiedResourceTableStateSource).toContain('useUnifiedResourceTableViewportSync');+ expect(unifiedResourceTableStateSource).not.toContain('scrollIntoView');+ expect(unifiedResourceTableViewportSyncSource).toContain('syncHostWindowToViewport');+ expect(unifiedResourceTableViewportSyncSource).toContain("window.addEventListener('scroll'");+ expect(unifiedResourceTableViewportSyncSource).not.toContain('expandedResourceId');+ expect(unifiedResourceTableViewportSyncSource).not.toContain('scrollIntoView');+ expect(unifiedResourceTableViewportSyncSource).not.toContain('querySelector<HTMLElement>(');+ });});diff --git a/frontend-modern/src/useAppRuntimeState.ts b/frontend-modern/src/useAppRuntimeState.tsindex 075a58b9f8..84640f0932 100644--- a/frontend-modern/src/useAppRuntimeState.ts+++ b/frontend-modern/src/useAppRuntimeState.ts@@ -31,7 +31,6 @@ import {hasFreshInfrastructureSummaryCache,} from '@/utils/infrastructureSummaryCache';import { buildInfrastructurePath } from '@/routing/resourceLinks';-import { startMetricsCollector } from '@/stores/metricsCollector';import { useAlertsActivation } from '@/stores/alertsActivation';import {applyThemeClass,@@ -88,11 +87,6 @@ export const useAppRuntimeState = () => {};const alertsActivation = useAlertsActivation();-- onMount(() => {- startMetricsCollector();- });-let hasPreloadedRoutes = false;let hasFetchedVersionInfo = false;let hasPrewarmedInfrastructureCharts = false;diff --git a/frontend-modern/src/utils/__tests__/routeStateNavigation.test.ts b/frontend-modern/src/utils/__tests__/routeStateNavigation.test.tsindex bc5667347c..a2886d7f69 100644--- a/frontend-modern/src/utils/__tests__/routeStateNavigation.test.ts+++ b/frontend-modern/src/utils/__tests__/routeStateNavigation.test.ts@@ -3,21 +3,26 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import {ROUTE_STATE_REPLACE_OPTIONS,createRouteStateNavigateScheduler,+ markRouteStateDeliberateScroll,} from '@/utils/routeStateNavigation';describe('routeStateNavigation', () => {const scrollToSpy = vi.fn();+ let currentScrollX = 24;+ let currentScrollY = 320;beforeEach(() => {vi.useFakeTimers();scrollToSpy.mockReset();+ currentScrollX = 24;+ currentScrollY = 320;Object.defineProperty(window, 'scrollX', {configurable: true,- value: 24,+ get: () => currentScrollX,});Object.defineProperty(window, 'scrollY', {configurable: true,- value: 320,+ get: () => currentScrollY,});Object.defineProperty(window.navigator, 'userAgent', {configurable: true,@@ -28,6 +33,10 @@ describe('routeStateNavigation', () => {value: 'auto',writable: true,});+ scrollToSpy.mockImplementation((x: number, y: number) => {+ currentScrollX = x;+ currentScrollY = y;+ });window.scrollTo = scrollToSpy as typeof window.scrollTo;});@@ -60,4 +69,36 @@ describe('routeStateNavigation', () => {expect(navigate).not.toHaveBeenCalled();expect(scrollToSpy).not.toHaveBeenCalled();});++ it('stops replaying preserved scroll after a later deliberate scroll change', () => {+ const navigate = vi.fn();+ let currentPath = '/infrastructure?source=proxmox-pve';+ const scheduler = createRouteStateNavigateScheduler(navigate, () => currentPath);++ scheduler.schedule('/infrastructure?source=proxmox-pve&resource=agent-123');+ vi.advanceTimersByTime(0);++ expect(scrollToSpy).toHaveBeenCalledTimes(1);++ currentScrollY = 540;+ vi.runAllTimers();++ expect(scrollToSpy).toHaveBeenCalledTimes(1);+ });++ it('suppresses preserved scroll replays while a deliberate scroll handoff is active', () => {+ const navigate = vi.fn();+ let currentPath = '/workloads?type=app-container';+ const scheduler = createRouteStateNavigateScheduler(navigate, () => currentPath);++ markRouteStateDeliberateScroll();+ scheduler.schedule('/workloads?type=app-container&resource=guest-1');+ vi.runAllTimers();++ expect(navigate).toHaveBeenCalledWith(+ '/workloads?type=app-container&resource=guest-1',+ ROUTE_STATE_REPLACE_OPTIONS,+ );+ expect(scrollToSpy).not.toHaveBeenCalled();+ });});diff --git a/frontend-modern/src/utils/routeStateNavigation.ts b/frontend-modern/src/utils/routeStateNavigation.tsindex 62102f89ca..ce8013e6a6 100644--- a/frontend-modern/src/utils/routeStateNavigation.ts+++ b/frontend-modern/src/utils/routeStateNavigation.ts@@ -3,6 +3,17 @@ export const ROUTE_STATE_REPLACE_OPTIONS = {scroll: false,} as const;+const ROUTE_STATE_SCROLL_RESTORE_DIVERGENCE_PX = 24;+const ROUTE_STATE_DELIBERATE_SCROLL_SUPPRESSION_MS = 1000;+let routeStateDeliberateScrollSuppressedUntil = 0;++export const markRouteStateDeliberateScroll = (now = Date.now()): void => {+ routeStateDeliberateScrollSuppressedUntil = Math.max(+ routeStateDeliberateScrollSuppressedUntil,+ now + ROUTE_STATE_DELIBERATE_SCROLL_SUPPRESSION_MS,+ );+};+const isSamePathnameNavigation = (currentPath: string, targetPath: string): boolean => {const base = window.location.origin;return new URL(currentPath, base).pathname === new URL(targetPath, base).pathname;@@ -36,6 +47,15 @@ export const createRouteStateNavigateScheduler = (window.history.scrollRestoration = 'manual';const applyScrollRestore = () => {if (/jsdom/i.test(window.navigator.userAgent)) return;+ if (routeStateDeliberateScrollSuppressedUntil > Date.now()) {+ return;+ }+ if (+ Math.abs(window.scrollX - restoreScroll.x) > ROUTE_STATE_SCROLL_RESTORE_DIVERGENCE_PX ||+ Math.abs(window.scrollY - restoreScroll.y) > ROUTE_STATE_SCROLL_RESTORE_DIVERGENCE_PX+ ) {+ return;+ }window.scrollTo(restoreScroll.x, restoreScroll.y);};navigate(target, ROUTE_STATE_REPLACE_OPTIONS);diff --git a/tests/integration/tests/47-inline-selection-scroll-stability.spec.ts b/tests/integration/tests/47-inline-selection-scroll-stability.spec.tsindex a769aadb44..3776565f4f 100644--- a/tests/integration/tests/47-inline-selection-scroll-stability.spec.ts+++ b/tests/integration/tests/47-inline-selection-scroll-stability.spec.ts@@ -100,6 +100,24 @@ async function scrollSectionIntoView(return page.evaluate(() => window.scrollY);}+async function positionElementNearViewportBottom(+ page: Page,+ locator: Locator,+ bottomInset = 96,+): Promise<number> {+ const targetTop = await locator.evaluate(+ (element, inset) =>+ Math.max(+ 0,+ window.scrollY + element.getBoundingClientRect().top - (window.innerHeight - inset),+ ),+ bottomInset,+ );+ await page.evaluate((nextTop) => window.scrollTo(0, nextTop), targetTop);+ await page.waitForTimeout(150);+ return locator.evaluate((element) => element.getBoundingClientRect().top);+}+test.describe.serial("Inline selection scroll stability", () => {test.setTimeout(180_000);@@ -145,14 +163,27 @@ test.describe.serial("Inline selection scroll stability", () => {.filter({ hasText: resourceName }).first();await expect(row).toBeVisible();+ const beforeRowTop = await positionElementNearViewportBottom(page, row);+ expect(beforeRowTop).toBeGreaterThan(500);await row.click();await expect(page).toHaveURL(/\/infrastructure\?source=proxmox-pve&resource=/,);+ const detailRow = row.locator("xpath=following-sibling::tr[1]");await expect(page.getByRole("button", { name: /show access|hide access/i }),).toBeVisible();+ await expect(detailRow).toBeVisible();+ await page.waitForTimeout(350);++ const viewportHeight = await page.evaluate(() => window.innerHeight);+ const afterRowTop = await row.evaluate((element) => element.getBoundingClientRect().top);+ const detailTop = await detailRow.evaluate((element) => element.getBoundingClientRect().top);++ expect(afterRowTop).toBeLessThan(beforeRowTop - 150);+ expect(afterRowTop).toBeLessThan(viewportHeight * 0.42);+ expect(detailTop).toBeLessThan(viewportHeight - 48);const afterScroll = await page.evaluate(() => window.scrollY);expect(afterScroll).toBeGreaterThanOrEqual(Math.max(10, beforeScroll - 60));@@ -209,6 +240,8 @@ test.describe.serial("Inline selection scroll stability", () => {const row = page.locator("tr[data-guest-id]").first();const beforeScroll = await scrollSectionIntoView(page, row);expect(beforeScroll).toBeGreaterThan(10);+ const beforeRowTop = await positionElementNearViewportBottom(page, row);+ expect(beforeRowTop).toBeGreaterThan(500);const workloadId = (await row.getAttribute("data-guest-id")) ?? "";expect(workloadId).not.toBe("");@@ -216,9 +249,19 @@ test.describe.serial("Inline selection scroll stability", () => {await row.click();await expect(page).toHaveURL(/\/workloads\?(?:.*&)?resource=/);- await expect(row.locator("xpath=following-sibling::tr[1]")).toContainText(+ const detailRow = row.locator("xpath=following-sibling::tr[1]");+ await expect(detailRow).toContainText("Overview",);+ await page.waitForTimeout(350);++ const viewportHeight = await page.evaluate(() => window.innerHeight);+ const afterRowTop = await row.evaluate((element) => element.getBoundingClientRect().top);+ const detailTop = await detailRow.evaluate((element) => element.getBoundingClientRect().top);++ expect(afterRowTop).toBeLessThan(beforeRowTop - 150);+ expect(afterRowTop).toBeLessThan(viewportHeight * 0.42);+ expect(detailTop).toBeLessThan(viewportHeight - 48);const afterScroll = await page.evaluate(() => window.scrollY);expect(afterScroll).toBeGreaterThanOrEqual(Math.max(10, beforeScroll - 60));@@ -226,4 +269,38 @@ test.describe.serial("Inline selection scroll stability", () => {await row.click();await expect.poll(() => page.url()).not.toContain("resource=");});++ test("reveals storage inline detail without hard-centering the selected row", async ({+ page,+ }, testInfo) => {+ test.skip(+ testInfo.project.name.startsWith("mobile-"),+ "Desktop-only storage interaction proof",+ );++ await ensureMockModeEnabled(page);++ await page.goto("/storage", { waitUntil: "domcontentloaded" });+ const row = page.locator("tr[data-summary-series-id]").first();+ await expect(row).toBeVisible();++ const beforeScroll = await scrollSectionIntoView(page, row);+ expect(beforeScroll).toBeGreaterThan(10);+ const beforeRowTop = await positionElementNearViewportBottom(page, row);+ expect(beforeRowTop).toBeGreaterThan(500);++ await row.click();++ const detailRow = row.locator("xpath=following-sibling::tr[1]");+ await expect(detailRow).toBeVisible();+ await page.waitForTimeout(350);++ const viewportHeight = await page.evaluate(() => window.innerHeight);+ const afterRowTop = await row.evaluate((element) => element.getBoundingClientRect().top);+ const detailTop = await detailRow.evaluate((element) => element.getBoundingClientRect().top);++ expect(afterRowTop).toBeLessThan(beforeRowTop - 150);+ expect(afterRowTop).toBeLessThan(viewportHeight * 0.42);+ expect(detailTop).toBeLessThan(viewportHeight - 48);+ });});