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.

fix(frontend): unify summary group focus

rcourtman456da7f991f6
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 5b7fd9a3e2..576965a321 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -146,7 +146,7 @@ work extends shared components instead of creating new local variants.
5. Keep shared platform-connections shell state on the reusable settings boundary: `frontend-modern/src/components/Settings/useSettingsInfrastructurePanelProps.ts`, `frontend-modern/src/components/Settings/InfrastructurePlatformConnectionsSummaryCard.tsx`, and `frontend-modern/src/components/Settings/PlatformConnectionsWorkspace.tsx` must continue to derive provider counts, availability, and shared subtab copy from one infrastructure-settings source instead of creating provider-local summary fetches or VMware-only shell vocabulary.
6. Keep shared storage feature presenters on canonical platform truth. When reusable storage presenters under `frontend-modern/src/features/storageBackups/` classify canonical resources for the shared storage route, API-backed virtualization datastores such as VMware must stay inventory-only datastores instead of inheriting PBS-specific backup-repository or protected-target copy from older fallback branches.
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. The shared summary-card contract must also own stable summary-card geometry for chart-backed cards so row hover, focus, synchronized readouts, or idle header metadata cannot ratchet the sticky summary taller across rerenders.
-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 workload group header or infrastructure cluster header must scope every card to that group without forking a page-local summary filter path. Sibling cards should surface that synchronized hover as one compact header readout through the shared summary-card contract, while the chart under the pointer keeps the only floating tooltip.
+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 or pinning a workload group header, infrastructure cluster header, or storage pool-group header must scope the matching summary cards through that same shared contract instead of forking a page-local summary filter path. Sibling cards should surface that synchronized hover as one compact header readout through the shared summary-card contract, while the chart under the pointer keeps the only floating tooltip. `frontend-modern/src/components/Recovery/RecoverySummary.tsx` is explicitly outside this interaction dialect: recovery posture cards may share summary framing, but they must not silently grow row/group/chart hover behavior without a separate governed product decision.
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, 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.
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 58188237e7..57c26b8967 100644
--- a/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
+++ b/docs/release-control/v6/internal/subsystems/performance-and-scalability.md
@@ -166,7 +166,7 @@ regression protection.
24. 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`
25. Extend dashboard workload table shell ownership through `frontend-modern/src/components/Dashboard/WorkloadTableHeader.tsx` and `frontend-modern/src/components/Dashboard/WorkloadPanel.tsx` rather than rebuilding sortable header markup, grouped node rows, row expansion, or guest-drawer rendering inside `frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx`
26. Keep long-range workload chart capping time-proportional across `frontend-modern/src/components/Workloads/WorkloadsSummary.tsx`, `frontend-modern/src/api/charts.ts`, and `internal/api/router.go`: when the workload hot path caps mixed-cadence history for top cards, it must bucket by time window rather than raw point index so 7-day and 30-day workload cards stay visually even without relaxing the protected payload budget.
-27. Keep summary hover/focus and sticky-card behavior on shared hot paths: infrastructure, workloads, and storage summary shells must reuse one page/group/entity scope model plus `frontend-modern/src/components/shared/StickySummarySection.tsx` inside the app scroll shell instead of per-page scroll listeners or per-card hover derivations, so row scrubbing highlights all cards, workload group headers and infrastructure cluster headers scope the summary coherently, and the hot path does not multiply render or scroll work. That same hot path must keep chart-backed summary-card geometry explicit and stable so hover rerenders, synchronized readouts, or idle header metadata cannot feed layout loops that grow or shrink the top cards over time.
+27. Keep summary hover/focus and sticky-card behavior on shared hot paths: infrastructure, workloads, and storage summary shells must reuse one page/group/entity scope model plus `frontend-modern/src/components/shared/StickySummarySection.tsx` inside the app scroll shell instead of per-page scroll listeners or per-card hover derivations, so row scrubbing highlights all cards, workload group headers, infrastructure cluster headers, and storage pool-group headers scope the summary coherently, pinned group focus remains route-backed and reversible, and the hot path does not multiply render or scroll work. That same hot path must keep chart-backed summary-card geometry explicit and stable so hover rerenders, synchronized readouts, or idle header metadata cannot feed layout loops that grow or shrink the top cards over time. Recovery’s summary rail is not part of this interactive hot path; it may share summary-card framing, but it must remain non-interactive until a separately governed model says otherwise.
28. Keep summary-card hover emphasis on one bounded rendering budget: when a summary row is active, shared sparkline and density-map primitives must promote the selected series and demote background series through the same active-series ID rather than layering a second page-local highlight pass, so zoom-range and hover scrubbing stay visually coherent without reintroducing multi-series overdraw on the hot summary cards. Density maps on that hot path must stay overview-first under focus: preserve the multi-entity heatmap rows, layer focused-entity detail inside the card, and avoid swapping transient hover into a separate single-series chart path.
## Forbidden Paths
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index d27fa55251..314cf94905 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -765,6 +765,13 @@ supporting rail, not as several equal-weight dashboard cards. The governed
recovery summary should keep the left side focused on posture, attention, and
freshness, while the right side carries compact coverage and recent-history
reference detail instead of competing headline widgets.
+That recovery summary rail is intentionally not part of the interactive
+page/group/entity summary contract used by workloads, infrastructure, and
+storage. `frontend-modern/src/components/Recovery/RecoverySummary.tsx` may
+reuse shared summary-card framing, but it must remain a static posture surface:
+no synchronized chart hover, no row-driven group scope, and no implicit
+adoption of `summaryCardInteraction.ts` without a separate governed product
+decision that proves recovery actually wants that interaction model.
That same workspace shell should stay a compact control strip rather than a
second summary card: the protected-items versus recovery-events switcher belongs
close to the active table surface, and it should not restate table counts that
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index ac367331e5..55504b14ad 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -208,7 +208,10 @@ assembly branch.
plus `frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts`
must consume that scope through the shared page/group/entity interaction
contract rather than inventing infrastructure-local summary filters or
- route-backed cluster hover state.
+ route-backed cluster hover state. Deliberate cluster focus must also stay
+ on the canonical infrastructure route through the shared `summaryGroup`
+ query state, so pinned scope is shareable, reversible, and owned by the
+ same route-backed summary contract as row focus.
14. Keep infrastructure row emphasis on the shared frontend presentation
contract. Host, PBS, and PMG table sections may decide whether a resource
is contextually active, but they must expose that state through
diff --git a/frontend-modern/src/components/Dashboard/Dashboard.tsx b/frontend-modern/src/components/Dashboard/Dashboard.tsx
index 4c45e85b51..8dff80c7b4 100644
--- a/frontend-modern/src/components/Dashboard/Dashboard.tsx
+++ b/frontend-modern/src/components/Dashboard/Dashboard.tsx
@@ -24,7 +24,8 @@ export function Dashboard(props: DashboardProps) {
fallbackSnapshots={state.workloadsSummaryFallbackSnapshots()}
visibleWorkloadIds={state.workloadsSummaryVisibleIds()}
chartHoverSync={state.chartHoverSync()}
- hoveredGroupScope={state.activeSummaryWorkloadGroupScope()}
+ hoveredGroupScope={state.hoveredSummaryWorkloadGroupScope()}
+ focusedGroupScope={state.focusedSummaryWorkloadGroupScope()}
hoveredWorkloadId={state.hoveredWorkloadId()}
focusedWorkloadId={state.selectedGuestId()}
onChartHoverSyncChange={state.setChartHoverSync}
@@ -115,12 +116,14 @@ export function Dashboard(props: DashboardProps) {
handleTagClick={state.handleTagClick}
activeSummaryWorkloadGroupScope={state.activeSummaryWorkloadGroupScope}
activeSummaryWorkloadId={state.activeSummaryWorkloadId}
+ focusedSummaryWorkloadGroupId={state.focusedSummaryWorkloadGroupId}
isMobile={state.isMobile}
mobileVisibleColumnIds={state.mobileVisibleColumnIds}
mobileVisibleColumns={state.mobileVisibleColumns}
nodeByInstance={state.nodeByInstance}
search={state.search}
selectedGuestId={state.selectedGuestId}
+ setFocusedWorkloadGroupScope={state.setFocusedWorkloadGroupScope}
setHoveredWorkloadGroupScope={state.setHoveredWorkloadGroupScope}
setHoveredWorkloadId={state.setHoveredWorkloadId}
setSelectedGuestId={state.setSelectedGuestId}
diff --git a/frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx b/frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx
index be31b446d7..6b8a339dd6 100644
--- a/frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx
+++ b/frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx
@@ -22,12 +22,14 @@ type DashboardWorkloadTableProps = Pick<
| 'handleTagClick'
| 'activeSummaryWorkloadGroupScope'
| 'activeSummaryWorkloadId'
+ | 'focusedSummaryWorkloadGroupId'
| 'isMobile'
| 'mobileVisibleColumnIds'
| 'mobileVisibleColumns'
| 'nodeByInstance'
| 'search'
| 'selectedGuestId'
+ | 'setFocusedWorkloadGroupScope'
| 'setHoveredWorkloadGroupScope'
| 'setHoveredWorkloadId'
| 'setSelectedGuestId'
@@ -81,10 +83,12 @@ export function DashboardWorkloadTable(props: DashboardWorkloadTableProps) {
handleTagClick={props.handleTagClick}
activeSummaryWorkloadGroupScope={props.activeSummaryWorkloadGroupScope}
activeSummaryWorkloadId={props.activeSummaryWorkloadId}
+ focusedSummaryWorkloadGroupId={props.focusedSummaryWorkloadGroupId}
mobileVisibleColumnIds={props.mobileVisibleColumnIds}
nodeByInstance={props.nodeByInstance}
search={props.search}
selectedGuestId={props.selectedGuestId}
+ setFocusedWorkloadGroupScope={props.setFocusedWorkloadGroupScope}
setHoveredWorkloadGroupScope={props.setHoveredWorkloadGroupScope}
setHoveredWorkloadId={props.setHoveredWorkloadId}
setSelectedGuestId={props.setSelectedGuestId}
diff --git a/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx b/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx
index 6f6cbe71b7..9e9e159739 100644
--- a/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx
+++ b/frontend-modern/src/components/Dashboard/WorkloadPanel.tsx
@@ -28,10 +28,12 @@ type WorkloadPanelProps = Pick<
| 'handleTagClick'
| 'activeSummaryWorkloadGroupScope'
| 'activeSummaryWorkloadId'
+ | 'focusedSummaryWorkloadGroupId'
| 'mobileVisibleColumnIds'
| 'nodeByInstance'
| 'search'
| 'selectedGuestId'
+ | 'setFocusedWorkloadGroupScope'
| 'setHoveredWorkloadGroupScope'
| 'setHoveredWorkloadId'
| 'setSelectedGuestId'
@@ -75,6 +77,12 @@ export function WorkloadPanel(props: WorkloadPanelProps) {
const handleGroupHoverChange = (next: SummarySeriesGroupScope | null) => {
props.setHoveredWorkloadGroupScope(next);
};
+ const handleGroupFocusToggle = () => {
+ const scope = groupSummaryScope();
+ props.setFocusedWorkloadGroupScope(
+ scope && props.focusedSummaryWorkloadGroupId() === scope.id ? null : scope,
+ );
+ };
return (
<>
@@ -87,6 +95,8 @@ export function WorkloadPanel(props: WorkloadPanelProps) {
data-summary-group-id={groupKey()}
data-summary-group-series-count={String(groupSummaryScope()?.seriesIds.length ?? 0)}
data-summary-row-active={isSummaryGroupHighlighted() ? 'true' : 'false'}
+ aria-pressed={props.focusedSummaryWorkloadGroupId() === groupSummaryScope()?.id}
+ onClick={handleGroupFocusToggle}
onMouseEnter={() => handleGroupHoverChange(groupSummaryScope())}
onMouseLeave={() => handleGroupHoverChange(null)}
>
@@ -122,6 +132,8 @@ export function WorkloadPanel(props: WorkloadPanelProps) {
groupSummaryScope()?.seriesIds.length ?? 0,
),
'data-summary-row-active': isSummaryGroupHighlighted() ? 'true' : 'false',
+ 'aria-pressed': props.focusedSummaryWorkloadGroupId() === groupSummaryScope()?.id,
+ onClick: handleGroupFocusToggle,
onMouseEnter: () => handleGroupHoverChange(groupSummaryScope()),
onMouseLeave: () => handleGroupHoverChange(null),
}}
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 74858f653d..9d08188ee0 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
@@ -873,8 +873,10 @@ describe('Dashboard performance contract', () => {
expect(workloadPanelSource).toContain('GuestDrawer');
expect(workloadPanelSource).toContain('createMemo(() => getCanonicalWorkloadId(guest()))');
expect(dashboardSelectionStateSource).toContain('activeSummaryWorkloadGroupScope');
+ expect(dashboardSelectionStateSource).toContain('focusedSummaryWorkloadGroupScope');
expect(dashboardSelectionStateSource).toContain('setHoveredWorkloadGroupScope');
- expect(dashboardSource).toContain('hoveredGroupScope={state.activeSummaryWorkloadGroupScope()}');
+ expect(dashboardSource).toContain('hoveredGroupScope={state.hoveredSummaryWorkloadGroupScope()}');
+ expect(dashboardSource).toContain('focusedGroupScope={state.focusedSummaryWorkloadGroupScope()}');
expect(workloadPanelSource).not.toContain('TableHead');
expect(dashboardStateCardsSource).toContain('buildInfrastructureWorkspacePath');
expect(dashboardStateCardsSource).toContain('dashboardInfrastructureEmptyState().title');
diff --git a/frontend-modern/src/components/Dashboard/__tests__/dashboardSelectionModel.test.ts b/frontend-modern/src/components/Dashboard/__tests__/dashboardSelectionModel.test.ts
index 531639b4e0..e9461b6f01 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/dashboardSelectionModel.test.ts
+++ b/frontend-modern/src/components/Dashboard/__tests__/dashboardSelectionModel.test.ts
@@ -12,6 +12,7 @@ describe('dashboardSelectionModel', () => {
it('resolves dashboard resource deep links into focused guest ids without inventing filters', () => {
expect(resolveDashboardResourceSelection('?resource=cluster-a:node-1:101')).toEqual({
resourceId: 'cluster-a:node-1:101',
+ summaryGroupId: null,
});
expect(
resolveDashboardResourceSelection(
@@ -19,14 +20,17 @@ describe('dashboardSelectionModel', () => {
),
).toEqual({
resourceId: 'app-container:truenas-main:nextcloud',
+ summaryGroupId: null,
});
expect(
resolveDashboardResourceSelection('?resource=app-container:docker-main:container-123'),
).toEqual({
resourceId: 'app-container:docker-main:container-123',
+ summaryGroupId: null,
});
expect(resolveDashboardResourceSelection('?resource=guest-1')).toEqual({
resourceId: 'guest-1',
+ summaryGroupId: null,
});
expect(resolveDashboardResourceSelection('')).toBeNull();
});
@@ -53,6 +57,7 @@ describe('dashboardSelectionModel', () => {
pathname: '/workloads',
search: '?type=app-container&platform=truenas&agent=truenas-main',
resourceId: 'app-container:truenas-main:nextcloud',
+ summaryGroupId: null,
}),
).toBe(
'/workloads?type=app-container&platform=truenas&agent=truenas-main&resource=app-container%3Atruenas-main%3Anextcloud',
@@ -64,6 +69,7 @@ describe('dashboardSelectionModel', () => {
search:
'?type=app-container&platform=truenas&agent=truenas-main&resource=app-container%3Atruenas-main%3Anextcloud',
resourceId: null,
+ summaryGroupId: null,
}),
).toBe('/workloads?type=app-container&platform=truenas&agent=truenas-main');
@@ -73,6 +79,28 @@ describe('dashboardSelectionModel', () => {
search:
'?type=app-container&platform=truenas&agent=truenas-main&resource=app-container%3Atruenas-main%3Anextcloud',
resourceId: 'app-container:truenas-main:nextcloud',
+ summaryGroupId: null,
+ }),
+ ).toBeNull();
+
+ expect(
+ resolveDashboardSelectionNavigateTarget({
+ pathname: '/workloads',
+ search: '?type=app-container&platform=truenas&agent=truenas-main',
+ resourceId: null,
+ summaryGroupId: 'docker-host:truenas-main',
+ }),
+ ).toBe(
+ '/workloads?type=app-container&platform=truenas&agent=truenas-main&summaryGroup=docker-host%3Atruenas-main',
+ );
+
+ expect(
+ resolveDashboardSelectionNavigateTarget({
+ pathname: '/workloads',
+ search:
+ '?type=app-container&platform=truenas&agent=truenas-main&summaryGroup=docker-host%3Atruenas-main',
+ resourceId: null,
+ summaryGroupId: 'docker-host:truenas-main',
}),
).toBeNull();
});
diff --git a/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts b/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
index 932fc947d7..c9af2d07b7 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
+++ b/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
@@ -11,6 +11,7 @@ import { useDashboardSelectionState } from '../useDashboardSelectionState';
let locationSearch = '?resource=cluster-a:node-1:101';
const navigateSpy = vi.fn();
+const emptySummaryGroupScopes = () => new Map<string, SummarySeriesGroupScope>();
vi.mock('@solidjs/router', () => ({
useLocation: () => ({
@@ -46,12 +47,14 @@ describe('useDashboardSelectionState', () => {
const { result } = renderHook(() =>
useDashboardSelectionState({
filteredGuests,
+ summaryGroupScopes: emptySummaryGroupScopes,
}),
);
expect(result.selectedGuestId()).toBe('cluster-a:node-1:101');
expect(resolveDashboardResourceSelection(locationSearch)).toEqual({
resourceId: 'cluster-a:node-1:101',
+ summaryGroupId: null,
});
});
@@ -69,6 +72,7 @@ describe('useDashboardSelectionState', () => {
const { result } = renderHook(() =>
useDashboardSelectionState({
filteredGuests,
+ summaryGroupScopes: emptySummaryGroupScopes,
}),
);
@@ -86,12 +90,14 @@ describe('useDashboardSelectionState', () => {
const { result } = renderHook(() =>
useDashboardSelectionState({
filteredGuests,
+ summaryGroupScopes: emptySummaryGroupScopes,
}),
);
expect(result.selectedGuestId()).toBe('app-container:truenas-main:nextcloud');
expect(resolveDashboardResourceSelection(locationSearch)).toEqual({
resourceId: 'app-container:truenas-main:nextcloud',
+ summaryGroupId: null,
});
});
@@ -102,6 +108,7 @@ describe('useDashboardSelectionState', () => {
const { result } = renderHook(() =>
useDashboardSelectionState({
filteredGuests,
+ summaryGroupScopes: emptySummaryGroupScopes,
}),
);
@@ -121,6 +128,7 @@ describe('useDashboardSelectionState', () => {
const { result } = renderHook(() =>
useDashboardSelectionState({
filteredGuests,
+ summaryGroupScopes: emptySummaryGroupScopes,
}),
);
@@ -168,6 +176,7 @@ describe('useDashboardSelectionState', () => {
const { result } = renderHook(() =>
useDashboardSelectionState({
filteredGuests,
+ summaryGroupScopes: emptySummaryGroupScopes,
}),
);
@@ -224,6 +233,7 @@ describe('useDashboardSelectionState', () => {
const { result } = renderHook(() =>
useDashboardSelectionState({
filteredGuests,
+ summaryGroupScopes: emptySummaryGroupScopes,
}),
);
@@ -299,6 +309,7 @@ describe('useDashboardSelectionState', () => {
const { result } = renderHook(() =>
useDashboardSelectionState({
filteredGuests,
+ summaryGroupScopes: emptySummaryGroupScopes,
}),
);
@@ -316,6 +327,7 @@ describe('useDashboardSelectionState', () => {
const { result } = renderHook(() =>
useDashboardSelectionState({
filteredGuests,
+ summaryGroupScopes: emptySummaryGroupScopes,
}),
);
diff --git a/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts b/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts
index a940e17f66..515e5b4a56 100644
--- a/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts
+++ b/frontend-modern/src/components/Dashboard/dashboardSelectionModel.ts
@@ -9,23 +9,26 @@ import { areSearchParamsEquivalent } from '@/utils/searchParams';
import { getCanonicalWorkloadId } from '@/utils/workloads';
export interface DashboardResourceSelection {
- resourceId: string;
+ resourceId: string | null;
+ summaryGroupId: string | null;
}
export interface DashboardSelectionNavigateTargetOptions {
pathname: string;
search: string;
resourceId: string | null;
+ summaryGroupId: string | null;
}
export const resolveDashboardResourceSelection = (
search: string,
): DashboardResourceSelection | null => {
- const { resource: resourceId } = parseWorkloadsLinkSearch(search);
- if (!resourceId) return null;
+ const { resource: resourceId, summaryGroup: summaryGroupId } = parseWorkloadsLinkSearch(search);
+ if (!resourceId && !summaryGroupId) return null;
return {
- resourceId,
+ resourceId: resourceId || null,
+ summaryGroupId: summaryGroupId || null,
};
};
@@ -33,15 +36,21 @@ export const resolveDashboardSelectionNavigateTarget = ({
pathname,
search,
resourceId,
+ summaryGroupId,
}: DashboardSelectionNavigateTargetOptions): string | null => {
const currentParams = new URLSearchParams(search);
const nextParams = new URLSearchParams(search);
nextParams.delete(WORKLOADS_QUERY_PARAMS.resource);
+ nextParams.delete(WORKLOADS_QUERY_PARAMS.summaryGroup);
const normalizedResourceId = resourceId?.trim() || '';
+ const normalizedSummaryGroupId = summaryGroupId?.trim() || '';
if (normalizedResourceId) {
nextParams.set(WORKLOADS_QUERY_PARAMS.resource, normalizedResourceId);
}
+ if (normalizedSummaryGroupId) {
+ nextParams.set(WORKLOADS_QUERY_PARAMS.summaryGroup, normalizedSummaryGroupId);
+ }
if (areSearchParamsEquivalent(currentParams, nextParams)) {
return null;
diff --git a/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts b/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts
index 2244c73c92..3e3ccd37fa 100644
--- a/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts
+++ b/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts
@@ -1,5 +1,5 @@
import { useLocation, useNavigate } from '@solidjs/router';
-import { createEffect, createSignal, onCleanup, untrack, type Accessor } from 'solid-js';
+import { createEffect, createMemo, createSignal, onCleanup, untrack, type Accessor } from 'solid-js';
import {
findInlineDetailElement,
@@ -7,7 +7,10 @@ import {
revealInlineDetailInViewport,
} from '@/components/shared/contextualFocus';
import { useSummaryPageInteractionState } from '@/components/shared/summaryTableFocus';
-import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
+import {
+ isSummarySeriesInGroupScope,
+ type SummarySeriesGroupScope,
+} from '@/components/shared/summaryCardInteraction';
import type { WorkloadGuest } from '@/types/workloads';
import { createRouteStateNavigateScheduler } from '@/utils/routeStateNavigation';
import {
@@ -19,6 +22,7 @@ import {
interface UseDashboardSelectionStateOptions {
filteredGuests: Accessor<WorkloadGuest[]>;
+ summaryGroupScopes: Accessor<Map<string, SummarySeriesGroupScope>>;
}
export function useDashboardSelectionState(options: UseDashboardSelectionStateOptions) {
@@ -30,20 +34,31 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
);
const [selectedGuestId, setSelectedGuestIdRaw] = createSignal<string | null>(null);
+ const [selectedWorkloadGroupId, setSelectedWorkloadGroupIdRaw] = createSignal<string | null>(null);
const [hoveredWorkloadId, setHoveredWorkloadId] = createSignal<string | null>(null);
const [hoveredWorkloadGroupScope, setHoveredWorkloadGroupScope] =
createSignal<SummarySeriesGroupScope | null>(null);
const [handledResourceId, setHandledResourceId] = createSignal<string | null>(null);
+ const [handledWorkloadGroupId, setHandledWorkloadGroupId] = createSignal<string | null>(null);
const [revealedGuestId, setRevealedGuestId] = createSignal<string | null>(null);
const [tableWrapperRef, setTableWrapperRefSignal] = createSignal<HTMLDivElement | undefined>(
undefined,
);
const [tableBodyRef, setTableBodyRef] = createSignal<HTMLTableSectionElement | null>(null);
+ const focusedWorkloadGroupScope = createMemo<SummarySeriesGroupScope | null>(() => {
+ const selectedGroupId = selectedWorkloadGroupId();
+ if (!selectedGroupId) {
+ return null;
+ }
+ return options.summaryGroupScopes().get(selectedGroupId) ?? null;
+ });
+
const summaryInteraction = useSummaryPageInteractionState({
hoveredSeriesId: hoveredWorkloadId,
hoveredGroupScope: hoveredWorkloadGroupScope,
focusedSeriesId: selectedGuestId,
+ focusedGroupScope: focusedWorkloadGroupScope,
revealActiveSeries: setRevealedGuestId,
});
@@ -59,11 +74,45 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
};
const setSelectedGuestId = (id: string | null) => {
- setSelectedGuestIdState(id);
+ const activeFocusedGroupScope = focusedWorkloadGroupScope();
+ const nextGroupScope =
+ activeFocusedGroupScope && !isSummarySeriesInGroupScope(activeFocusedGroupScope, id)
+ ? null
+ : activeFocusedGroupScope;
+ preserveScrollableAncestorVerticalOffset(tableWrapperRef(), () => {
+ setSelectedGuestIdRaw(id);
+ setSelectedWorkloadGroupIdRaw(nextGroupScope?.id ?? null);
+ });
const nextPath = resolveDashboardSelectionNavigateTarget({
pathname: location.pathname,
search: location.search,
resourceId: id,
+ summaryGroupId: nextGroupScope?.id ?? null,
+ });
+ if (nextPath) {
+ routeStateNavigate.schedule(nextPath);
+ }
+ };
+
+ const setFocusedWorkloadGroupScopeState = (scope: SummarySeriesGroupScope | null) => {
+ preserveScrollableAncestorVerticalOffset(tableWrapperRef(), () => {
+ setSelectedWorkloadGroupIdRaw(scope?.id ?? null);
+ if (scope && !isSummarySeriesInGroupScope(scope, selectedGuestId())) {
+ setSelectedGuestIdRaw(null);
+ }
+ });
+ };
+
+ const setFocusedWorkloadGroupScope = (scope: SummarySeriesGroupScope | null) => {
+ const nextGroupId = scope?.id ?? null;
+ const nextSelectedGuestId =
+ scope && !isSummarySeriesInGroupScope(scope, selectedGuestId()) ? null : selectedGuestId();
+ setFocusedWorkloadGroupScopeState(scope);
+ const nextPath = resolveDashboardSelectionNavigateTarget({
+ pathname: location.pathname,
+ search: location.search,
+ resourceId: nextSelectedGuestId,
+ summaryGroupId: nextGroupId,
});
if (nextPath) {
routeStateNavigate.schedule(nextPath);
@@ -77,14 +126,22 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
setSelectedGuestIdState(null);
setHandledResourceId(null);
}
+ if (handledWorkloadGroupId() !== null) {
+ setSelectedWorkloadGroupIdRaw(null);
+ setHandledWorkloadGroupId(null);
+ }
return;
}
- const { resourceId } = selection;
- if (resourceId === handledResourceId()) return;
-
- setSelectedGuestIdState(resourceId);
- setHandledResourceId(resourceId);
+ const { resourceId, summaryGroupId } = selection;
+ if (summaryGroupId !== handledWorkloadGroupId()) {
+ setSelectedWorkloadGroupIdRaw(summaryGroupId);
+ setHandledWorkloadGroupId(summaryGroupId);
+ }
+ if (resourceId !== handledResourceId()) {
+ setSelectedGuestIdState(resourceId);
+ setHandledResourceId(resourceId);
+ }
});
createEffect(() => {
@@ -113,6 +170,27 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
}
});
+ createEffect(() => {
+ const selectedGroupId = selectedWorkloadGroupId();
+ if (!selectedGroupId) {
+ return;
+ }
+ if (!focusedWorkloadGroupScope()) {
+ setFocusedWorkloadGroupScope(null);
+ }
+ });
+
+ createEffect(() => {
+ const selectedId = selectedGuestId();
+ const groupScope = focusedWorkloadGroupScope();
+ if (!selectedId || !groupScope) {
+ return;
+ }
+ if (!isSummarySeriesInGroupScope(groupScope, selectedId)) {
+ setSelectedGuestId(null);
+ }
+ });
+
createEffect(() => {
const selectedId = selectedGuestId();
const root = tableWrapperRef();
@@ -167,11 +245,15 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
activeSummaryWorkloadGroupScope: summaryInteraction.activeGroupScope,
activeSummaryWorkloadId: summaryInteraction.activeSeriesId,
chartHoverSync: summaryInteraction.chartHoverSync,
+ focusedSummaryWorkloadGroupScope: focusedWorkloadGroupScope,
hoveredWorkloadId,
+ hoveredSummaryWorkloadGroupScope: hoveredWorkloadGroupScope,
jumpToActiveWorkloadRow: summaryInteraction.jumpToActiveRow,
+ focusedSummaryWorkloadGroupId: selectedWorkloadGroupId,
revealedGuestId,
selectedGuestId,
setChartHoverSync: summaryInteraction.setChartHoverSync,
+ setFocusedWorkloadGroupScope,
setHoveredWorkloadGroupScope,
setHoveredWorkloadId,
setSelectedGuestId,
diff --git a/frontend-modern/src/components/Dashboard/useDashboardState.ts b/frontend-modern/src/components/Dashboard/useDashboardState.ts
index abd6589ab9..c3f9277b04 100644
--- a/frontend-modern/src/components/Dashboard/useDashboardState.ts
+++ b/frontend-modern/src/components/Dashboard/useDashboardState.ts
@@ -15,6 +15,7 @@ import {
} from '@/utils/dashboardEmptyStatePresentation';
import { getCanonicalWorkloadId } from '@/utils/workloads';
import {
+ buildWorkloadSummaryGroupScopeMap,
createWorkloadSortComparator,
filterWorkloads,
type FilterWorkloadsParams,
@@ -197,16 +198,28 @@ export function useDashboardState(props: DashboardProps) {
};
return filterWorkloads(params);
});
+ const summaryGroupScopes = createMemo(() =>
+ buildWorkloadSummaryGroupScopeMap({
+ guests: filteredGuests(),
+ nodes: props.nodes,
+ groupingMode: groupingMode(),
+ sortComparator: guestSortComparator(),
+ }),
+ );
const {
activeSummaryWorkloadGroupScope,
activeSummaryWorkloadId,
chartHoverSync,
+ focusedSummaryWorkloadGroupScope,
+ focusedSummaryWorkloadGroupId,
hoveredWorkloadId,
+ hoveredSummaryWorkloadGroupScope,
jumpToActiveWorkloadRow,
revealedGuestId,
selectedGuestId,
setChartHoverSync,
+ setFocusedWorkloadGroupScope,
setHoveredWorkloadGroupScope,
setHoveredWorkloadId,
setSelectedGuestId,
@@ -216,6 +229,7 @@ export function useDashboardState(props: DashboardProps) {
tableBodyRef,
} = useDashboardSelectionState({
filteredGuests,
+ summaryGroupScopes,
});
const {
@@ -263,6 +277,8 @@ export function useDashboardState(props: DashboardProps) {
dashboardInfrastructureEmptyState,
dashboardLoadingState,
filteredGuests,
+ focusedSummaryWorkloadGroupScope,
+ focusedSummaryWorkloadGroupId,
getGroupLabel,
groupedGuests,
groupedWindowing,
@@ -274,6 +290,7 @@ export function useDashboardState(props: DashboardProps) {
handleSort,
handleTagClick,
hostFilterConfig,
+ hoveredSummaryWorkloadGroupScope,
hoveredWorkloadId,
initialDataReceived,
isMobile,
@@ -301,6 +318,7 @@ export function useDashboardState(props: DashboardProps) {
selectedNode,
setContainerRuntime,
setChartHoverSync,
+ setFocusedWorkloadGroupScope,
setGroupingMode,
setHoveredWorkloadGroupScope,
setHoveredWorkloadId,
diff --git a/frontend-modern/src/components/Dashboard/useDashboardWorkloadDerivedState.ts b/frontend-modern/src/components/Dashboard/useDashboardWorkloadDerivedState.ts
index 11a44cb713..0324764e35 100644
--- a/frontend-modern/src/components/Dashboard/useDashboardWorkloadDerivedState.ts
+++ b/frontend-modern/src/components/Dashboard/useDashboardWorkloadDerivedState.ts
@@ -8,6 +8,7 @@ import { getCanonicalWorkloadId } from '@/utils/workloads';
import {
getDiskUsagePercent,
+ getWorkloadGroupLabel,
getWorkloadGroupKey,
groupWorkloads,
computeWorkloadStats,
@@ -101,22 +102,7 @@ export function useDashboardWorkloadDerivedState(
guests: WorkloadGuest[],
): { type: string; name: string } => {
const node = nodeByInstance()[groupKey];
- if (node) return { type: '', name: getNodeDisplayName(node) };
- const normalizedGroupKey = guests.length > 0 ? getWorkloadGroupKey(guests[0]) : groupKey;
- const [prefix, ...rest] = normalizedGroupKey.split(':');
- const context = rest.length > 0 ? rest.join(':') : normalizedGroupKey;
- if (prefix === 'app-container') return { type: 'App Containers', name: context };
- if (prefix === 'pod') return { type: 'Pods', name: context };
- if (prefix === 'vm') return { type: 'VM', name: context };
- if (prefix === 'system-container') return { type: 'Container', name: context };
- const first = guests[0];
- if (first) {
- const cluster = (first.clusterName || '').trim();
- const nodeName = (first.node || '').trim();
- if (nodeName && cluster) return { type: cluster, name: nodeName };
- if (nodeName) return { type: '', name: nodeName };
- }
- return { type: '', name: context };
+ return getWorkloadGroupLabel(groupKey, guests, node ? getNodeDisplayName(node) : null);
};
const groupedGuests = createMemo(() =>
diff --git a/frontend-modern/src/components/Dashboard/workloadSelectors.ts b/frontend-modern/src/components/Dashboard/workloadSelectors.ts
index c11d337015..87fded87c2 100644
--- a/frontend-modern/src/components/Dashboard/workloadSelectors.ts
+++ b/frontend-modern/src/components/Dashboard/workloadSelectors.ts
@@ -1,3 +1,4 @@
+import type { Node } from '@/types/api';
import type { WorkloadGuest, ViewMode } from '@/types/workloads';
import type { WorkloadIOEmphasis } from './guestRowModel';
import { computeIOScale } from '@/components/Infrastructure/infrastructureSelectors';
@@ -5,8 +6,9 @@ import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInt
import { parseFilterStack, evaluateFilterStack } from '@/utils/searchQuery';
import { normalizeSourcePlatformQueryValue } from '@/utils/sourcePlatforms';
import { DEGRADED_HEALTH_STATUSES, OFFLINE_HEALTH_STATUSES } from '@/utils/status';
+import { getNodeDisplayName } from '@/utils/nodes';
import { getCanonicalWorkloadId, resolveWorkloadType } from '@/utils/workloads';
-import { getKubernetesContextKey, workloadNodeScopeId } from './workloadTopology';
+import { buildNodeByInstance, getKubernetesContextKey, workloadNodeScopeId } from './workloadTopology';
export interface FilterWorkloadsParams {
guests: WorkloadGuest[];
@@ -249,6 +251,32 @@ export const getWorkloadGroupKey = (guest: WorkloadGuest): string => {
return `${type}:${context}`;
};
+export const getWorkloadGroupLabel = (
+ groupKey: string,
+ guests: WorkloadGuest[],
+ groupNodeName?: string | null,
+): { type: string; name: string } => {
+ const normalizedGroupKey = guests.length > 0 ? getWorkloadGroupKey(guests[0]) : groupKey;
+ const [prefix, ...rest] = normalizedGroupKey.split(':');
+ const context = rest.length > 0 ? rest.join(':') : normalizedGroupKey;
+ const normalizedNodeName = (groupNodeName || '').trim();
+ if (normalizedNodeName) {
+ return { type: '', name: normalizedNodeName };
+ }
+ if (prefix === 'app-container') return { type: 'App Containers', name: context };
+ if (prefix === 'pod') return { type: 'Pods', name: context };
+ if (prefix === 'vm') return { type: 'VM', name: context };
+ if (prefix === 'system-container') return { type: 'Container', name: context };
+ const first = guests[0];
+ if (first) {
+ const cluster = (first.clusterName || '').trim();
+ const nodeName = (first.node || '').trim();
+ if (nodeName && cluster) return { type: cluster, name: nodeName };
+ if (nodeName) return { type: '', name: nodeName };
+ }
+ return { type: '', name: context };
+};
+
export const buildWorkloadSummaryGroupScope = (
groupId: string,
guests: WorkloadGuest[],
@@ -303,6 +331,38 @@ export const groupWorkloads = (
return groups;
};
+export const buildWorkloadSummaryGroupScopeMap = ({
+ guests,
+ nodes,
+ groupingMode,
+ sortComparator,
+}: {
+ guests: WorkloadGuest[];
+ nodes: Node[];
+ groupingMode: 'grouped' | 'flat';
+ sortComparator: ((a: WorkloadGuest, b: WorkloadGuest) => number) | null;
+}): Map<string, SummarySeriesGroupScope> => {
+ if (groupingMode !== 'grouped') {
+ return new Map<string, SummarySeriesGroupScope>();
+ }
+
+ const grouped = groupWorkloads(guests, groupingMode, sortComparator);
+ const nodeByInstance = buildNodeByInstance(nodes);
+ const scopes = new Map<string, SummarySeriesGroupScope>();
+ for (const [groupKey, groupGuests] of Object.entries(grouped)) {
+ const node = nodeByInstance[groupKey];
+ const scope = buildWorkloadSummaryGroupScope(
+ groupKey,
+ groupGuests,
+ getWorkloadGroupLabel(groupKey, groupGuests, node ? getNodeDisplayName(node) : null),
+ );
+ if (scope) {
+ scopes.set(scope.id, scope);
+ }
+ }
+ return scopes;
+};
+
export const computeWorkloadStats = (guests: WorkloadGuest[]): WorkloadStats => {
const running = guests.filter((g) => g.status === 'running').length;
const degraded = guests.filter((g) => {
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
index 8ea0f00835..d255c38411 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
@@ -155,6 +155,12 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
const handleGroupHoverChange = (next: SummarySeriesGroupScope | null) => {
tableProps.onGroupHoverChange?.(next);
};
+ const handleGroupFocusToggle = () => {
+ const nextScope = groupSummaryScope();
+ tableProps.onGroupFocusChange?.(
+ nextScope && tableProps.focusedSummaryGroupId === nextScope.id ? null : nextScope?.id ?? null,
+ );
+ };
return (
<TableRow
class="bg-surface-alt transition-colors duration-150 hover:bg-surface-hover"
@@ -163,6 +169,8 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
groupSummaryScope()?.seriesIds.length ?? 0,
)}
data-summary-row-active={isSummaryGroupHighlighted() ? 'true' : 'false'}
+ aria-pressed={tableProps.focusedSummaryGroupId === groupSummaryScope()?.id}
+ onClick={handleGroupFocusToggle}
onMouseEnter={() => handleGroupHoverChange(groupSummaryScope())}
onMouseLeave={() => handleGroupHoverChange(null)}
>
diff --git a/frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts b/frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts
index 06c99cfb31..77d0e2704a 100644
--- a/frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts
+++ b/frontend-modern/src/components/Infrastructure/infrastructureSummaryModel.ts
@@ -23,6 +23,7 @@ export interface InfrastructureSummaryProps {
resources: Resource[];
timeRange?: TimeRange;
hoveredGroupScope?: SummarySeriesGroupScope | null;
+ focusedGroupScope?: SummarySeriesGroupScope | null;
hoveredResourceId?: string | null;
focusedResourceId?: string | null;
chartHoverSync?: SummaryChartHoverSync | null;
diff --git a/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts b/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts
index 7f355c5005..3cc3e2f248 100644
--- a/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts
+++ b/frontend-modern/src/components/Infrastructure/useInfrastructureSummaryState.ts
@@ -245,6 +245,7 @@ export function useInfrastructureSummaryState(props: InfrastructureSummaryProps)
const summaryFocus = useSummaryContextualFocusState({
chartHoveredSeriesId: () => chartHoverSync()?.seriesId ?? null,
interactiveSeries: resourceSeries,
+ focusedGroupScope: () => props.focusedGroupScope,
hoveredGroupScope: () => props.hoveredGroupScope,
hoveredSeriesId: () => props.hoveredResourceId,
focusedSeriesId: () => props.focusedResourceId,
diff --git a/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts b/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts
index 9afb44ffb5..ac6e22baa0 100644
--- a/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts
+++ b/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts
@@ -37,8 +37,10 @@ export interface UnifiedResourceTableProps {
revealedResourceId?: string | null;
hoveredResourceId?: string | null;
activeSummaryGroupScope?: SummarySeriesGroupScope | null;
+ focusedSummaryGroupId?: string | null;
onExpandedResourceChange: (id: string | null) => void;
onHoverChange?: (id: string | null) => void;
+ onGroupFocusChange?: (groupId: string | null) => void;
onGroupHoverChange?: (scope: SummarySeriesGroupScope | null) => void;
groupingMode?: 'grouped' | 'flat';
onDeployCluster?: (clusterId: string, clusterName: string) => void;
diff --git a/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx b/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx
index 8958e0aaa6..9a59879456 100644
--- a/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx
+++ b/frontend-modern/src/components/Recovery/RecoverySummary.test.tsx
@@ -97,4 +97,15 @@ describe('RecoverySummary', () => {
expect(recoverySummarySource).not.toContain('!p-1.5 sm:!p-2');
expect(recoverySummarySource.match(/bodyLayout="auto"/g) ?? []).toHaveLength(4);
});
+
+ it('keeps recovery summary outside the interactive page-group-entity summary contract', () => {
+ expect(recoverySummarySource).not.toContain('useSummaryPageInteractionState');
+ expect(recoverySummarySource).not.toContain('hoveredGroupScope');
+ expect(recoverySummarySource).not.toContain('focusedGroupScope');
+ expect(recoverySummarySource).not.toContain('hoveredResourceId');
+ expect(recoverySummarySource).not.toContain('focusedResourceId');
+ expect(recoverySummarySource).not.toContain('chartHoverSync');
+ expect(recoverySummarySource).not.toContain('InteractiveSparkline');
+ expect(recoverySummarySource).not.toContain('DensityMap');
+ });
});
diff --git a/frontend-modern/src/components/Storage/Storage.tsx b/frontend-modern/src/components/Storage/Storage.tsx
index 3d3e7464b6..c8cd50cfaa 100644
--- a/frontend-modern/src/components/Storage/Storage.tsx
+++ b/frontend-modern/src/components/Storage/Storage.tsx
@@ -34,7 +34,11 @@ const Storage: Component = () => {
activeBannerKind,
cephSummaryStats,
filteredRecords,
+ activeSummaryStorageGroupScope,
activeSummaryStorageResourceId,
+ focusedSummaryStorageGroupScope,
+ focusedSummaryStorageGroupId,
+ hoveredSummaryStorageGroupScope,
nodeOptions,
physicalDisks,
nodes,
@@ -53,6 +57,8 @@ const Storage: Component = () => {
jumpToActiveStorageRow,
selectedDiskId,
setChartHoverSync,
+ setFocusedStorageGroupScope,
+ setHoveredStorageGroupScope,
setHoveredStorageResourceId,
setSelectedDiskId,
setSummaryTableRootRef,
@@ -68,7 +74,9 @@ const Storage: Component = () => {
nodeOptions={nodeOptions}
physicalDisks={physicalDisks}
hoveredResourceId={hoveredStorageResourceId}
+ hoveredGroupScope={hoveredSummaryStorageGroupScope}
focusedResourceId={focusedStorageResourceId}
+ focusedGroupScope={focusedSummaryStorageGroupScope}
chartHoverSync={chartHoverSync}
onChartHoverSyncChange={setChartHoverSync}
showJumpToActiveRow={shouldShowJumpToActiveStorageRow}
@@ -124,6 +132,10 @@ const Storage: Component = () => {
highlightedRecordId={highlightedRecordId}
getRecordAlertState={getRecordAlertState}
isLoadingPools={isLoadingPools}
+ activeSummaryGroupScope={activeSummaryStorageGroupScope}
+ focusedSummaryGroupId={focusedSummaryStorageGroupId}
+ onGroupFocusChange={setFocusedStorageGroupScope}
+ onGroupHoverChange={setHoveredStorageGroupScope}
highlightedSummaryResourceId={activeSummaryStorageResourceId}
hoveredStorageResourceId={hoveredStorageResourceId}
setTableRootRef={setSummaryTableRootRef}
diff --git a/frontend-modern/src/components/Storage/StorageContentCard.tsx b/frontend-modern/src/components/Storage/StorageContentCard.tsx
index c4bb1783b1..5133bd0cae 100644
--- a/frontend-modern/src/components/Storage/StorageContentCard.tsx
+++ b/frontend-modern/src/components/Storage/StorageContentCard.tsx
@@ -11,6 +11,7 @@ import type { StorageGroupKey, StorageGroupedRecords } from './useStorageModel';
import type { StorageAlertRowState } from '@/features/storageBackups/storageAlertState';
import type { StorageView } from './storagePageState';
import { useStorageContentCardModel } from './useStorageContentCardModel';
+import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
type StorageContentCardProps = {
view: () => StorageView;
@@ -28,6 +29,10 @@ type StorageContentCardProps = {
highlightedRecordId: () => string | null;
getRecordAlertState: (recordId: string) => StorageAlertRowState;
isLoadingPools: () => boolean;
+ activeSummaryGroupScope: () => SummarySeriesGroupScope | null;
+ focusedSummaryGroupId: () => string | null;
+ onGroupFocusChange: (scope: SummarySeriesGroupScope | null) => void;
+ onGroupHoverChange: (scope: SummarySeriesGroupScope | null) => void;
highlightedSummaryResourceId: () => string | null;
hoveredStorageResourceId: () => string | null;
setTableRootRef: (element: HTMLDivElement | undefined) => void;
@@ -72,6 +77,10 @@ export const StorageContentCard: Component<StorageContentCardProps> = (props) =>
highlightedRecordId={props.highlightedRecordId()}
getRecordAlertState={props.getRecordAlertState}
isLoading={props.isLoadingPools()}
+ activeSummaryGroupScope={props.activeSummaryGroupScope()}
+ focusedSummaryGroupId={props.focusedSummaryGroupId()}
+ onGroupFocusChange={props.onGroupFocusChange}
+ onGroupHoverChange={props.onGroupHoverChange}
highlightedSummarySeriesId={props.highlightedSummaryResourceId()}
onHoverChange={props.setHoveredStorageResourceId}
/>
diff --git a/frontend-modern/src/components/Storage/StorageGroupRow.tsx b/frontend-modern/src/components/Storage/StorageGroupRow.tsx
index 6fcb617dd0..cb85d48ea6 100644
--- a/frontend-modern/src/components/Storage/StorageGroupRow.tsx
+++ b/frontend-modern/src/components/Storage/StorageGroupRow.tsx
@@ -1,6 +1,7 @@
import { Component, For, Show } from 'solid-js';
import { EnhancedStorageBar } from './EnhancedStorageBar';
import type { StorageGroupedRecords, StorageGroupKey } from './useStorageModel';
+import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
import {
buildStorageGroupRowPresentation,
STORAGE_GROUP_ROW_CELL_CLASS,
@@ -22,6 +23,11 @@ interface StorageGroupRowProps {
groupBy: StorageGroupKey;
expanded: boolean;
onToggle: () => void;
+ summaryGroupScope: SummarySeriesGroupScope | null;
+ summaryActive: boolean;
+ summaryFocused: boolean;
+ onFocusChange?: (scope: SummarySeriesGroupScope | null) => void;
+ onHoverChange?: (scope: SummarySeriesGroupScope | null) => void;
}
export const StorageGroupRow: Component<StorageGroupRowProps> = (props) => {
@@ -30,22 +36,41 @@ export const StorageGroupRow: Component<StorageGroupRowProps> = (props) => {
return (
<tr
class={STORAGE_GROUP_ROW_CLASS}
- onClick={() => props.onToggle()}
+ data-summary-group-id={props.summaryGroupScope?.id ?? undefined}
+ data-summary-group-series-count={String(props.summaryGroupScope?.seriesIds.length ?? 0)}
+ data-summary-row-active={props.summaryActive ? 'true' : 'false'}
+ aria-pressed={props.summaryFocused}
+ onClick={() =>
+ props.onFocusChange?.(
+ props.summaryFocused ? null : props.summaryGroupScope,
+ )
+ }
+ onMouseEnter={() => props.onHoverChange?.(props.summaryGroupScope)}
+ onMouseLeave={() => props.onHoverChange?.(null)}
>
<td colSpan={99} class={STORAGE_GROUP_ROW_CELL_CLASS}>
<div class={STORAGE_GROUP_ROW_CONTENT_CLASS}>
- {/* Expand chevron */}
- <svg
- class={getStorageGroupChevronClass(props.expanded)}
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2.5"
- stroke-linecap="round"
- stroke-linejoin="round"
+ <button
+ type="button"
+ aria-label={props.expanded ? `Collapse ${row().label}` : `Expand ${row().label}`}
+ class="inline-flex items-center justify-center"
+ onClick={(event) => {
+ event.stopPropagation();
+ props.onToggle();
+ }}
>
- <path d="M9 18l6-6-6-6" />
- </svg>
+ <svg
+ class={getStorageGroupChevronClass(props.expanded)}
+ viewBox="0 0 24 24"
+ fill="none"
+ stroke="currentColor"
+ stroke-width="2.5"
+ stroke-linecap="round"
+ stroke-linejoin="round"
+ >
+ <path d="M9 18l6-6-6-6" />
+ </svg>
+ </button>
{/* Group label */}
<span class={STORAGE_GROUP_ROW_LABEL_CLASS}>
diff --git a/frontend-modern/src/components/Storage/StoragePageSummary.tsx b/frontend-modern/src/components/Storage/StoragePageSummary.tsx
index ca3c37f6ee..ad180d648f 100644
--- a/frontend-modern/src/components/Storage/StoragePageSummary.tsx
+++ b/frontend-modern/src/components/Storage/StoragePageSummary.tsx
@@ -1,6 +1,7 @@
import { Component } from 'solid-js';
import StorageSummary from '@/components/Storage/StorageSummary';
import type { Resource } from '@/types/resource';
+import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
import type { StoragePageNodeOption } from './storagePageState';
import { useStoragePageSummary } from './useStoragePageSummary';
import type { SummaryChartHoverSync } from '@/components/shared/contextualFocus';
@@ -11,7 +12,9 @@ type StoragePageSummaryProps = {
nodeOptions: () => StoragePageNodeOption[];
physicalDisks: () => Resource[];
hoveredResourceId: () => string | null;
+ hoveredGroupScope: () => SummarySeriesGroupScope | null;
focusedResourceId: () => string | null;
+ focusedGroupScope: () => SummarySeriesGroupScope | null;
chartHoverSync: () => SummaryChartHoverSync | null;
onChartHoverSyncChange: (value: SummaryChartHoverSync | null) => void;
showJumpToActiveRow: () => boolean;
@@ -34,7 +37,9 @@ export const StoragePageSummary: Component<StoragePageSummaryProps> = (props) =>
onTimeRangeChange={setSummaryTimeRange}
nodeId={props.selectedNodeId()}
hoveredResourceId={props.hoveredResourceId()}
+ hoveredGroupScope={props.hoveredGroupScope()}
focusedResourceId={props.focusedResourceId()}
+ focusedGroupScope={props.focusedGroupScope()}
chartHoverSync={props.chartHoverSync()}
onChartHoverSyncChange={props.onChartHoverSyncChange}
showJumpToActiveRow={props.showJumpToActiveRow()}
diff --git a/frontend-modern/src/components/Storage/StoragePoolsTable.tsx b/frontend-modern/src/components/Storage/StoragePoolsTable.tsx
index bec17f448d..cde0acd459 100644
--- a/frontend-modern/src/components/Storage/StoragePoolsTable.tsx
+++ b/frontend-modern/src/components/Storage/StoragePoolsTable.tsx
@@ -18,6 +18,8 @@ import { StorageGroupRow } from './StorageGroupRow';
import { StoragePoolRow } from './StoragePoolRow';
import type { StorageGroupedRecords, StorageGroupKey } from './useStorageModel';
import { useStoragePoolsTableModel } from './useStoragePoolsTableModel';
+import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
+import { buildStorageSummaryGroupScope } from './storageSummaryGroups';
type StoragePoolsTableProps = {
groupedRecords: StorageGroupedRecords[];
@@ -31,6 +33,10 @@ type StoragePoolsTableProps = {
highlightedRecordId: string | null;
getRecordAlertState: (recordId: string) => StorageAlertRowState;
isLoading: boolean;
+ activeSummaryGroupScope?: SummarySeriesGroupScope | null;
+ focusedSummaryGroupId?: string | null;
+ onGroupFocusChange?: (scope: SummarySeriesGroupScope | null) => void;
+ onGroupHoverChange?: (scope: SummarySeriesGroupScope | null) => void;
highlightedSummarySeriesId?: string | null;
onHoverChange?: (recordId: string | null) => void;
};
@@ -71,12 +77,22 @@ export const StoragePoolsTable: Component<StoragePoolsTableProps> = (props) => {
{(group) => (
<>
<Show when={group.showHeader}>
+ {(() => {
+ const groupSummaryScope = buildStorageSummaryGroupScope(group, props.groupBy);
+ return (
<StorageGroupRow
group={group}
groupBy={props.groupBy}
expanded={group.expanded}
onToggle={() => props.toggleGroup(group.key)}
+ summaryGroupScope={groupSummaryScope}
+ summaryActive={props.activeSummaryGroupScope?.id === groupSummaryScope?.id}
+ summaryFocused={props.focusedSummaryGroupId === groupSummaryScope?.id}
+ onFocusChange={props.onGroupFocusChange}
+ onHoverChange={props.onGroupHoverChange}
/>
+ );
+ })()}
</Show>
<Show when={group.expanded}>
<Index each={group.items}>
diff --git a/frontend-modern/src/components/Storage/StorageSummary.tsx b/frontend-modern/src/components/Storage/StorageSummary.tsx
index 11961fb746..72c3d047a2 100644
--- a/frontend-modern/src/components/Storage/StorageSummary.tsx
+++ b/frontend-modern/src/components/Storage/StorageSummary.tsx
@@ -5,6 +5,7 @@ import {
useSummaryContextualFocusState,
type SummaryChartHoverSync,
} from '@/components/shared/contextualFocus';
+import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
import { SummaryJumpToRowButton } from '@/components/shared/SummaryJumpToRowButton';
import { SummaryPanel } from '@/components/shared/SummaryPanel';
import { SummaryMetricCard } from '@/components/shared/SummaryMetricCard';
@@ -60,7 +61,9 @@ interface StorageSummaryProps {
onTimeRangeChange?: (range: SummaryTimeRange) => void;
nodeId?: string;
hoveredResourceId?: string | null;
+ hoveredGroupScope?: SummarySeriesGroupScope | null;
focusedResourceId?: string | null;
+ focusedGroupScope?: SummarySeriesGroupScope | null;
chartHoverSync?: SummaryChartHoverSync | null;
onChartHoverSyncChange?: (value: SummaryChartHoverSync | null) => void;
showJumpToActiveRow?: boolean;
@@ -189,7 +192,7 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
// Series builders
// ---------------------------------------------------------------------------
- const poolUsageSeries = createMemo((): InteractiveSparklineSeries[] => {
+ const allPoolUsageSeries = createMemo((): InteractiveSparklineSeries[] => {
const d = data();
if (!d?.pools) return [];
const entries = Object.entries(d.pools);
@@ -203,7 +206,7 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
}));
});
- const poolUsedSeries = createMemo((): InteractiveSparklineSeries[] => {
+ const allPoolUsedSeries = createMemo((): InteractiveSparklineSeries[] => {
const d = data();
if (!d?.pools) return [];
const entries = Object.entries(d.pools);
@@ -217,7 +220,7 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
}));
});
- const poolAvailSeries = createMemo((): InteractiveSparklineSeries[] => {
+ const allPoolAvailSeries = createMemo((): InteractiveSparklineSeries[] => {
const d = data();
if (!d?.pools) return [];
const entries = Object.entries(d.pools);
@@ -231,7 +234,7 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
}));
});
- const diskTempSeries = createMemo((): InteractiveSparklineSeries[] => {
+ const allDiskTempSeries = createMemo((): InteractiveSparklineSeries[] => {
const d = data();
if (!d?.disks) return [];
const entries = Object.entries(d.disks);
@@ -245,14 +248,16 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
}));
});
const interactiveSummarySeries = createMemo<InteractiveSparklineSeries[]>(() => [
- ...poolUsageSeries(),
- ...poolUsedSeries(),
- ...poolAvailSeries(),
- ...diskTempSeries(),
+ ...allPoolUsageSeries(),
+ ...allPoolUsedSeries(),
+ ...allPoolAvailSeries(),
+ ...allDiskTempSeries(),
]);
const summaryFocus = useSummaryContextualFocusState({
chartHoveredSeriesId: () => chartHoverSync()?.seriesId ?? null,
interactiveSeries: interactiveSummarySeries,
+ focusedGroupScope: () => props.focusedGroupScope,
+ hoveredGroupScope: () => props.hoveredGroupScope,
hoveredSeriesId: () => props.hoveredResourceId,
focusedSeriesId: () => props.focusedResourceId,
});
@@ -260,17 +265,34 @@ const StorageSummary: Component<StorageSummaryProps> = (props) => {
createEffect(() => {
const hovered = chartHoverSync();
if (!hovered) return;
- if (!summaryFocus.hasInteractiveSeriesId(hovered.seriesId)) {
+ if (!summaryFocus.isSeriesIdVisibleInActiveScope(hovered.seriesId)) {
setChartHoverSync(null);
}
});
+ const poolUsageSeries = createMemo(() =>
+ summaryFocus.filterSeriesForActiveScope(allPoolUsageSeries()),
+ );
+ const poolUsedSeries = createMemo(() =>
+ summaryFocus.filterSeriesForActiveScope(allPoolUsedSeries()),
+ );
+ const poolAvailSeries = createMemo(() =>
+ summaryFocus.filterSeriesForActiveScope(allPoolAvailSeries()),
+ );
+ const diskTempSeries = createMemo(() =>
+ summaryFocus.filterSeriesForActiveScope(allDiskTempSeries()),
+ );
+
const hasPoolUsage = () => poolUsageSeries().length > 0;
const hasDiskTemp = () => diskTempSeries().length > 0;
const hasPoolUsed = () => poolUsedSeries().length > 0;
const hasPoolAvail = () => poolAvailSeries().length > 0;
- const emptyLabel = () => (fetchFailed() ? 'Trend data unavailable' : 'No history yet');
+ const emptyLabel = () => {
+ if (fetchFailed()) return 'Trend data unavailable';
+ if (summaryFocus.activeGroupScope()) return 'No group history yet';
+ return 'No history yet';
+ };
const rangeLabel = () => SUMMARY_TIME_RANGE_LABEL[props.timeRange] ?? props.timeRange;
diff --git a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
index 543711cb81..5342eb5fde 100644
--- a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
@@ -740,6 +740,43 @@ describe('Storage', () => {
expect((screen.getByLabelText('Node') as HTMLSelectElement).value).toBe('all');
});
+ it('pins storage group scope into the route without conflating it with expansion', async () => {
+ hookResources = [
+ buildStorageResource('storage-1', 'Node-Store', 'pve1'),
+ buildStorageResource('storage-2', 'Edge-Store', 'pve2'),
+ ];
+ mockLocationSearch = '?group=node';
+ navigateSpy.mockImplementation((nextPath: string) => {
+ mockLocationSearch = nextPath.includes('?') ? nextPath.slice(nextPath.indexOf('?')) : '';
+ });
+
+ render(() => <Storage />);
+
+ await waitFor(() => {
+ expect(
+ document.querySelector('tr[data-summary-group-id="storage:node:pve1"]'),
+ ).toBeTruthy();
+ });
+
+ let groupRow = document.querySelector(
+ 'tr[data-summary-group-id="storage:node:pve1"]',
+ ) as HTMLTableRowElement | null;
+ expect(groupRow).not.toBeNull();
+ if (!groupRow) {
+ return;
+ }
+
+ fireEvent.click(groupRow);
+
+ await waitFor(() => {
+ expect(navigateSpy).toHaveBeenCalledWith(
+ '/storage?group=node&summaryGroup=storage%3Anode%3Apve1',
+ ROUTE_STATE_REPLACE_OPTIONS,
+ );
+ expect(groupRow.getAttribute('aria-pressed')).toBe('true');
+ });
+ });
+
it('shows ceph summary card and pool expand chevron', async () => {
hookResources = [
buildStorageResource('storage-ceph', 'Ceph-Pool-1', 'pve1', {
diff --git a/frontend-modern/src/components/Storage/__tests__/StorageGroupRow.test.tsx b/frontend-modern/src/components/Storage/__tests__/StorageGroupRow.test.tsx
index 71e02d1418..71708dc5a1 100644
--- a/frontend-modern/src/components/Storage/__tests__/StorageGroupRow.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/StorageGroupRow.test.tsx
@@ -1,4 +1,4 @@
-import { cleanup, render, screen } from '@solidjs/testing-library';
+import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';
import { afterEach, describe, expect, it, vi } from 'vitest';
import type { StorageGroupedRecords } from '../useStorageModel';
import { StorageGroupRow } from '../StorageGroupRow';
@@ -39,6 +39,9 @@ describe('StorageGroupRow', () => {
groupBy="node"
expanded={false}
onToggle={onToggle}
+ summaryGroupScope={null}
+ summaryActive={false}
+ summaryFocused={false}
/>
</tbody>
</table>
@@ -53,4 +56,53 @@ describe('StorageGroupRow', () => {
expect(container.querySelector('.bg-slate-400')).toBeInTheDocument();
expect(container.querySelector('.bg-slate-300')).toBeInTheDocument();
});
+
+ it('separates summary focus from expand-collapse controls on group rows', () => {
+ const onToggle = vi.fn();
+ const onFocusChange = vi.fn();
+ const onHoverChange = vi.fn();
+ const scope = {
+ id: 'storage:node:tower',
+ label: 'tower (2 pools)',
+ seriesIds: ['pool-1', 'pool-2'],
+ };
+
+ render(() => (
+ <table>
+ <tbody>
+ <StorageGroupRow
+ group={makeGroup()}
+ groupBy="node"
+ expanded={false}
+ onToggle={onToggle}
+ summaryGroupScope={scope}
+ summaryActive={false}
+ summaryFocused={false}
+ onFocusChange={onFocusChange}
+ onHoverChange={onHoverChange}
+ />
+ </tbody>
+ </table>
+ ));
+
+ const row = screen.getByText('tower').closest('tr');
+ expect(row).not.toBeNull();
+ if (!row) {
+ return;
+ }
+
+ fireEvent.mouseEnter(row);
+ expect(onHoverChange).toHaveBeenCalledWith(scope);
+
+ fireEvent.click(row);
+ expect(onFocusChange).toHaveBeenCalledWith(scope);
+ expect(onToggle).not.toHaveBeenCalled();
+
+ const toggleButton = screen.getByRole('button', { name: 'Expand tower' });
+ fireEvent.click(toggleButton);
+ expect(onToggle).toHaveBeenCalledTimes(1);
+
+ fireEvent.mouseLeave(row);
+ expect(onHoverChange).toHaveBeenLastCalledWith(null);
+ });
});
diff --git a/frontend-modern/src/components/Storage/__tests__/StorageSummary.test.tsx b/frontend-modern/src/components/Storage/__tests__/StorageSummary.test.tsx
index 838f9a35dc..8459ea38f7 100644
--- a/frontend-modern/src/components/Storage/__tests__/StorageSummary.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/StorageSummary.test.tsx
@@ -2,6 +2,7 @@ import { cleanup, render, screen, waitFor } from '@solidjs/testing-library';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import StorageSummary from '../StorageSummary';
+import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
const mockGetStorageSummaryCharts = vi.fn();
@@ -183,4 +184,60 @@ describe('StorageSummary', () => {
});
});
+ it('filters pool summary cards to the hovered storage group scope', async () => {
+ const poolIds = ['pool:alpha', 'pool:beta', 'pool:gamma'];
+ const hoveredGroupScope: SummarySeriesGroupScope = {
+ id: 'storage:node:pve1',
+ label: 'pve1 (2 pools)',
+ seriesIds: poolIds.slice(0, 2),
+ };
+ mockGetStorageSummaryCharts.mockResolvedValueOnce({
+ pools: {
+ 'pool:alpha': {
+ name: 'Alpha Pool',
+ usage: twoPointSeries,
+ used: twoPointSeries,
+ avail: twoPointSeries,
+ },
+ 'pool:beta': {
+ name: 'Beta Pool',
+ usage: twoPointSeries,
+ used: twoPointSeries,
+ avail: twoPointSeries,
+ },
+ 'pool:gamma': {
+ name: 'Gamma Pool',
+ usage: twoPointSeries,
+ used: twoPointSeries,
+ avail: twoPointSeries,
+ },
+ },
+ disks: {},
+ stats: {
+ oldestDataTimestamp: now - 60_000,
+ },
+ });
+
+ render(() => (
+ <StorageSummary
+ poolCount={3}
+ diskCount={0}
+ timeRange="1h"
+ hoveredGroupScope={hoveredGroupScope}
+ hoveredResourceId="pool:alpha"
+ />
+ ));
+
+ await waitFor(() => {
+ const sparklines = screen.getAllByTestId('sparkline');
+ expect(sparklines).toHaveLength(3);
+ for (const sparkline of sparklines) {
+ expect(sparkline.getAttribute('data-series-count')).toBe('2');
+ expect(sparkline.getAttribute('data-series-ids')).toBe('pool:alpha|pool:beta');
+ expect(sparkline.getAttribute('data-highlight-series-id')).toBe('pool:alpha');
+ expect(sparkline.getAttribute('data-interaction-state')).toBe('active');
+ }
+ });
+ });
+
});
diff --git a/frontend-modern/src/components/Storage/storageSummaryGroups.ts b/frontend-modern/src/components/Storage/storageSummaryGroups.ts
new file mode 100644
index 0000000000..a03cb70994
--- /dev/null
+++ b/frontend-modern/src/components/Storage/storageSummaryGroups.ts
@@ -0,0 +1,63 @@
+import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
+import {
+ buildStorageGroupRowPresentation,
+ getStorageGroupPoolCountLabel,
+} from '@/features/storageBackups/groupPresentation';
+import { resolveStorageRecordMetricResourceId } from '@/features/storageBackups/storageMetricsIdentity';
+import type { StorageGroupKey, StorageGroupedRecords } from './useStorageModel';
+
+const normalizeStorageSummaryGroupKey = (value: string): string => value.trim();
+
+export const buildStorageSummaryGroupId = (
+ groupBy: StorageGroupKey,
+ groupKey: string,
+): string | null => {
+ if (groupBy === 'none') {
+ return null;
+ }
+ const normalizedGroupKey = normalizeStorageSummaryGroupKey(groupKey);
+ if (!normalizedGroupKey) {
+ return null;
+ }
+ return `storage:${groupBy}:${normalizedGroupKey}`;
+};
+
+export const buildStorageSummaryGroupScope = (
+ group: StorageGroupedRecords,
+ groupBy: StorageGroupKey,
+): SummarySeriesGroupScope | null => {
+ const id = buildStorageSummaryGroupId(groupBy, group.key);
+ if (!id) {
+ return null;
+ }
+
+ const seriesIds = Array.from(
+ new Set(group.items.map((record) => resolveStorageRecordMetricResourceId(record)).filter(Boolean)),
+ );
+ if (seriesIds.length === 0) {
+ return null;
+ }
+
+ const presentation = buildStorageGroupRowPresentation(group);
+ const countLabel = getStorageGroupPoolCountLabel(group.items.length);
+
+ return {
+ id,
+ label: `${presentation.label} (${countLabel})`,
+ seriesIds,
+ };
+};
+
+export const buildStorageSummaryGroupScopeMap = (
+ groups: StorageGroupedRecords[],
+ groupBy: StorageGroupKey,
+): Map<string, SummarySeriesGroupScope> => {
+ const scopes = new Map<string, SummarySeriesGroupScope>();
+ for (const group of groups) {
+ const scope = buildStorageSummaryGroupScope(group, groupBy);
+ if (scope) {
+ scopes.set(scope.id, scope);
+ }
+ }
+ return scopes;
+};
diff --git a/frontend-modern/src/components/Storage/useStoragePageModel.ts b/frontend-modern/src/components/Storage/useStoragePageModel.ts
index fd1ef2fc48..54d5670f96 100644
--- a/frontend-modern/src/components/Storage/useStoragePageModel.ts
+++ b/frontend-modern/src/components/Storage/useStoragePageModel.ts
@@ -1,4 +1,4 @@
-import { createEffect, createMemo, createSignal } from 'solid-js';
+import { createEffect, createMemo, createSignal, onCleanup, untrack } from 'solid-js';
import { useLocation, useNavigate } from '@solidjs/router';
import {
resolvePhysicalDiskMetricResourceId,
@@ -6,6 +6,13 @@ import {
} from '@/features/storageBackups/storageMetricsIdentity';
import { useKioskMode } from '@/hooks/useKioskMode';
import { useSummaryPageInteractionState } from '@/components/shared/summaryTableFocus';
+import {
+ isSummarySeriesInGroupScope,
+ type SummarySeriesGroupScope,
+} from '@/components/shared/summaryCardInteraction';
+import { createRouteStateNavigateScheduler } from '@/utils/routeStateNavigation';
+import { areSearchParamsEquivalent } from '@/utils/searchParams';
+import { parseStorageLinkSearch, STORAGE_QUERY_PARAMS } from '@/routing/resourceLinks';
import { useStorageExpansionState } from './useStorageExpansionState';
import { useStorageFilterState } from './useStorageFilterState';
import { useStoragePageData } from './useStoragePageData';
@@ -14,12 +21,21 @@ import { useStoragePageResources } from './useStoragePageResources';
import { useStoragePageStatus } from './useStoragePageStatus';
import { useStorageResourceHighlight } from './useStorageResourceHighlight';
import { isStorageRecordCeph } from './storagePageState';
+import { buildStorageSummaryGroupScopeMap } from './storageSummaryGroups';
export const useStoragePageModel = () => {
const navigate = useNavigate();
const location = useLocation();
+ const routeStateNavigate = createRouteStateNavigateScheduler(
+ navigate,
+ () => `${untrack(() => location.pathname)}${untrack(() => location.search)}`,
+ );
const kioskMode = useKioskMode();
const [hoveredStorageRowId, setHoveredStorageResourceId] = createSignal<string | null>(null);
+ const [hoveredStorageGroupScope, setHoveredStorageGroupScope] =
+ createSignal<SummarySeriesGroupScope | null>(null);
+ const [selectedStorageGroupId, setSelectedStorageGroupIdRaw] = createSignal<string | null>(null);
+ const [handledSummaryGroupId, setHandledSummaryGroupId] = createSignal<string | null>(null);
const [selectedDiskId, setSelectedDiskId] = createSignal<string | null>(null);
const {
state,
@@ -99,7 +115,7 @@ export const useStoragePageModel = () => {
reconnect();
};
- const { expandedGroups, expandedPoolId, setExpandedPoolId, toggleGroup } =
+ const { expandedGroups, expandedPoolId, setExpandedPoolId: setExpandedPoolIdRaw, toggleGroup } =
useStorageExpansionState({
groupedKeys: () => groupedRecords().map((group) => group.key),
view,
@@ -152,10 +168,120 @@ export const useStoragePageModel = () => {
}
return ids;
});
+ const storageSummaryGroupScopes = createMemo<Map<string, SummarySeriesGroupScope>>(() => {
+ if (view() !== 'pools' || groupBy() === 'none') {
+ return new Map<string, SummarySeriesGroupScope>();
+ }
+ return buildStorageSummaryGroupScopeMap(groupedRecords(), groupBy());
+ });
+ const focusedStorageGroupScope = createMemo<SummarySeriesGroupScope | null>(() => {
+ const groupId = selectedStorageGroupId();
+ if (!groupId) {
+ return null;
+ }
+ return storageSummaryGroupScopes().get(groupId) ?? null;
+ });
+
+ const scheduleStorageSummaryGroupPath = (summaryGroupId: string | null) => {
+ const currentParams = new URLSearchParams(location.search);
+ const nextParams = new URLSearchParams(location.search);
+ nextParams.delete(STORAGE_QUERY_PARAMS.summaryGroup);
+ const normalizedSummaryGroupId = summaryGroupId?.trim() || '';
+ if (normalizedSummaryGroupId) {
+ nextParams.set(STORAGE_QUERY_PARAMS.summaryGroup, normalizedSummaryGroupId);
+ }
+ if (areSearchParamsEquivalent(currentParams, nextParams)) {
+ return;
+ }
+ const nextSearch = nextParams.toString();
+ const nextPath = nextSearch ? `${location.pathname}?${nextSearch}` : location.pathname;
+ routeStateNavigate.schedule(nextPath);
+ };
+
+ const clearFocusedStorageGroup = () => {
+ setSelectedStorageGroupIdRaw(null);
+ scheduleStorageSummaryGroupPath(null);
+ };
+
+ const setExpandedPoolId = (
+ value: string | null | ((current: string | null) => string | null),
+ ) => {
+ const nextValue = typeof value === 'function' ? value(expandedPoolId()) : value;
+ const focusedScope = focusedStorageGroupScope();
+ const nextResourceId =
+ nextValue && storageRecordMetricIds().get(nextValue) ? storageRecordMetricIds().get(nextValue)! : null;
+ if (focusedScope && nextResourceId && !isSummarySeriesInGroupScope(focusedScope, nextResourceId)) {
+ clearFocusedStorageGroup();
+ }
+ setExpandedPoolIdRaw(nextValue);
+ };
+
+ const setFocusedStorageGroupScope = (scope: SummarySeriesGroupScope | null) => {
+ const nextGroupId = scope?.id ?? null;
+ setSelectedStorageGroupIdRaw(nextGroupId);
+ if (scope && !isSummarySeriesInGroupScope(scope, focusedStorageResourceId())) {
+ setExpandedPoolIdRaw(null);
+ }
+ scheduleStorageSummaryGroupPath(nextGroupId);
+ };
createEffect(() => {
view();
setHoveredStorageResourceId(null);
+ if (view() !== 'pools') {
+ setHoveredStorageGroupScope(null);
+ if (selectedStorageGroupId()) {
+ setFocusedStorageGroupScope(null);
+ }
+ }
+ });
+
+ createEffect(() => {
+ const { summaryGroup } = parseStorageLinkSearch(location.search);
+ if (!summaryGroup) {
+ if (handledSummaryGroupId() === null) {
+ return;
+ }
+ setSelectedStorageGroupIdRaw(null);
+ setHandledSummaryGroupId(null);
+ return;
+ }
+ if (summaryGroup === handledSummaryGroupId()) {
+ return;
+ }
+ setSelectedStorageGroupIdRaw(summaryGroup);
+ setHandledSummaryGroupId(summaryGroup);
+ });
+
+ createEffect(() => {
+ const hoveredGroup = hoveredStorageGroupScope();
+ if (!hoveredGroup) {
+ return;
+ }
+ if (!storageSummaryGroupScopes().has(hoveredGroup.id)) {
+ setHoveredStorageGroupScope(null);
+ }
+ });
+
+ createEffect(() => {
+ const selectedGroupId = selectedStorageGroupId();
+ if (!selectedGroupId) {
+ return;
+ }
+ if (!focusedStorageGroupScope()) {
+ setFocusedStorageGroupScope(null);
+ }
+ });
+
+ createEffect(() => {
+ const focusedScope = focusedStorageGroupScope();
+ const focusedResourceId = focusedStorageResourceId();
+ if (!focusedScope || !focusedResourceId) {
+ return;
+ }
+ if (!isSummarySeriesInGroupScope(focusedScope, focusedResourceId)) {
+ clearFocusedStorageGroup();
+ }
});
const {
@@ -195,7 +321,9 @@ export const useStoragePageModel = () => {
setExpandedPoolId,
});
const summaryInteraction = useSummaryPageInteractionState({
+ hoveredGroupScope: hoveredStorageGroupScope,
hoveredSeriesId: hoveredStorageResourceId,
+ focusedGroupScope: focusedStorageGroupScope,
focusedSeriesId: focusedStorageResourceId,
revealActiveSeries: (seriesId) => {
if (physicalDiskSeriesIds().has(seriesId)) {
@@ -218,7 +346,12 @@ export const useStoragePageModel = () => {
},
});
+ onCleanup(() => {
+ routeStateNavigate.cleanup();
+ });
+
return {
+ activeSummaryStorageGroupScope: summaryInteraction.activeGroupScope,
activeSummaryStorageResourceId: summaryInteraction.activeSeriesId,
kioskMode,
reconnect: reconnectSurface,
@@ -262,8 +395,13 @@ export const useStoragePageModel = () => {
hoveredStorageResourceId,
isLoadingPools,
jumpToActiveStorageRow: summaryInteraction.jumpToActiveRow,
+ focusedSummaryStorageGroupScope: focusedStorageGroupScope,
+ focusedSummaryStorageGroupId: selectedStorageGroupId,
+ hoveredSummaryStorageGroupScope: hoveredStorageGroupScope,
selectedDiskId,
setChartHoverSync: summaryInteraction.setChartHoverSync,
+ setFocusedStorageGroupScope,
+ setHoveredStorageGroupScope,
setHoveredStorageResourceId,
setSelectedDiskId,
setSummaryTableRootRef: summaryInteraction.setTableRootRef,
diff --git a/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx b/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx
index a05c0c6bf5..120a4c8f44 100644
--- a/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx
+++ b/frontend-modern/src/components/Workloads/WorkloadsSummary.tsx
@@ -39,6 +39,7 @@ interface WorkloadsSummaryProps {
fallbackSnapshots?: WorkloadSummarySnapshot[];
hoveredWorkloadId?: string | null;
hoveredGroupScope?: SummarySeriesGroupScope | null;
+ focusedGroupScope?: SummarySeriesGroupScope | null;
focusedWorkloadId?: string | null;
chartHoverSync?: SummaryChartHoverSync | null;
onTimeRangeChange?: (range: TimeRange) => void;
@@ -673,6 +674,7 @@ export const WorkloadsSummary: Component<WorkloadsSummaryProps> = (props) => {
const summaryFocus = useSummaryContextualFocusState({
chartHoveredSeriesId: () => chartHoverSync()?.seriesId ?? null,
interactiveSeries: workloadSeries,
+ focusedGroupScope: () => props.focusedGroupScope,
hoveredGroupScope: () => props.hoveredGroupScope,
hoveredSeriesId: () => props.hoveredWorkloadId,
focusedSeriesId: () => props.focusedWorkloadId,
diff --git a/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx b/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx
index 6df4a9509f..307262750b 100644
--- a/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx
+++ b/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx
@@ -44,10 +44,14 @@ export function InfrastructurePageSurface() {
setGroupingMode,
activeSummaryResourceId,
activeSummaryResourceGroupScope,
+ focusedSummaryResourceGroupId,
+ focusedSummaryResourceGroupScope,
expandedResourceId,
setExpandedResourceId,
chartHoverSync,
hoveredResourceId,
+ hoveredSummaryResourceGroupScope,
+ setFocusedResourceGroupId,
setHoveredResourceGroupScope,
setHoveredResourceId,
highlightedResourceId,
@@ -145,7 +149,8 @@ export function InfrastructurePageSurface() {
resources={filteredResources()}
timeRange={infrastructureSummaryRange()}
onTimeRangeChange={setInfrastructureSummaryRange}
- hoveredGroupScope={activeSummaryResourceGroupScope()}
+ hoveredGroupScope={hoveredSummaryResourceGroupScope()}
+ focusedGroupScope={focusedSummaryResourceGroupScope()}
hoveredResourceId={hoveredResourceId()}
focusedResourceId={expandedResourceId()}
chartHoverSync={chartHoverSync()}
@@ -318,10 +323,12 @@ export function InfrastructurePageSurface() {
resources={filteredResources()}
expandedResourceId={expandedResourceId()}
activeSummaryGroupScope={activeSummaryResourceGroupScope()}
+ focusedSummaryGroupId={focusedSummaryResourceGroupId()}
hoveredResourceId={activeSummaryResourceId()}
highlightedResourceId={highlightedResourceId()}
revealedResourceId={revealedResourceId()}
onExpandedResourceChange={setExpandedResourceId}
+ onGroupFocusChange={setFocusedResourceGroupId}
onGroupHoverChange={setHoveredResourceGroupScope}
onHoverChange={setHoveredResourceId}
groupingMode={groupingMode()}
diff --git a/frontend-modern/src/features/infrastructure/__tests__/InfrastructurePageSurface.guardrails.test.ts b/frontend-modern/src/features/infrastructure/__tests__/InfrastructurePageSurface.guardrails.test.ts
index b6f2395dd4..88e9bcf47e 100644
--- a/frontend-modern/src/features/infrastructure/__tests__/InfrastructurePageSurface.guardrails.test.ts
+++ b/frontend-modern/src/features/infrastructure/__tests__/InfrastructurePageSurface.guardrails.test.ts
@@ -43,15 +43,17 @@ describe('InfrastructurePageSurface guardrails', () => {
it('keeps summary-to-table coordination on the page-state owner', () => {
expect(infrastructurePageSurfaceSource).toContain('showJumpToActiveRow={shouldShowJumpToActiveResourceRow()}');
expect(infrastructurePageSurfaceSource).toContain('onJumpToActiveRow={jumpToActiveResourceRow}');
- expect(infrastructurePageSurfaceSource).toContain('hoveredGroupScope={activeSummaryResourceGroupScope()}');
+ expect(infrastructurePageSurfaceSource).toContain('hoveredGroupScope={hoveredSummaryResourceGroupScope()}');
+ expect(infrastructurePageSurfaceSource).toContain('focusedGroupScope={focusedSummaryResourceGroupScope()}');
expect(infrastructurePageSurfaceSource).toContain('activeSummaryGroupScope={activeSummaryResourceGroupScope()}');
expect(infrastructurePageSurfaceSource).toContain('onGroupHoverChange={setHoveredResourceGroupScope}');
expect(infrastructurePageSurfaceSource).toContain('setTableRootRef={setSummaryTableRootRef}');
expect(infrastructurePageSurfaceSource).not.toContain('useSummaryPageInteractionState');
expect(infrastructurePageStateSource).toContain('useSummaryPageInteractionState');
- expect(infrastructurePageStateSource).toContain('hoveredResourceGroupScope');
+ expect(infrastructurePageStateSource).toContain('hoveredSummaryResourceGroupScope');
expect(infrastructurePageStateSource).toContain('activeSummaryResourceGroupScope');
+ expect(infrastructurePageStateSource).toContain('focusedSummaryResourceGroupScope');
expect(infrastructurePageStateSource).toContain('setHoveredResourceGroupScope');
expect(infrastructurePageStateSource).toContain('jumpToActiveResourceRow');
expect(infrastructurePageStateSource).toContain('setSummaryTableRootRef');
diff --git a/frontend-modern/src/features/infrastructure/useInfrastructurePageRouteState.ts b/frontend-modern/src/features/infrastructure/useInfrastructurePageRouteState.ts
index 40fd1ed3dd..c9f7e0dbd4 100644
--- a/frontend-modern/src/features/infrastructure/useInfrastructurePageRouteState.ts
+++ b/frontend-modern/src/features/infrastructure/useInfrastructurePageRouteState.ts
@@ -46,10 +46,12 @@ export function useInfrastructurePageRouteState(options: InfrastructurePageRoute
);
const [expandedResourceId, setExpandedResourceId] = createSignal<string | null>(null);
+ const [focusedResourceGroupId, setFocusedResourceGroupId] = createSignal<string | null>(null);
const [hoveredResourceId, setHoveredResourceId] = createSignal<string | null>(null);
const [highlightedResourceId, setHighlightedResourceId] = createSignal<string | null>(null);
const [revealedResourceId, setRevealedResourceId] = createSignal<string | null>(null);
const [handledResourceId, setHandledResourceId] = createSignal<string | null>(null);
+ const [handledSummaryGroupId, setHandledSummaryGroupId] = createSignal<string | null>(null);
const [handledSourceParam, setHandledSourceParam] = createSignal<string | null>(null);
const [handledQueryParam, setHandledQueryParam] = createSignal('');
@@ -84,6 +86,21 @@ export function useInfrastructurePageRouteState(options: InfrastructurePageRoute
setHandledResourceId(null);
});
+ createEffect(() => {
+ const { summaryGroup: summaryGroupId } = parseInfrastructureLinkSearch(location.search);
+ if (!summaryGroupId) {
+ if (handledSummaryGroupId() === null) {
+ return;
+ }
+ setFocusedResourceGroupId(null);
+ setHandledSummaryGroupId(null);
+ return;
+ }
+ if (summaryGroupId === handledSummaryGroupId()) return;
+ setFocusedResourceGroupId(summaryGroupId);
+ setHandledSummaryGroupId(summaryGroupId);
+ });
+
createEffect(() => {
const { source: sourceParam } = parseInfrastructureLinkSearch(location.search);
if (!sourceParam) {
@@ -120,9 +137,11 @@ export function useInfrastructurePageRouteState(options: InfrastructurePageRoute
const urlSource = parsed.source ?? '';
const urlQuery = parsed.query ?? '';
const urlResource = parsed.resource ?? '';
+ const urlSummaryGroup = parsed.summaryGroup ?? '';
if ((handledSourceParam() ?? '') !== urlSource) return;
if (handledQueryParam() !== urlQuery) return;
if (urlResource && handledResourceId() !== urlResource && !initialLoadComplete()) return;
+ if (urlSummaryGroup && handledSummaryGroupId() !== urlSummaryGroup && !initialLoadComplete()) return;
const nextSource = selectedSource();
const nextQuery = searchQuery().trim();
@@ -133,11 +152,13 @@ export function useInfrastructurePageRouteState(options: InfrastructurePageRoute
const nextResource = shouldPreserveIncomingResource
? currentLinkedResource
: (selectedResourceId ?? '');
+ const nextSummaryGroup = focusedResourceGroupId() ?? '';
const managedPath = buildInfrastructurePath({
source: nextSource || null,
query: nextQuery || null,
resource: nextResource || null,
+ summaryGroup: nextSummaryGroup || null,
});
const managedUrl = new URL(managedPath, 'http://pulse.local');
const currentParams = new URLSearchParams(location.search);
@@ -145,6 +166,7 @@ export function useInfrastructurePageRouteState(options: InfrastructurePageRoute
nextParams.delete(INFRASTRUCTURE_QUERY_PARAMS.source);
nextParams.delete(INFRASTRUCTURE_QUERY_PARAMS.query);
nextParams.delete(INFRASTRUCTURE_QUERY_PARAMS.resource);
+ nextParams.delete(INFRASTRUCTURE_QUERY_PARAMS.summaryGroup);
managedUrl.searchParams.forEach((value, key) => {
nextParams.set(key, value);
});
@@ -183,7 +205,9 @@ export function useInfrastructurePageRouteState(options: InfrastructurePageRoute
return {
expandedResourceId,
+ focusedResourceGroupId,
setExpandedResourceId,
+ setFocusedResourceGroupId,
hoveredResourceId,
setHoveredResourceId,
highlightedResourceId,
diff --git a/frontend-modern/src/features/infrastructure/useInfrastructurePageState.ts b/frontend-modern/src/features/infrastructure/useInfrastructurePageState.ts
index e8d5ca2290..60eecba98a 100644
--- a/frontend-modern/src/features/infrastructure/useInfrastructurePageState.ts
+++ b/frontend-modern/src/features/infrastructure/useInfrastructurePageState.ts
@@ -7,8 +7,15 @@ import { STORAGE_KEYS } from '@/utils/localStorage';
import { useKioskMode } from '@/hooks/useKioskMode';
import { useSummaryPageInteractionState } from '@/components/shared/summaryTableFocus';
import { isSummaryTimeRange } from '@/components/shared/summaryTimeRange';
-import { infrastructureHasVisibleSummaryGroupScope } from '@/components/Infrastructure/infrastructureSelectors';
-import type { SummarySeriesGroupScope } from '@/components/shared/summaryCardInteraction';
+import {
+ buildInfrastructureSummaryGroupScope,
+ groupResources,
+ infrastructureHasVisibleSummaryGroupScope,
+} from '@/components/Infrastructure/infrastructureSelectors';
+import {
+ isSummarySeriesInGroupScope,
+ type SummarySeriesGroupScope,
+} from '@/components/shared/summaryCardInteraction';
import { useInfrastructurePageRouteState } from './useInfrastructurePageRouteState';
import { buildInfrastructurePageFilterDerivation } from './infrastructurePageModel';
@@ -73,12 +80,37 @@ export function useInfrastructurePageState() {
searchQuery,
setSearchQuery,
});
+ const focusedResourceGroupScope = createMemo<SummarySeriesGroupScope | null>(() => {
+ if (groupingMode() !== 'grouped') {
+ return null;
+ }
+ const focusedGroupId = routeState.focusedResourceGroupId();
+ if (!focusedGroupId) {
+ return null;
+ }
+ const groups = groupResources(filteredResources(), groupingMode());
+ for (const group of groups) {
+ const scope = buildInfrastructureSummaryGroupScope(group);
+ if (scope?.id === focusedGroupId) {
+ return scope;
+ }
+ }
+ return null;
+ });
const summaryInteraction = useSummaryPageInteractionState({
hoveredSeriesId: routeState.hoveredResourceId,
hoveredGroupScope: hoveredResourceGroupScope,
focusedSeriesId: routeState.expandedResourceId,
+ focusedGroupScope: focusedResourceGroupScope,
revealActiveSeries: routeState.setRevealedResourceId,
});
+ const setExpandedResourceId = (resourceId: string | null) => {
+ const groupScope = focusedResourceGroupScope();
+ if (groupScope && resourceId && !isSummarySeriesInGroupScope(groupScope, resourceId)) {
+ routeState.setFocusedResourceGroupId(null);
+ }
+ routeState.setExpandedResourceId(resourceId);
+ };
const clearFilters = () => {
setSelectedSource('');
@@ -99,6 +131,9 @@ export function useInfrastructurePageState() {
if (hoveredResourceGroupScope()) {
setHoveredResourceGroupScope(null);
}
+ if (routeState.focusedResourceGroupId()) {
+ routeState.setFocusedResourceGroupId(null);
+ }
});
createEffect(() => {
@@ -111,6 +146,27 @@ export function useInfrastructurePageState() {
}
});
+ createEffect(() => {
+ const focusedGroupId = routeState.focusedResourceGroupId();
+ if (!focusedGroupId) {
+ return;
+ }
+ if (!focusedResourceGroupScope()) {
+ routeState.setFocusedResourceGroupId(null);
+ }
+ });
+
+ createEffect(() => {
+ const expandedResourceId = routeState.expandedResourceId();
+ const groupScope = focusedResourceGroupScope();
+ if (!expandedResourceId || !groupScope) {
+ return;
+ }
+ if (!isSummarySeriesInGroupScope(groupScope, expandedResourceId)) {
+ routeState.setExpandedResourceId(null);
+ }
+ });
+
return {
loading,
error,
@@ -131,6 +187,9 @@ export function useInfrastructurePageState() {
setGroupingMode,
activeSummaryResourceId: summaryInteraction.activeSeriesId,
activeSummaryResourceGroupScope: summaryInteraction.activeGroupScope,
+ focusedSummaryResourceGroupScope: focusedResourceGroupScope,
+ focusedSummaryResourceGroupId: routeState.focusedResourceGroupId,
+ hoveredSummaryResourceGroupScope: hoveredResourceGroupScope,
...routeState,
chartHoverSync: summaryInteraction.chartHoverSync,
isMobile,
@@ -148,6 +207,7 @@ export function useInfrastructurePageState() {
clearFilters,
filteredResources,
hasFilteredResources,
+ setExpandedResourceId,
setChartHoverSync: summaryInteraction.setChartHoverSync,
setHoveredResourceGroupScope,
setSummaryTableRootRef: summaryInteraction.setTableRootRef,
diff --git a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
index 1156a29462..7a970582ca 100644
--- a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
+++ b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
@@ -71,6 +71,7 @@ describe('resource link routing contract', () => {
namespace: '',
agent: 'worker-1',
resource: 'cluster-a:worker-1:101',
+ summaryGroup: '',
});
expect(WORKLOADS_QUERY_PARAMS.type).toBe('type');
@@ -80,6 +81,7 @@ describe('resource link routing contract', () => {
expect(WORKLOADS_QUERY_PARAMS.namespace).toBe('namespace');
expect(WORKLOADS_QUERY_PARAMS.agent).toBe('agent');
expect(WORKLOADS_QUERY_PARAMS.resource).toBe('resource');
+ expect(WORKLOADS_QUERY_PARAMS.summaryGroup).toBe('summaryGroup');
});
it('canonicalizes legacy workloads type aliases when building links', () => {
@@ -104,11 +106,13 @@ describe('resource link routing contract', () => {
source: 'docker',
query: 'docker-host-1',
resource: 'docker-host-1',
+ summaryGroup: '',
});
expect(INFRASTRUCTURE_QUERY_PARAMS.source).toBe('source');
expect(INFRASTRUCTURE_QUERY_PARAMS.query).toBe('q');
expect(INFRASTRUCTURE_QUERY_PARAMS.resource).toBe('resource');
+ expect(INFRASTRUCTURE_QUERY_PARAMS.summaryGroup).toBe('summaryGroup');
});
it('canonicalizes infrastructure source aliases when building and parsing links', () => {
@@ -119,6 +123,7 @@ describe('resource link routing contract', () => {
source: 'proxmox-pbs',
query: 'archive',
resource: '',
+ summaryGroup: '',
});
});
@@ -257,6 +262,7 @@ describe('resource link routing contract', () => {
resource: 'storage-1',
sort: 'usage',
order: 'desc',
+ summaryGroup: '',
});
expect(STORAGE_QUERY_PARAMS.tab).toBe('tab');
@@ -265,6 +271,7 @@ describe('resource link routing contract', () => {
expect(STORAGE_QUERY_PARAMS.resource).toBe('resource');
expect(STORAGE_QUERY_PARAMS.sort).toBe('sort');
expect(STORAGE_QUERY_PARAMS.order).toBe('order');
+ expect(STORAGE_QUERY_PARAMS.summaryGroup).toBe('summaryGroup');
});
it('builds storage deep links for exact TrueNAS storage resources', () => {
diff --git a/frontend-modern/src/routing/resourceLinks.ts b/frontend-modern/src/routing/resourceLinks.ts
index 8115ca2ccc..2dbe89d7e9 100644
--- a/frontend-modern/src/routing/resourceLinks.ts
+++ b/frontend-modern/src/routing/resourceLinks.ts
@@ -33,6 +33,7 @@ export const WORKLOADS_QUERY_PARAMS = {
// Canonical v6 agent filter query param.
agent: 'agent',
resource: 'resource',
+ summaryGroup: 'summaryGroup',
} as const;
export const WORKLOADS_PATH = '/workloads';
@@ -47,6 +48,7 @@ export const INFRASTRUCTURE_QUERY_PARAMS = {
source: 'source',
query: 'q',
resource: 'resource',
+ summaryGroup: 'summaryGroup',
} as const;
export const INFRASTRUCTURE_PATH = '/infrastructure';
@@ -61,6 +63,7 @@ export const STORAGE_QUERY_PARAMS = {
resource: 'resource',
sort: 'sort',
order: 'order',
+ summaryGroup: 'summaryGroup',
} as const;
export const RECOVERY_QUERY_PARAMS = {
@@ -118,12 +121,14 @@ type WorkloadsLinkOptions = {
namespace?: string | null;
agent?: string | null;
resource?: string | null;
+ summaryGroup?: string | null;
};
type InfrastructureLinkOptions = {
source?: string | null;
query?: string | null;
resource?: string | null;
+ summaryGroup?: string | null;
};
type StorageLinkOptions = {
@@ -136,6 +141,7 @@ type StorageLinkOptions = {
resource?: string | null;
sort?: string | null;
order?: string | null;
+ summaryGroup?: string | null;
};
type RecoveryLinkOptions = {
@@ -182,6 +188,7 @@ export const parseWorkloadsLinkSearch = (search: string) => {
namespace: normalizeQueryValue(params.get(WORKLOADS_QUERY_PARAMS.namespace)),
agent: normalizeQueryValue(params.get(WORKLOADS_QUERY_PARAMS.agent)),
resource: normalizeQueryValue(params.get(WORKLOADS_QUERY_PARAMS.resource)),
+ summaryGroup: normalizeQueryValue(params.get(WORKLOADS_QUERY_PARAMS.summaryGroup)),
};
};
@@ -194,6 +201,7 @@ export const buildWorkloadsPath = (options: WorkloadsLinkOptions = {}): string =
const namespace = normalizeQueryValue(options.namespace);
const agent = normalizeQueryValue(options.agent);
const resource = normalizeQueryValue(options.resource);
+ const summaryGroup = normalizeQueryValue(options.summaryGroup);
if (type) params.set(WORKLOADS_QUERY_PARAMS.type, type);
if (platform) params.set(WORKLOADS_QUERY_PARAMS.platform, platform);
if (runtime) params.set(WORKLOADS_QUERY_PARAMS.runtime, runtime);
@@ -201,6 +209,7 @@ export const buildWorkloadsPath = (options: WorkloadsLinkOptions = {}): string =
if (namespace) params.set(WORKLOADS_QUERY_PARAMS.namespace, namespace);
if (agent) params.set(WORKLOADS_QUERY_PARAMS.agent, agent);
if (resource) params.set(WORKLOADS_QUERY_PARAMS.resource, resource);
+ if (summaryGroup) params.set(WORKLOADS_QUERY_PARAMS.summaryGroup, summaryGroup);
const query = params.toString();
return query ? `${WORKLOADS_PATH}?${query}` : WORKLOADS_PATH;
};
@@ -211,6 +220,7 @@ export const parseInfrastructureLinkSearch = (search: string) => {
source: normalizeSourcePlatformQueryValue(params.get(INFRASTRUCTURE_QUERY_PARAMS.source)),
query: normalizeQueryValue(params.get(INFRASTRUCTURE_QUERY_PARAMS.query)),
resource: normalizeQueryValue(params.get(INFRASTRUCTURE_QUERY_PARAMS.resource)),
+ summaryGroup: normalizeQueryValue(params.get(INFRASTRUCTURE_QUERY_PARAMS.summaryGroup)),
};
};
@@ -219,9 +229,11 @@ export const buildInfrastructurePath = (options: InfrastructureLinkOptions = {})
const source = normalizeSourcePlatformQueryValue(options.source);
const query = normalizeQueryValue(options.query);
const resource = normalizeQueryValue(options.resource);
+ const summaryGroup = normalizeQueryValue(options.summaryGroup);
if (source) params.set(INFRASTRUCTURE_QUERY_PARAMS.source, source);
if (query) params.set(INFRASTRUCTURE_QUERY_PARAMS.query, query);
if (resource) params.set(INFRASTRUCTURE_QUERY_PARAMS.resource, resource);
+ if (summaryGroup) params.set(INFRASTRUCTURE_QUERY_PARAMS.summaryGroup, summaryGroup);
const serialized = params.toString();
return serialized ? `${INFRASTRUCTURE_PATH}?${serialized}` : INFRASTRUCTURE_PATH;
};
@@ -525,6 +537,7 @@ export const parseStorageLinkSearch = (search: string) => {
resource: normalizeQueryValue(params.get(STORAGE_QUERY_PARAMS.resource)),
sort: normalizeQueryValue(params.get(STORAGE_QUERY_PARAMS.sort)),
order: normalizeQueryValue(params.get(STORAGE_QUERY_PARAMS.order)),
+ summaryGroup: normalizeQueryValue(params.get(STORAGE_QUERY_PARAMS.summaryGroup)),
};
};
@@ -539,6 +552,7 @@ export const buildStoragePath = (options: StorageLinkOptions = {}): string => {
const resource = normalizeQueryValue(options.resource);
const sort = normalizeQueryValue(options.sort);
const order = normalizeQueryValue(options.order);
+ const summaryGroup = normalizeQueryValue(options.summaryGroup);
if (tab) params.set(STORAGE_QUERY_PARAMS.tab, tab);
if (group) params.set(STORAGE_QUERY_PARAMS.group, group);
@@ -549,6 +563,7 @@ export const buildStoragePath = (options: StorageLinkOptions = {}): string => {
if (resource) params.set(STORAGE_QUERY_PARAMS.resource, resource);
if (sort) params.set(STORAGE_QUERY_PARAMS.sort, sort);
if (order) params.set(STORAGE_QUERY_PARAMS.order, order);
+ if (summaryGroup) params.set(STORAGE_QUERY_PARAMS.summaryGroup, summaryGroup);
const serialized = params.toString();
return serialized ? `/storage?${serialized}` : '/storage';
diff --git a/tests/integration/tests/48-summary-hover-selection.spec.ts b/tests/integration/tests/48-summary-hover-selection.spec.ts
index 2be1ca463f..fde38f96e8 100644
--- a/tests/integration/tests/48-summary-hover-selection.spec.ts
+++ b/tests/integration/tests/48-summary-hover-selection.spec.ts
@@ -978,6 +978,183 @@ test.describe.serial("Summary hover selection", () => {
.toEqual(resolvedBaselineCounts);
});
+ test("pins workload and infrastructure group scope into reversible route-backed focus", async ({
+ page,
+ }, testInfo) => {
+ test.skip(
+ testInfo.project.name.startsWith("mobile-"),
+ "Desktop runtime proof",
+ );
+
+ await ensureMockModeEnabled(page);
+
+ for (const surface of [
+ {
+ path: "/workloads",
+ summaryTestId: "workloads-summary",
+ tableRowSelector: "tr[data-guest-id]",
+ },
+ {
+ path: "/infrastructure",
+ summaryTestId: "infrastructure-summary",
+ tableRowSelector: "tr[data-summary-series-id]",
+ },
+ ] as const) {
+ await page.goto(surface.path, { waitUntil: "domcontentloaded" });
+ const summary = page.getByTestId(surface.summaryTestId);
+ await expect(summary).toBeVisible();
+
+ await expect
+ .poll(async () => {
+ const counts = await readRenderedSeriesCounts(summary);
+ return counts.length === 4 && counts.every((count) => count > 1);
+ })
+ .toBe(true);
+
+ const baselineCounts = await readRenderedSeriesCounts(summary);
+ const baselineVisibleRows = await page.locator(surface.tableRowSelector).count();
+ const groupRows = page.locator("tr[data-summary-group-id]");
+ const groupRowCount = await groupRows.count();
+ expect(groupRowCount).toBeGreaterThan(0);
+
+ let matchedGroupRow: import("@playwright/test").Locator | null = null;
+ let matchedGroupSeriesCount = 0;
+ let matchedGroupId = "";
+ for (let index = 0; index < groupRowCount; index += 1) {
+ const row = groupRows.nth(index);
+ if (!(await row.isVisible())) {
+ continue;
+ }
+ const rawSeriesCount = await row.getAttribute("data-summary-group-series-count");
+ const seriesCount = Number.parseInt(rawSeriesCount || "0", 10);
+ const groupId = (await row.getAttribute("data-summary-group-id")) || "";
+ if (!Number.isFinite(seriesCount) || seriesCount < 1 || !groupId) {
+ continue;
+ }
+ if (baselineCounts.every((count) => count <= seriesCount)) {
+ continue;
+ }
+ matchedGroupRow = row;
+ matchedGroupSeriesCount = seriesCount;
+ matchedGroupId = groupId;
+ break;
+ }
+
+ expect(matchedGroupRow).not.toBeNull();
+ expect(matchedGroupSeriesCount).toBeGreaterThan(0);
+ expect(matchedGroupId).not.toBe("");
+ if (!matchedGroupRow) {
+ return;
+ }
+
+ await matchedGroupRow.click();
+ await expect
+ .poll(() => new URL(page.url()).searchParams.get("summaryGroup"))
+ .toBe(matchedGroupId);
+ await expect(matchedGroupRow).toHaveAttribute("aria-pressed", "true");
+ await expect
+ .poll(() => readRenderedSeriesCounts(summary))
+ .toEqual(new Array(4).fill(matchedGroupSeriesCount));
+ await expect(page.locator(surface.tableRowSelector)).toHaveCount(
+ baselineVisibleRows,
+ );
+
+ await page.mouse.move(1, 1);
+ await expect
+ .poll(() => readRenderedSeriesCounts(summary))
+ .toEqual(new Array(4).fill(matchedGroupSeriesCount));
+
+ await matchedGroupRow.click();
+ await expect
+ .poll(() => new URL(page.url()).searchParams.get("summaryGroup"))
+ .toBeNull();
+ await expect(matchedGroupRow).toHaveAttribute("aria-pressed", "false");
+ await page.mouse.move(1, 1);
+ await expect
+ .poll(() => readRenderedSeriesCounts(summary))
+ .toEqual(baselineCounts);
+ }
+ });
+
+ test("pins storage pool-group scope into reversible route-backed focus without collapsing the table", async ({
+ page,
+ }, testInfo) => {
+ test.skip(
+ testInfo.project.name.startsWith("mobile-"),
+ "Desktop runtime proof",
+ );
+
+ await ensureMockModeEnabled(page);
+
+ await page.goto("/storage?group=node", { waitUntil: "domcontentloaded" });
+ const storageSummary = page.getByTestId("storage-summary");
+ await expect(storageSummary).toBeVisible();
+
+ await expect
+ .poll(async () => {
+ const counts = await readRenderedSeriesCounts(storageSummary);
+ return counts.length >= 3 && counts.some((count) => count > 1);
+ })
+ .toBe(true);
+
+ const baselineCounts = await readRenderedSeriesCounts(storageSummary);
+ const baselineVisibleRows = await page.locator("tr[data-row-id]").count();
+ const groupRows = page.locator("tr[data-summary-group-id]");
+ const groupRowCount = await groupRows.count();
+ expect(groupRowCount).toBeGreaterThan(0);
+
+ let matchedGroupRow: import("@playwright/test").Locator | null = null;
+ let matchedGroupId = "";
+ for (let index = 0; index < groupRowCount; index += 1) {
+ const row = groupRows.nth(index);
+ if (!(await row.isVisible())) {
+ continue;
+ }
+ const rawSeriesCount = await row.getAttribute("data-summary-group-series-count");
+ const seriesCount = Number.parseInt(rawSeriesCount || "0", 10);
+ const groupId = (await row.getAttribute("data-summary-group-id")) || "";
+ if (!Number.isFinite(seriesCount) || seriesCount < 1 || !groupId) {
+ continue;
+ }
+ if (baselineCounts.every((count) => count <= seriesCount)) {
+ continue;
+ }
+ matchedGroupRow = row;
+ matchedGroupId = groupId;
+ break;
+ }
+
+ expect(matchedGroupRow).not.toBeNull();
+ expect(matchedGroupId).not.toBe("");
+ if (!matchedGroupRow) {
+ return;
+ }
+
+ await matchedGroupRow.click();
+ await expect
+ .poll(() => new URL(page.url()).searchParams.get("summaryGroup"))
+ .toBe(matchedGroupId);
+ await expect(matchedGroupRow).toHaveAttribute("aria-pressed", "true");
+ await expect(page.locator("tr[data-row-id]")).toHaveCount(baselineVisibleRows);
+
+ await expect
+ .poll(() => readRenderedSeriesCounts(storageSummary))
+ .not.toEqual(baselineCounts);
+
+ await page.mouse.move(1, 1);
+ await expect(page.locator("tr[data-row-id]")).toHaveCount(baselineVisibleRows);
+
+ await matchedGroupRow.click();
+ await expect
+ .poll(() => new URL(page.url()).searchParams.get("summaryGroup"))
+ .toBeNull();
+ await expect(matchedGroupRow).toHaveAttribute("aria-pressed", "false");
+ await page.mouse.move(1, 1);
+ await expect
+ .poll(() => readRenderedSeriesCounts(storageSummary))
+ .toEqual(baselineCounts);
+ });
+
test("keeps density-map detail inside the hover tooltip without extra chart chrome", async ({
page,
}, testInfo) => {