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
Split unified resource table viewport sync owner
rcourtman6a61f8f61f60
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.mdindex 563e3b8c05..ac1c9ba54f 100644--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md@@ -84,8 +84,9 @@ regression protection.62. `frontend-modern/src/components/Dashboard/__tests__/workloadTopology.test.ts`63. `frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx`64. `frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts`-65. `frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx`-66. `frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx`+65. `frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts`+66. `frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx`+67. `frontend-modern/src/components/Infrastructure/UnifiedResourcePBSTableSection.tsx`67. `frontend-modern/src/components/Infrastructure/UnifiedResourcePMGTableSection.tsx`68. `frontend-modern/src/components/Infrastructure/UnifiedResourceServiceInfrastructureCard.tsx`69. `frontend-modern/src/components/Infrastructure/unifiedResourceTableModel.ts`@@ -124,7 +125,8 @@ regression protection.7. `frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx` shared with `unified-resources`: the unified resource table is both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.8. `frontend-modern/src/components/Infrastructure/unifiedResourceTableModel.ts` shared with `unified-resources`: unified resource service row shaping and I/O emphasis are both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.9. `frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts` shared with `unified-resources`: unified resource table state, grouping, and windowing are both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.-10. `internal/api/slo.go` shared with `api-contracts`: the SLO endpoint is both an API contract surface and a protected performance hot-path boundary.+10. `frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts` shared with `unified-resources`: unified resource table viewport sync and selected-row reveal are both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.+11. `internal/api/slo.go` shared with `api-contracts`: the SLO endpoint is both an API contract surface and a protected performance hot-path boundary.## Extension Points@@ -311,10 +313,12 @@ The unified resource table hot path is now also governed as explicitperformance-owned runtime, with shared ownership against the unified-resourceconsumer boundary. The remaining performance work is no longer top-levelownership ambiguity on the main dashboard or infrastructure tables.-The table's sort, grouping, row-windowing, and viewport-sync owner now lives-in `frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts`,-so future hot-path table-state changes must route through that state owner-instead of rebuilding selector and scroll coordination inside the render shell.+The table's sort, grouping, and row-windowing owner now lives in+`frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts`,+while viewport-sync and selected-row reveal behavior now live in+`frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts`,+so future hot-path table-state changes must not fold selector and scroll+coordination back into one mixed owner or the render shell.That hot-path contract now includes policy badge rendering on resource rows.It now also includes the compact resource-facet summary chips rendered nextto policy metadata, and those chips must stay within the same boundeddiff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.jsonindex a5776555d3..dee696944c 100644--- a/docs/release-control/v6/internal/subsystems/registry.json+++ b/docs/release-control/v6/internal/subsystems/registry.json@@ -129,6 +129,14 @@"unified-resources"]},+ {+ "path": "frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts",+ "rationale": "unified resource table viewport sync and selected-row reveal are both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary",+ "subsystems": [+ "performance-and-scalability",+ "unified-resources"+ ]+ },{"path": "frontend-modern/src/components/Settings/APITokenManager.tsx","rationale": "the API token settings surface is both a security/privacy control surface and a canonical API payload contract boundary",@@ -2663,6 +2671,7 @@"frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx","frontend-modern/src/components/Infrastructure/unifiedResourceTableModel.ts","frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts",+ "frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts","internal/api/router_bench_test.go","internal/api/slo.go","internal/api/slo_bench_test.go"@@ -2782,7 +2791,8 @@"frontend-modern/src/components/Infrastructure/UnifiedResourceServiceInfrastructureCard.tsx","frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx","frontend-modern/src/components/Infrastructure/unifiedResourceTableModel.ts",- "frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts"+ "frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts",+ "frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts"],"allow_same_subsystem_tests": false,"test_prefixes": [],@@ -3170,6 +3180,7 @@"frontend-modern/src/components/Infrastructure/useResourceDetailDrawerHistoryState.ts","frontend-modern/src/components/Infrastructure/useResourceDetailDrawerState.ts","frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts",+ "frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts","frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx","frontend-modern/src/features/infrastructure/useInfrastructurePageRouteState.ts","frontend-modern/src/features/infrastructure/useInfrastructurePageState.ts",@@ -3255,6 +3266,7 @@"frontend-modern/src/components/Infrastructure/useResourceDetailDrawerHistoryState.ts","frontend-modern/src/components/Infrastructure/useResourceDetailDrawerState.ts","frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts",+ "frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts","frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx","frontend-modern/src/features/infrastructure/useInfrastructurePageRouteState.ts","frontend-modern/src/features/infrastructure/useInfrastructurePageState.ts",diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.mdindex 5891e5dbbc..8635a84474 100644--- a/docs/release-control/v6/internal/subsystems/unified-resources.md+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md@@ -57,11 +57,12 @@ cross-source deduplication.35. `frontend-modern/src/components/Infrastructure/useResourceDetailDrawerHistoryState.ts`36. `frontend-modern/src/components/Infrastructure/useResourceDetailDrawerState.ts`37. `frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts`-38. `frontend-modern/src/components/Discovery/DiscoveryTab.tsx`-39. `frontend-modern/src/components/Discovery/useDiscoveryTabState.ts`-40. `frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx`-41. `frontend-modern/src/features/infrastructure/useInfrastructurePageRouteState.ts`-42. `frontend-modern/src/features/infrastructure/useInfrastructurePageState.ts`+38. `frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts`+39. `frontend-modern/src/components/Discovery/DiscoveryTab.tsx`+40. `frontend-modern/src/components/Discovery/useDiscoveryTabState.ts`+41. `frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx`+42. `frontend-modern/src/features/infrastructure/useInfrastructurePageRouteState.ts`+43. `frontend-modern/src/features/infrastructure/useInfrastructurePageState.ts`## Shared Boundaries@@ -74,7 +75,8 @@ cross-source deduplication.7. `frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx` shared with `performance-and-scalability`: the unified resource table is both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.8. `frontend-modern/src/components/Infrastructure/unifiedResourceTableModel.ts` shared with `performance-and-scalability`: unified resource service row shaping and I/O emphasis are both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.9. `frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts` shared with `performance-and-scalability`: unified resource table state, grouping, and windowing are both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.-10. `internal/api/resources.go` shared with `api-contracts`: the unified resource endpoint is both a backend payload contract surface and a unified-resource runtime boundary.+10. `frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts` shared with `performance-and-scalability`: unified resource table viewport sync and selected-row reveal are both a canonical unified-resource consumer surface and a fleet-scale performance hot-path boundary.+11. `internal/api/resources.go` shared with `api-contracts`: the unified resource endpoint is both a backend payload contract surface and a unified-resource runtime boundary.## Extension Points@@ -237,8 +239,10 @@ the label locally.The unified resource table now routes sort state, grouped host/serviceprojection, canonical resource-label resolution, and row-windowing through`frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts`,-so the shared consumer model is owned by one state boundary instead of-staying interleaved with the render shell.+while viewport reveal and scroll synchronization now route through+`frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts`,+so the shared consumer model is no longer interleaving selector derivation and+DOM viewport coordination inside one state boundary.The canonical unified-resource change and relationship presenters now alsoshare the same elapsed-time and "ago" wording utilities, so `observed`,`last seen`, and `ago` fragments stay consistent without each formatterdiff --git a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsxindex 925e7c9bc5..49b1c9da64 100644--- a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx+++ b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx@@ -7,6 +7,7 @@ import { formatSensorName } from '@/components/Infrastructure/resourceDetailMappimport { getPreferredResourceDisplayName } from '@/utils/resourceIdentity';import unifiedResourceTableSource from '@/components/Infrastructure/UnifiedResourceTable.tsx?raw';import unifiedResourceTableStateSource from '@/components/Infrastructure/useUnifiedResourceTableState.ts?raw';+import unifiedResourceTableViewportSyncSource from '@/components/Infrastructure/useUnifiedResourceTableViewportSync.ts?raw';import unifiedResourceTableModelSource from '@/components/Infrastructure/unifiedResourceTableModel.ts?raw';import {buildStatusOptions,@@ -187,6 +188,13 @@ describe('UnifiedResourceTable performance contract', () => {expect(unifiedResourceTableSource).not.toContain('const getPBSTableRow =');expect(unifiedResourceTableStateSource).toContain('splitPrimaryAndServiceResources');expect(unifiedResourceTableStateSource).toContain('useTableWindowing');+ expect(unifiedResourceTableStateSource).toContain('useUnifiedResourceTableViewportSync');+ expect(unifiedResourceTableStateSource).not.toContain('window.addEventListener');+ expect(unifiedResourceTableStateSource).not.toContain('getBoundingClientRect');+ expect(unifiedResourceTableViewportSyncSource).toContain('window.addEventListener');+ expect(unifiedResourceTableViewportSyncSource).toContain('getBoundingClientRect');+ expect(unifiedResourceTableViewportSyncSource).toContain('scrollIntoView');+ expect(unifiedResourceTableViewportSyncSource).toContain('hostWindowing.onScroll');expect(unifiedResourceTableModelSource).toContain('export const getPBSTableRow');expect(unifiedResourceTableModelSource).toContain('export const getPMGTableRow');expect(unifiedResourceTableModelSource).toContain('export const getOutlierEmphasis');diff --git a/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts b/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.tsindex c087dfe517..de7266b979 100644--- a/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts+++ b/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts@@ -1,4 +1,4 @@-import { createEffect, createMemo, createSignal, onCleanup } from 'solid-js';+import { createMemo, createSignal } from 'solid-js';import type { Resource } from '@/types/resource';import { useBreakpoint } from '@/hooks/useBreakpoint';import { getPreferredResourceDisplayName } from '@/utils/resourceIdentity';@@ -10,6 +10,7 @@ import {type ResourceGroup,} from '@/components/Infrastructure/infrastructureSelectors';import { useTableWindowing } from './useTableWindowing';+import { useUnifiedResourceTableViewportSync } from './useUnifiedResourceTableViewportSync';export interface UnifiedResourceTableProps {resources: Resource[];@@ -54,8 +55,6 @@ export function useUnifiedResourceTableState(props: UnifiedResourceTableProps) {const { isMobile, isVisible } = useBreakpoint();const [sortKey, setSortKey] = createSignal<SortKey>('default');const [sortDirection, setSortDirection] = createSignal<'asc' | 'desc'>('asc');- const [hostBodyRef, setHostBodyRef] = createSignal<HTMLTableSectionElement | null>(null);- const rowRefs = new Map<string, HTMLTableRowElement>();const split = createMemo(() => splitPrimaryAndServiceResources(props.resources));const primaryResources = createMemo(() => split().primaryResources);@@ -133,15 +132,12 @@ export function useUnifiedResourceTableState(props: UnifiedResourceTableProps) {): 0,);-- const syncHostWindowToViewport = () => {- if (!hostWindowing.isWindowed() || typeof window === 'undefined') return;- const body = hostBodyRef();- if (!body) return;- const rect = body.getBoundingClientRect();- const scrollTop = Math.max(0, -rect.top);- hostWindowing.onScroll(scrollTop, window.innerHeight, HOST_TABLE_ESTIMATED_ROW_HEIGHT);- };+ const viewportSync = useUnifiedResourceTableViewportSync({+ expandedResourceId: () => props.expandedResourceId,+ totalCount: () => hostTableItems().length,+ estimatedRowHeight: HOST_TABLE_ESTIMATED_ROW_HEIGHT,+ hostWindowing,+ });const sortedPBSResources = createMemo(() =>sortResources(@@ -183,44 +179,6 @@ export function useUnifiedResourceTableState(props: UnifiedResourceTableProps) {props.onExpandedResourceChange(props.expandedResourceId === resourceId ? null : resourceId);};- const registerRowRef = (resourceId: string, element?: HTMLTableRowElement) => {- if (element) {- rowRefs.set(resourceId, element);- return;- }- rowRefs.delete(resourceId);- };-- createEffect(() => {- const selectedId = props.expandedResourceId;- if (!selectedId) return;- hostWindowing.startIndex();- hostWindowing.endIndex();- const row = rowRefs.get(selectedId);- if (row) {- row.scrollIntoView({ block: 'center', behavior: 'smooth' });- }- });-- createEffect(() => {- if (typeof window === 'undefined') return;- hostTableItems().length;- if (!hostWindowing.isWindowed()) return;- if (!hostBodyRef()) return;-- const handleViewportChange = () => {- syncHostWindowToViewport();- };-- handleViewportChange();- window.addEventListener('scroll', handleViewportChange, { passive: true });- window.addEventListener('resize', handleViewportChange);- onCleanup(() => {- window.removeEventListener('scroll', handleViewportChange);- window.removeEventListener('resize', handleViewportChange);- });- });-const resourceColumnStyle = createMemo(() =>isMobile() ? { width: '100%', 'min-width': '120px' } : { 'min-width': '220px' },);@@ -292,8 +250,7 @@ export function useUnifiedResourceTableState(props: UnifiedResourceTableProps) {sortedPBSResources,sortedPMGResources,ioScale,- registerRowRef,- setHostBodyRef,+ ...viewportSync,resourceColumnStyle,metricColumnStyle,ioColumnStyle,diff --git a/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts b/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.tsnew file mode 100644index 0000000000..de3c26efd2--- /dev/null+++ b/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableViewportSync.ts@@ -0,0 +1,73 @@+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>;+}++export function useUnifiedResourceTableViewportSync(+ options: UseUnifiedResourceTableViewportSyncOptions,+) {+ const { expandedResourceId, 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;+ const body = hostBodyRef();+ if (!body) return;+ const rect = body.getBoundingClientRect();+ const scrollTop = Math.max(0, -rect.top);+ 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) {+ row.scrollIntoView({ block: 'center', behavior: 'smooth' });+ }+ });++ createEffect(() => {+ if (typeof window === 'undefined') return;+ totalCount();+ if (!hostWindowing.isWindowed()) return;+ if (!hostBodyRef()) return;++ const handleViewportChange = () => {+ syncHostWindowToViewport();+ };++ handleViewportChange();+ window.addEventListener('scroll', handleViewportChange, { passive: true });+ window.addEventListener('resize', handleViewportChange);+ onCleanup(() => {+ window.removeEventListener('scroll', handleViewportChange);+ window.removeEventListener('resize', handleViewportChange);+ });+ });++ return {+ registerRowRef,+ setHostBodyRef,+ };+}++export type UnifiedResourceTableViewportSync = ReturnType<+ typeof useUnifiedResourceTableViewportSync+>;diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.tsindex 41c61e2b78..84d70777b6 100644--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts@@ -252,6 +252,7 @@ import resourceDetailDrawerDerivedStateSource from '@/components/Infrastructure/import resourceDetailDrawerStateSource from '@/components/Infrastructure/useResourceDetailDrawerState.ts?raw';import unifiedResourceTableSource from '@/components/Infrastructure/UnifiedResourceTable.tsx?raw';import unifiedResourceTableStateSource from '@/components/Infrastructure/useUnifiedResourceTableState.ts?raw';+import unifiedResourceTableViewportSyncSource from '@/components/Infrastructure/useUnifiedResourceTableViewportSync.ts?raw';import unifiedResourceTableModelSource from '@/components/Infrastructure/unifiedResourceTableModel.ts?raw';import useUnifiedResourcesSource from '@/hooks/useUnifiedResources.ts?raw';import useWorkloadsSource from '@/hooks/useWorkloads.ts?raw';@@ -2604,6 +2605,12 @@ describe('frontend resource type boundaries', () => {expect(unifiedResourceTableModelSource).toContain('export const getOutlierEmphasis');expect(unifiedResourceTableStateSource).toContain('splitPrimaryAndServiceResources');expect(unifiedResourceTableStateSource).toContain('useTableWindowing');+ expect(unifiedResourceTableStateSource).toContain('useUnifiedResourceTableViewportSync');+ expect(unifiedResourceTableStateSource).not.toContain('window.addEventListener');+ expect(unifiedResourceTableStateSource).not.toContain('getBoundingClientRect');+ expect(unifiedResourceTableViewportSyncSource).toContain('window.addEventListener');+ expect(unifiedResourceTableViewportSyncSource).toContain('getBoundingClientRect');+ expect(unifiedResourceTableViewportSyncSource).toContain('scrollIntoView');expect(exploreStatusBlockSource).toContain('getAIExploreStatusPresentation');expect(exploreStatusBlockSource).not.toContain('const phaseLabel =');expect(exploreStatusBlockSource).not.toContain('const phaseClasses =');