Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Extract dashboard selection state owner

rcourtman03709cf08390
diff --git a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
index 8f29ee6b3e..3370281f8b 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -31,60 +31,62 @@ regression protection.
9. `frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx`
10. `frontend-modern/src/components/Dashboard/useDashboardState.ts`
11. `frontend-modern/src/components/Dashboard/useDashboardGuestMetadataState.ts`
-12. `frontend-modern/src/components/Dashboard/useDashboardWorkloadRouteState.ts`
-13. `frontend-modern/src/components/Dashboard/DashboardFilter.tsx`
-14. `frontend-modern/src/components/Dashboard/dashboardFilterModel.ts`
-15. `frontend-modern/src/components/Dashboard/useDashboardFilterState.ts`
-16. `frontend-modern/src/components/Dashboard/ThresholdSlider.tsx`
-17. `frontend-modern/src/components/Dashboard/thresholdSliderModel.ts`
-18. `frontend-modern/src/components/Dashboard/useThresholdSliderState.ts`
-19. `frontend-modern/src/components/Dashboard/StackedDiskBar.tsx`
-20. `frontend-modern/src/components/Dashboard/stackedDiskBarModel.ts`
-21. `frontend-modern/src/components/Dashboard/useStackedDiskBarState.ts`
-22. `frontend-modern/src/components/Dashboard/StackedMemoryBar.tsx`
-23. `frontend-modern/src/components/Dashboard/stackedMemoryBarModel.ts`
-24. `frontend-modern/src/components/Dashboard/useStackedMemoryBarState.ts`
-25. `frontend-modern/src/components/Dashboard/MetricBar.tsx`
-26. `frontend-modern/src/components/Dashboard/metricBarModel.ts`
-27. `frontend-modern/src/components/Dashboard/useMetricBarState.ts`
-28. `frontend-modern/src/components/Dashboard/EnhancedCPUBar.tsx`
-29. `frontend-modern/src/components/Dashboard/enhancedCpuBarModel.ts`
-30. `frontend-modern/src/components/Dashboard/useEnhancedCPUBarState.ts`
-31. `frontend-modern/src/components/Dashboard/DiskList.tsx`
-32. `frontend-modern/src/components/Dashboard/diskListModel.ts`
-33. `frontend-modern/src/components/Dashboard/useDiskListState.ts`
-34. `frontend-modern/src/components/Dashboard/GuestRow.tsx`
-35. `frontend-modern/src/components/Dashboard/GuestRowCells.tsx`
-36. `frontend-modern/src/components/Dashboard/guestRowModel.tsx`
-37. `frontend-modern/src/components/Dashboard/useGuestRowState.ts`
-38. `frontend-modern/src/components/Dashboard/GuestDrawer.tsx`
-39. `frontend-modern/src/components/Dashboard/GuestDrawerOverview.tsx`
-40. `frontend-modern/src/components/Dashboard/guestDrawerModel.ts`
-41. `frontend-modern/src/components/Dashboard/useGuestDrawerState.ts`
-42. `frontend-modern/src/components/Dashboard/useGroupedTableWindowing.ts`
-43. `frontend-modern/src/components/Dashboard/workloadSelectors.ts`
-44. `frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx`
-45. `frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts`
-46. `frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts`
-47. `frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts`
-48. `frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx`
-49. `frontend-modern/src/components/Dashboard/__tests__/DashboardFilter.test.tsx`
-50. `frontend-modern/src/components/Dashboard/__tests__/useDashboardFilterState.test.ts`
-51. `frontend-modern/src/components/Dashboard/MetricBar.test.tsx`
-52. `frontend-modern/src/components/Dashboard/__tests__/useMetricBarState.test.tsx`
-53. `frontend-modern/src/components/Dashboard/__tests__/EnhancedCPUBar.test.tsx`
-54. `frontend-modern/src/components/Dashboard/__tests__/useEnhancedCPUBarState.test.tsx`
-55. `frontend-modern/src/components/Dashboard/ThresholdSlider.test.tsx`
-56. `frontend-modern/src/components/Dashboard/__tests__/useThresholdSliderState.test.ts`
-57. `frontend-modern/src/components/Dashboard/__tests__/StackedDiskBar.test.tsx`
-58. `frontend-modern/src/components/Dashboard/__tests__/useStackedDiskBarState.test.tsx`
-59. `frontend-modern/src/components/Dashboard/StackedMemoryBar.test.tsx`
-60. `frontend-modern/src/components/Dashboard/__tests__/useStackedMemoryBarState.test.tsx`
-61. `frontend-modern/src/components/Dashboard/__tests__/DiskList.test.tsx`
-62. `frontend-modern/src/components/Dashboard/__tests__/GuestRow.test.tsx`
-63. `frontend-modern/src/components/Dashboard/GuestDrawer.test.tsx`
-64. `frontend-modern/src/components/Dashboard/__tests__/useGroupedTableWindowing.test.ts`
-65. `frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx`
+12. `frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts`
+13. `frontend-modern/src/components/Dashboard/useDashboardWorkloadRouteState.ts`
+14. `frontend-modern/src/components/Dashboard/DashboardFilter.tsx`
+15. `frontend-modern/src/components/Dashboard/dashboardFilterModel.ts`
+16. `frontend-modern/src/components/Dashboard/useDashboardFilterState.ts`
+17. `frontend-modern/src/components/Dashboard/ThresholdSlider.tsx`
+18. `frontend-modern/src/components/Dashboard/thresholdSliderModel.ts`
+19. `frontend-modern/src/components/Dashboard/useThresholdSliderState.ts`
+20. `frontend-modern/src/components/Dashboard/StackedDiskBar.tsx`
+21. `frontend-modern/src/components/Dashboard/stackedDiskBarModel.ts`
+22. `frontend-modern/src/components/Dashboard/useStackedDiskBarState.ts`
+23. `frontend-modern/src/components/Dashboard/StackedMemoryBar.tsx`
+24. `frontend-modern/src/components/Dashboard/stackedMemoryBarModel.ts`
+25. `frontend-modern/src/components/Dashboard/useStackedMemoryBarState.ts`
+26. `frontend-modern/src/components/Dashboard/MetricBar.tsx`
+27. `frontend-modern/src/components/Dashboard/metricBarModel.ts`
+28. `frontend-modern/src/components/Dashboard/useMetricBarState.ts`
+29. `frontend-modern/src/components/Dashboard/EnhancedCPUBar.tsx`
+30. `frontend-modern/src/components/Dashboard/enhancedCpuBarModel.ts`
+31. `frontend-modern/src/components/Dashboard/useEnhancedCPUBarState.ts`
+32. `frontend-modern/src/components/Dashboard/DiskList.tsx`
+33. `frontend-modern/src/components/Dashboard/diskListModel.ts`
+34. `frontend-modern/src/components/Dashboard/useDiskListState.ts`
+35. `frontend-modern/src/components/Dashboard/GuestRow.tsx`
+36. `frontend-modern/src/components/Dashboard/GuestRowCells.tsx`
+37. `frontend-modern/src/components/Dashboard/guestRowModel.tsx`
+38. `frontend-modern/src/components/Dashboard/useGuestRowState.ts`
+39. `frontend-modern/src/components/Dashboard/GuestDrawer.tsx`
+40. `frontend-modern/src/components/Dashboard/GuestDrawerOverview.tsx`
+41. `frontend-modern/src/components/Dashboard/guestDrawerModel.ts`
+42. `frontend-modern/src/components/Dashboard/useGuestDrawerState.ts`
+43. `frontend-modern/src/components/Dashboard/useGroupedTableWindowing.ts`
+44. `frontend-modern/src/components/Dashboard/workloadSelectors.ts`
+45. `frontend-modern/src/components/Infrastructure/UnifiedResourceTable.tsx`
+46. `frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts`
+47. `frontend-modern/src/components/Infrastructure/infrastructureSelectors.ts`
+48. `frontend-modern/src/components/Infrastructure/resourceDetailMappers.ts`
+49. `frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx`
+50. `frontend-modern/src/components/Dashboard/__tests__/DashboardFilter.test.tsx`
+51. `frontend-modern/src/components/Dashboard/__tests__/useDashboardFilterState.test.ts`
+52. `frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts`
+53. `frontend-modern/src/components/Dashboard/MetricBar.test.tsx`
+54. `frontend-modern/src/components/Dashboard/__tests__/useMetricBarState.test.tsx`
+55. `frontend-modern/src/components/Dashboard/__tests__/EnhancedCPUBar.test.tsx`
+56. `frontend-modern/src/components/Dashboard/__tests__/useEnhancedCPUBarState.test.tsx`
+57. `frontend-modern/src/components/Dashboard/ThresholdSlider.test.tsx`
+58. `frontend-modern/src/components/Dashboard/__tests__/useThresholdSliderState.test.ts`
+59. `frontend-modern/src/components/Dashboard/__tests__/StackedDiskBar.test.tsx`
+60. `frontend-modern/src/components/Dashboard/__tests__/useStackedDiskBarState.test.tsx`
+61. `frontend-modern/src/components/Dashboard/StackedMemoryBar.test.tsx`
+62. `frontend-modern/src/components/Dashboard/__tests__/useStackedMemoryBarState.test.tsx`
+63. `frontend-modern/src/components/Dashboard/__tests__/DiskList.test.tsx`
+64. `frontend-modern/src/components/Dashboard/__tests__/GuestRow.test.tsx`
+65. `frontend-modern/src/components/Dashboard/GuestDrawer.test.tsx`
+66. `frontend-modern/src/components/Dashboard/__tests__/useGroupedTableWindowing.test.ts`
+67. `frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx`
## Shared Boundaries
@@ -108,15 +110,16 @@ regression protection.
10. Extend dashboard drawer derivations and runtime wiring through `frontend-modern/src/components/Dashboard/guestDrawerModel.ts` and `frontend-modern/src/components/Dashboard/useGuestDrawerState.ts`, and extend drawer overview rendering through `frontend-modern/src/components/Dashboard/GuestDrawerOverview.tsx`, rather than rebuilding canonical guest identity, discovery routing, or drawer-local normalization inside `frontend-modern/src/components/Dashboard/GuestDrawer.tsx`
11. Extend dashboard disk-list derivations and fallback runtime wiring through `frontend-modern/src/components/Dashboard/diskListModel.ts` and `frontend-modern/src/components/Dashboard/useDiskListState.ts` rather than rebuilding usage math, progress-state mapping, or tooltip fallback logic inside `frontend-modern/src/components/Dashboard/DiskList.tsx`
12. Extend dashboard guest metadata cache persistence, metadata refresh, org-scope switching, and optimistic custom-URL updates through `frontend-modern/src/components/Dashboard/useDashboardGuestMetadataState.ts` rather than rebuilding dashboard-local storage caches, event listeners, or guest metadata API wiring inside `frontend-modern/src/components/Dashboard/useDashboardState.ts`
-13. Extend dashboard workload route ownership, deep-link normalization, route-driven filter state, and workload filter-config assembly through `frontend-modern/src/components/Dashboard/useDashboardWorkloadRouteState.ts` rather than rebuilding query-param parsing, route sync, or host/runtime/namespace filter shaping inside `frontend-modern/src/components/Dashboard/useDashboardState.ts`
-14. Extend dashboard filter defaults, active-filter counting, reset semantics, and mobile toolbar state through `frontend-modern/src/components/Dashboard/dashboardFilterModel.ts` and `frontend-modern/src/components/Dashboard/useDashboardFilterState.ts`, rather than rebuilding filter-local state inside `frontend-modern/src/components/Dashboard/DashboardFilter.tsx`
-15. Extend threshold-slider value-position math, title/label derivation, and drag scroll-lock runtime through `frontend-modern/src/components/Dashboard/thresholdSliderModel.ts` and `frontend-modern/src/components/Dashboard/useThresholdSliderState.ts` rather than rebuilding slider-local state and pointer lifecycle inside `frontend-modern/src/components/Dashboard/ThresholdSlider.tsx`
-16. Extend stacked disk-bar capacity math, segment/tooltip derivation, and resize-observer runtime through `frontend-modern/src/components/Dashboard/stackedDiskBarModel.ts` and `frontend-modern/src/components/Dashboard/useStackedDiskBarState.ts` rather than rebuilding disk-bar-local state, mode branching, and tooltip shaping inside `frontend-modern/src/components/Dashboard/StackedDiskBar.tsx`
-17. Extend stacked memory-bar capacity math, balloon/swap derivation, and resize-observer runtime through `frontend-modern/src/components/Dashboard/stackedMemoryBarModel.ts` and `frontend-modern/src/components/Dashboard/useStackedMemoryBarState.ts` rather than rebuilding memory-bar-local state, tooltip shaping, and label-fit logic inside `frontend-modern/src/components/Dashboard/StackedMemoryBar.tsx`
-18. Extend metric-bar width, label-fit logic, and resize-observer runtime through `frontend-modern/src/components/Dashboard/metricBarModel.ts` and `frontend-modern/src/components/Dashboard/useMetricBarState.ts` rather than rebuilding metric-local state and threshold mapping inside `frontend-modern/src/components/Dashboard/MetricBar.tsx`
-19. Extend enhanced CPU bar usage/anomaly presentation and tooltip runtime through `frontend-modern/src/components/Dashboard/enhancedCpuBarModel.ts` and `frontend-modern/src/components/Dashboard/useEnhancedCPUBarState.ts` rather than rebuilding tooltip-local state and CPU-threshold formatting inside `frontend-modern/src/components/Dashboard/EnhancedCPUBar.tsx`
-20. Extend grouped dashboard row windowing, reveal-index clamping, overscan math, and per-group visible-slice derivation through `frontend-modern/src/components/Dashboard/useGroupedTableWindowing.ts` rather than rebuilding scroll handlers, mounted-row budgets, or group-slice math inside `frontend-modern/src/components/Dashboard/useDashboardState.ts`
-21. Extend dashboard shell rendering through `frontend-modern/src/components/Dashboard/DashboardStateCards.tsx`, `frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx`, and `frontend-modern/src/components/Dashboard/DashboardStatsStrip.tsx` rather than accreting loading cards, workload table markup, or stats-strip presentation back into `frontend-modern/src/components/Dashboard/Dashboard.tsx`
+13. Extend dashboard deep-link selection, hovered-row continuity, and table scroll preservation through `frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts` rather than rebuilding resource-query parsing, selected-row scroll pinning, or hovered-row invalidation inside `frontend-modern/src/components/Dashboard/useDashboardState.ts`
+14. Extend dashboard workload route ownership, deep-link normalization, route-driven filter state, and workload filter-config assembly through `frontend-modern/src/components/Dashboard/useDashboardWorkloadRouteState.ts` rather than rebuilding query-param parsing, route sync, or host/runtime/namespace filter shaping inside `frontend-modern/src/components/Dashboard/useDashboardState.ts`
+15. Extend dashboard filter defaults, active-filter counting, reset semantics, and mobile toolbar state through `frontend-modern/src/components/Dashboard/dashboardFilterModel.ts` and `frontend-modern/src/components/Dashboard/useDashboardFilterState.ts`, rather than rebuilding filter-local state inside `frontend-modern/src/components/Dashboard/DashboardFilter.tsx`
+16. Extend threshold-slider value-position math, title/label derivation, and drag scroll-lock runtime through `frontend-modern/src/components/Dashboard/thresholdSliderModel.ts` and `frontend-modern/src/components/Dashboard/useThresholdSliderState.ts` rather than rebuilding slider-local state and pointer lifecycle inside `frontend-modern/src/components/Dashboard/ThresholdSlider.tsx`
+17. Extend stacked disk-bar capacity math, segment/tooltip derivation, and resize-observer runtime through `frontend-modern/src/components/Dashboard/stackedDiskBarModel.ts` and `frontend-modern/src/components/Dashboard/useStackedDiskBarState.ts` rather than rebuilding disk-bar-local state, mode branching, and tooltip shaping inside `frontend-modern/src/components/Dashboard/StackedDiskBar.tsx`
+18. Extend stacked memory-bar capacity math, balloon/swap derivation, and resize-observer runtime through `frontend-modern/src/components/Dashboard/stackedMemoryBarModel.ts` and `frontend-modern/src/components/Dashboard/useStackedMemoryBarState.ts` rather than rebuilding memory-bar-local state, tooltip shaping, and label-fit logic inside `frontend-modern/src/components/Dashboard/StackedMemoryBar.tsx`
+19. Extend metric-bar width, label-fit logic, and resize-observer runtime through `frontend-modern/src/components/Dashboard/metricBarModel.ts` and `frontend-modern/src/components/Dashboard/useMetricBarState.ts` rather than rebuilding metric-local state and threshold mapping inside `frontend-modern/src/components/Dashboard/MetricBar.tsx`
+20. Extend enhanced CPU bar usage/anomaly presentation and tooltip runtime through `frontend-modern/src/components/Dashboard/enhancedCpuBarModel.ts` and `frontend-modern/src/components/Dashboard/useEnhancedCPUBarState.ts` rather than rebuilding tooltip-local state and CPU-threshold formatting inside `frontend-modern/src/components/Dashboard/EnhancedCPUBar.tsx`
+21. Extend grouped dashboard row windowing, reveal-index clamping, overscan math, and per-group visible-slice derivation through `frontend-modern/src/components/Dashboard/useGroupedTableWindowing.ts` rather than rebuilding scroll handlers, mounted-row budgets, or group-slice math inside `frontend-modern/src/components/Dashboard/useDashboardState.ts`
+22. Extend dashboard shell rendering through `frontend-modern/src/components/Dashboard/DashboardStateCards.tsx`, `frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx`, and `frontend-modern/src/components/Dashboard/DashboardStatsStrip.tsx` rather than accreting loading cards, workload table markup, or stats-strip presentation back into `frontend-modern/src/components/Dashboard/Dashboard.tsx`
## Forbidden Paths
diff --git a/docs/release-control/v6/internal/subsystems/registry.json b/docs/release-control/v6/internal/subsystems/registry.json
index f9c7497a30..8e816ef859 100644
--- a/docs/release-control/v6/internal/subsystems/registry.json
+++ b/docs/release-control/v6/internal/subsystems/registry.json
@@ -2579,6 +2579,7 @@
"frontend-modern/src/components/Dashboard/thresholdSliderModel.ts",
"frontend-modern/src/components/Dashboard/useDashboardFilterState.ts",
"frontend-modern/src/components/Dashboard/useDashboardGuestMetadataState.ts",
+ "frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts",
"frontend-modern/src/components/Dashboard/useDashboardState.ts",
"frontend-modern/src/components/Dashboard/useDashboardWorkloadRouteState.ts",
"frontend-modern/src/components/Dashboard/useDiskListState.ts",
@@ -2609,6 +2610,7 @@
"frontend-modern/src/components/Dashboard/__tests__/EnhancedCPUBar.test.tsx",
"frontend-modern/src/components/Dashboard/__tests__/StackedDiskBar.test.tsx",
"frontend-modern/src/components/Dashboard/__tests__/useDashboardFilterState.test.ts",
+ "frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts",
"frontend-modern/src/components/Dashboard/__tests__/useEnhancedCPUBarState.test.tsx",
"frontend-modern/src/components/Dashboard/__tests__/useGroupedTableWindowing.test.ts",
"frontend-modern/src/components/Dashboard/__tests__/useMetricBarState.test.tsx",
@@ -2673,6 +2675,7 @@
"frontend-modern/src/components/Dashboard/thresholdSliderModel.ts",
"frontend-modern/src/components/Dashboard/useDashboardFilterState.ts",
"frontend-modern/src/components/Dashboard/useDashboardGuestMetadataState.ts",
+ "frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts",
"frontend-modern/src/components/Dashboard/useDashboardState.ts",
"frontend-modern/src/components/Dashboard/useDashboardWorkloadRouteState.ts",
"frontend-modern/src/components/Dashboard/useDiskListState.ts",
@@ -2700,6 +2703,7 @@
"frontend-modern/src/components/Dashboard/__tests__/GuestRow.test.tsx",
"frontend-modern/src/components/Dashboard/__tests__/StackedDiskBar.test.tsx",
"frontend-modern/src/components/Dashboard/__tests__/useDashboardFilterState.test.ts",
+ "frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts",
"frontend-modern/src/components/Dashboard/__tests__/useEnhancedCPUBarState.test.tsx",
"frontend-modern/src/components/Dashboard/__tests__/useGroupedTableWindowing.test.ts",
"frontend-modern/src/components/Dashboard/__tests__/useMetricBarState.test.tsx",
diff --git a/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx b/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx
index 18a3a3d8ee..1b984ed1f1 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx
+++ b/frontend-modern/src/components/Dashboard/__tests__/Dashboard.performance.contract.test.tsx
@@ -10,6 +10,7 @@ import dashboardFilterSource from '../DashboardFilter.tsx?raw';
import dashboardWorkloadTableSource from '../DashboardWorkloadTable.tsx?raw';
import dashboardFilterModelSource from '../dashboardFilterModel.ts?raw';
import dashboardGuestMetadataStateSource from '../useDashboardGuestMetadataState.ts?raw';
+import dashboardSelectionStateSource from '../useDashboardSelectionState.ts?raw';
import dashboardWorkloadRouteStateSource from '../useDashboardWorkloadRouteState.ts?raw';
import dashboardStateSource from '../useDashboardState.ts?raw';
import dashboardFilterStateSource from '../useDashboardFilterState.ts?raw';
@@ -499,6 +500,7 @@ describe('Dashboard performance contract', () => {
expect(dashboardSource).toContain('DashboardWorkloadTable');
expect(dashboardSource).not.toContain('const [search, setSearch] = createSignal(');
expect(dashboardStateSource).toContain('useDashboardGuestMetadataState');
+ expect(dashboardStateSource).toContain('useDashboardSelectionState');
expect(dashboardStateSource).toContain('useDashboardWorkloadRouteState');
expect(dashboardStateSource).toContain('useGroupedTableWindowing');
expect(dashboardStateSource).toContain('createWorkloadSortComparator');
@@ -506,11 +508,19 @@ describe('Dashboard performance contract', () => {
expect(dashboardStateSource).not.toContain("from './GuestRow'");
expect(dashboardStateSource).not.toContain('GuestMetadataAPI.getAllMetadata()');
expect(dashboardStateSource).not.toContain('buildWorkloadsPath({');
+ expect(dashboardStateSource).not.toContain('parseWorkloadsLinkSearch');
+ expect(dashboardStateSource).not.toContain('const [selectedGuestId, setSelectedGuestIdRaw]');
+ expect(dashboardStateSource).not.toContain('const [hoveredWorkloadId, setHoveredWorkloadId]');
expect(dashboardGuestMetadataStateSource).toContain('GuestMetadataAPI.getAllMetadata()');
expect(dashboardGuestMetadataStateSource).toContain("eventBus.on('org_switched'");
expect(dashboardGuestMetadataStateSource).toContain("window.addEventListener('pulse:metadata-changed'");
expect(dashboardWorkloadRouteStateSource).toContain('buildWorkloadsPath({');
expect(dashboardWorkloadRouteStateSource).toContain('normalizeWorkloadViewModeParam');
+ expect(dashboardWorkloadRouteStateSource).toContain('setSelectedNode');
+ expect(dashboardSelectionStateSource).toContain('parseWorkloadsLinkSearch');
+ expect(dashboardSelectionStateSource).toContain('const [selectedGuestId, setSelectedGuestIdRaw]');
+ expect(dashboardSelectionStateSource).toContain('const [hoveredWorkloadId, setHoveredWorkloadId]');
+ expect(dashboardSelectionStateSource).toContain('setHandledResourceId(null)');
expect(groupedTableWindowingSource).toContain('DEFAULT_WINDOW_SIZE');
expect(groupedTableWindowingSource).toContain('DEFAULT_ENABLE_THRESHOLD');
expect(groupedTableWindowingSource).toContain('DEFAULT_OVERSCAN_ROWS');
diff --git a/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts b/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
new file mode 100644
index 0000000000..4571ee2acf
--- /dev/null
+++ b/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
@@ -0,0 +1,72 @@
+import { renderHook } from '@solidjs/testing-library';
+import { createSignal } from 'solid-js';
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+
+import type { WorkloadGuest } from '@/types/workloads';
+
+import { useDashboardSelectionState } from '../useDashboardSelectionState';
+
+let locationSearch = '?resource=cluster-a:node-1:101';
+
+vi.mock('@solidjs/router', () => ({
+ useLocation: () => ({
+ pathname: '/workloads',
+ get search() {
+ return locationSearch;
+ },
+ }),
+}));
+
+describe('useDashboardSelectionState', () => {
+ beforeEach(() => {
+ locationSearch = '?resource=cluster-a:node-1:101';
+ vi.stubGlobal('requestAnimationFrame', (cb: FrameRequestCallback) => {
+ cb(0);
+ return 1;
+ });
+ });
+
+ afterEach(() => {
+ vi.unstubAllGlobals();
+ });
+
+ it('owns dashboard resource deep-link selection and node synchronization', () => {
+ const [filteredGuests] = createSignal<WorkloadGuest[]>([]);
+ const setSelectedNode = vi.fn();
+
+ const { result } = renderHook(() =>
+ useDashboardSelectionState({
+ filteredGuests,
+ setSelectedNode,
+ }),
+ );
+
+ expect(result.selectedGuestId()).toBe('cluster-a:node-1:101');
+ expect(setSelectedNode).toHaveBeenCalledWith('cluster-a-node-1');
+ });
+
+ it('clears stale hovered workload ids when filtered guests change', () => {
+ const guest = {
+ id: 'cluster-a:node-1:101',
+ name: 'guest-1',
+ status: 'running',
+ instance: 'cluster-a',
+ node: 'node-1',
+ vmid: 101,
+ } as unknown as WorkloadGuest;
+ const [filteredGuests, setFilteredGuests] = createSignal<WorkloadGuest[]>([guest]);
+
+ const { result } = renderHook(() =>
+ useDashboardSelectionState({
+ filteredGuests,
+ setSelectedNode: vi.fn(),
+ }),
+ );
+
+ result.setHoveredWorkloadId('cluster-a:node-1:101');
+ expect(result.hoveredWorkloadId()).toBe('cluster-a:node-1:101');
+
+ setFilteredGuests([]);
+ expect(result.hoveredWorkloadId()).toBeNull();
+ });
+});
diff --git a/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts b/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts
new file mode 100644
index 0000000000..e31d7b44c1
--- /dev/null
+++ b/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts
@@ -0,0 +1,90 @@
+import { useLocation } from '@solidjs/router';
+import { createEffect, createSignal, type Accessor } from 'solid-js';
+
+import { parseWorkloadsLinkSearch } from '@/routing/resourceLinks';
+import { getCanonicalWorkloadId } from '@/utils/workloads';
+
+import type { WorkloadGuest } from '@/types/workloads';
+
+interface UseDashboardSelectionStateOptions {
+ filteredGuests: Accessor<WorkloadGuest[]>;
+ setSelectedNode: (value: string | null) => void;
+}
+
+export function useDashboardSelectionState(options: UseDashboardSelectionStateOptions) {
+ const location = useLocation();
+
+ const [selectedGuestId, setSelectedGuestIdRaw] = createSignal<string | null>(null);
+ const [hoveredWorkloadId, setHoveredWorkloadId] = createSignal<string | null>(null);
+ const [handledResourceId, setHandledResourceId] = createSignal<string | null>(null);
+
+ let tableRef: HTMLDivElement | undefined;
+ const [tableBodyRef, setTableBodyRef] = createSignal<HTMLTableSectionElement | null>(null);
+
+ const setTableWrapperRef = (element: HTMLDivElement | undefined) => {
+ tableRef = element;
+ };
+
+ const setSelectedGuestId = (id: string | null) => {
+ let scroller: HTMLElement | null = tableRef ?? null;
+ while (scroller) {
+ const { overflowY } = getComputedStyle(scroller);
+ if (
+ (overflowY === 'auto' || overflowY === 'scroll') &&
+ scroller.scrollHeight > scroller.clientHeight
+ ) {
+ break;
+ }
+ scroller = scroller.parentElement;
+ }
+
+ const scrollTop = scroller?.scrollTop ?? 0;
+ setSelectedGuestIdRaw(id);
+
+ if (scroller) scroller.scrollTop = scrollTop;
+ requestAnimationFrame(() => {
+ if (scroller) scroller.scrollTop = scrollTop;
+ });
+ };
+
+ createEffect(() => {
+ const { resource: resourceId } = parseWorkloadsLinkSearch(location.search);
+
+ if (!resourceId) {
+ if (handledResourceId() !== null) {
+ setHandledResourceId(null);
+ }
+ return;
+ }
+
+ if (resourceId === handledResourceId()) return;
+
+ setSelectedGuestId(resourceId);
+ const [instance, node, vmid] = resourceId.split(':');
+ if (instance && node && vmid) {
+ options.setSelectedNode(`${instance}-${node}`);
+ }
+ setHandledResourceId(resourceId);
+ });
+
+ createEffect(() => {
+ const hoveredId = hoveredWorkloadId();
+ if (!hoveredId) return;
+ const exists = options
+ .filteredGuests()
+ .some((guest) => getCanonicalWorkloadId(guest) === hoveredId);
+ if (!exists) {
+ setHoveredWorkloadId(null);
+ }
+ });
+
+ return {
+ hoveredWorkloadId,
+ selectedGuestId,
+ setHoveredWorkloadId,
+ setSelectedGuestId,
+ setTableBodyRef,
+ setTableWrapperRef,
+ tableBodyRef,
+ } as const;
+}
diff --git a/frontend-modern/src/components/Dashboard/useDashboardState.ts b/frontend-modern/src/components/Dashboard/useDashboardState.ts
index 44b86883e3..381158be27 100644
--- a/frontend-modern/src/components/Dashboard/useDashboardState.ts
+++ b/frontend-modern/src/components/Dashboard/useDashboardState.ts
@@ -1,5 +1,5 @@
import { createEffect, createMemo, createSignal, onCleanup } from 'solid-js';
-import { useLocation, useNavigate } from '@solidjs/router';
+import { useNavigate } from '@solidjs/router';
import type { VM, Container, Node } from '@/types/api';
import type { WorkloadGuest } from '@/types/workloads';
import { GUEST_COLUMNS, VIEW_MODE_COLUMNS } from './guestRowModel';
@@ -24,7 +24,6 @@ import {
getCanonicalWorkloadId,
} from '@/utils/workloads';
import { isSummaryTimeRange } from '@/components/shared/summaryTimeRange';
-import { parseWorkloadsLinkSearch } from '@/routing/resourceLinks';
import {
filterWorkloads,
getDiskUsagePercent,
@@ -40,6 +39,7 @@ import {
} from './workloadSelectors';
import { useGroupedTableWindowing } from './useGroupedTableWindowing';
import { useDashboardGuestMetadataState } from './useDashboardGuestMetadataState';
+import { useDashboardSelectionState } from './useDashboardSelectionState';
import { useDashboardWorkloadRouteState } from './useDashboardWorkloadRouteState';
import type { WorkloadSummarySnapshot } from '@/components/Workloads/WorkloadsSummary';
@@ -63,7 +63,6 @@ const workloadMetricPercent = (value: number | null | undefined): number => {
};
export function useDashboardState(props: DashboardProps) {
- const location = useLocation();
const navigate = useNavigate();
const ws = useWebSocket();
const { connected, activeAlerts, initialDataReceived, reconnecting, reconnect } = ws;
@@ -79,46 +78,6 @@ export function useDashboardState(props: DashboardProps) {
const dashboardDisconnectedState = createMemo(() => getDashboardDisconnectedState(reconnecting()));
const [isSearchLocked, setIsSearchLocked] = createSignal(false);
- const [selectedGuestId, setSelectedGuestIdRaw] = createSignal<string | null>(null);
- const [hoveredWorkloadId, setHoveredWorkloadId] = createSignal<string | null>(null);
- const [handledResourceId, setHandledResourceId] = createSignal<string | null>(null);
-
- let tableRef: HTMLDivElement | undefined;
- const [tableBodyRef, setTableBodyRef] = createSignal<HTMLTableSectionElement | null>(null);
- const setTableWrapperRef = (element: HTMLDivElement | undefined) => {
- tableRef = element;
- };
-
- const setSelectedGuestId = (id: string | null) => {
- let scroller: HTMLElement | null = tableRef ?? null;
- while (scroller) {
- const { overflowY } = getComputedStyle(scroller);
- if (
- (overflowY === 'auto' || overflowY === 'scroll') &&
- scroller.scrollHeight > scroller.clientHeight
- ) {
- break;
- }
- scroller = scroller.parentElement;
- }
- const scrollTop = scroller?.scrollTop ?? 0;
- setSelectedGuestIdRaw(id);
- if (scroller) scroller.scrollTop = scrollTop;
- requestAnimationFrame(() => {
- if (scroller) scroller.scrollTop = scrollTop;
- });
- };
-
- createEffect(() => {
- const { resource: resourceId } = parseWorkloadsLinkSearch(location.search);
- if (!resourceId || resourceId === handledResourceId()) return;
- setSelectedGuestId(resourceId);
- const [instance, node, vmid] = resourceId.split(':');
- if (instance && node && vmid) {
- setSelectedNode(`${instance}-${node}`);
- }
- setHandledResourceId(resourceId);
- });
const { guestMetadata, handleCustomUrlUpdate } = useDashboardGuestMetadataState();
@@ -326,6 +285,19 @@ export function useDashboardState(props: DashboardProps) {
return filterWorkloads(params);
});
+ const {
+ hoveredWorkloadId,
+ selectedGuestId,
+ setHoveredWorkloadId,
+ setSelectedGuestId,
+ setTableBodyRef,
+ setTableWrapperRef,
+ tableBodyRef,
+ } = useDashboardSelectionState({
+ filteredGuests,
+ setSelectedNode,
+ });
+
const workloadsSummaryVisibleIds = createMemo<string[]>(() =>
filteredGuests().map((guest) => getCanonicalWorkloadId(guest)),
);
@@ -371,15 +343,6 @@ export function useDashboardState(props: DashboardProps) {
}),
);
- createEffect(() => {
- const hoveredId = hoveredWorkloadId();
- if (!hoveredId) return;
- const exists = filteredGuests().some((guest) => getCanonicalWorkloadId(guest) === hoveredId);
- if (!exists) {
- setHoveredWorkloadId(null);
- }
- });
-
const getGroupLabel = (
groupKey: string,
guests: WorkloadGuest[],
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index b53d6203ce..17342bbc06 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -86,6 +86,7 @@ import dashboardFilterSource from '@/components/Dashboard/DashboardFilter.tsx?ra
import dashboardWorkloadTableSource from '@/components/Dashboard/DashboardWorkloadTable.tsx?raw';
import dashboardFilterModelSource from '@/components/Dashboard/dashboardFilterModel.ts?raw';
import dashboardGuestMetadataStateSource from '@/components/Dashboard/useDashboardGuestMetadataState.ts?raw';
+import dashboardSelectionStateSource from '@/components/Dashboard/useDashboardSelectionState.ts?raw';
import dashboardWorkloadRouteStateSource from '@/components/Dashboard/useDashboardWorkloadRouteState.ts?raw';
import dashboardStateSource from '@/components/Dashboard/useDashboardState.ts?raw';
import dashboardFilterStateSource from '@/components/Dashboard/useDashboardFilterState.ts?raw';
@@ -517,6 +518,7 @@ describe('frontend resource type boundaries', () => {
expect(dashboardSource).toContain('DashboardWorkloadTable');
expect(dashboardSource).not.toContain('const [search, setSearch] = createSignal(');
expect(dashboardStateSource).toContain('useDashboardGuestMetadataState');
+ expect(dashboardStateSource).toContain('useDashboardSelectionState');
expect(dashboardStateSource).toContain('useDashboardWorkloadRouteState');
expect(dashboardWorkloadRouteStateSource).toContain('normalizeWorkloadViewModeParam');
expect(dashboardSource).not.toContain('function normalizeViewModeParam');
@@ -532,7 +534,15 @@ describe('frontend resource type boundaries', () => {
expect(dashboardGuestMetadataStateSource).toContain('GuestMetadataAPI.getAllMetadata()');
expect(dashboardGuestMetadataStateSource).toContain("eventBus.on('org_switched'");
expect(dashboardStateSource).not.toContain('buildWorkloadsPath({');
+ expect(dashboardStateSource).not.toContain('parseWorkloadsLinkSearch');
+ expect(dashboardStateSource).not.toContain('const [selectedGuestId, setSelectedGuestIdRaw]');
+ expect(dashboardStateSource).not.toContain('const [hoveredWorkloadId, setHoveredWorkloadId]');
expect(dashboardWorkloadRouteStateSource).toContain('buildWorkloadsPath({');
+ expect(dashboardWorkloadRouteStateSource).toContain('setSelectedNode');
+ expect(dashboardSelectionStateSource).toContain('parseWorkloadsLinkSearch');
+ expect(dashboardSelectionStateSource).toContain('const [selectedGuestId, setSelectedGuestIdRaw]');
+ expect(dashboardSelectionStateSource).toContain('const [hoveredWorkloadId, setHoveredWorkloadId]');
+ expect(dashboardSelectionStateSource).toContain('setHandledResourceId(null)');
expect(dashboardStateSource).not.toContain('const guestId = () => {');
expect(dashboardFilterSource).toContain('useDashboardFilterState');
expect(dashboardFilterSource).not.toContain('const [filtersOpen, setFiltersOpen] =');
diff --git a/scripts/release_control/subsystem_lookup_test.py b/scripts/release_control/subsystem_lookup_test.py
index b1995b1c4a..767ec25d82 100644
--- a/scripts/release_control/subsystem_lookup_test.py
+++ b/scripts/release_control/subsystem_lookup_test.py
@@ -1989,6 +1989,33 @@ class SubsystemLookupTest(unittest.TestCase):
"dashboard-workload-hot-path",
)
+ def test_lookup_paths_assigns_dashboard_selection_runtime_to_performance_and_scalability(
+ self,
+ ) -> None:
+ result = lookup_paths(
+ ["frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts"]
+ )
+ self.assertEqual(result["unowned_runtime_files"], [])
+ self.assertEqual(
+ {item["subsystem"] for item in result["impacted_subsystems"]},
+ {"performance-and-scalability"},
+ )
+ file_entry = result["files"][0]
+ self.assertEqual(file_entry["classification"], "runtime")
+ self.assertEqual(
+ {match["subsystem"] for match in file_entry["matches"]},
+ {"performance-and-scalability"},
+ )
+ match = file_entry["matches"][0]
+ self.assertEqual(
+ match["contract"],
+ "docs/release-control/v6/internal/subsystems/performance-and-scalability.md",
+ )
+ self.assertEqual(
+ match["verification_requirement"]["id"],
+ "dashboard-workload-hot-path",
+ )
+
def test_lookup_paths_assigns_dashboard_grouped_windowing_runtime_to_performance_and_scalability(
self,
) -> None: