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): make summary scope explicit and reversible

rcourtman321cc758fb51
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 576965a321..93d96fa34c 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -129,6 +129,8 @@ work extends shared components instead of creating new local variants.
107. `frontend-modern/src/utils/docsLinks.ts`
108. `tests/integration/tests/20-local-doc-links.spec.ts`
109. `frontend-modern/src/index.css`
+110. `frontend-modern/src/components/shared/SummaryScopeBar.tsx`
+111. `frontend-modern/src/components/shared/summaryScopePresentation.ts`
## Shared Boundaries
@@ -149,7 +151,7 @@ work extends shared components instead of creating new local variants.
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.
+11. Keep summary-to-table coordination deliberate, explicit, 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 a page/group/entity scope is active on workloads, infrastructure, or storage, the page shell must surface that state through the shared `frontend-modern/src/components/shared/SummaryScopeBar.tsx` plus `frontend-modern/src/components/shared/summaryScopePresentation.ts` contract instead of inventing page-local chips, breadcrumbs, or hidden route-only focus. That shared scope bar must distinguish transient preview from pinned focus, keep the current scope visible even when the sticky summary is collapsed or off-screen, and expose a clear reset path for pinned scope so touch-only operators do not depend on hover or “click the same row again” discovery. When the active row is off-screen, page owners must still route through `frontend-modern/src/components/shared/summaryTableFocus.ts` and surface a lightweight `Jump to row` affordance that reveals and scrolls only on explicit user action. Deliberate row focus may reveal inline detail automatically, but that reveal must be drawer-aware: preserve already-good positions, avoid hard centering, and scroll only enough to keep the row header plus the top of the inline detail visible.
12. Keep summary-linked table row emphasis on the shared primitive contract. Workloads, infrastructure, and storage rows that mirror the active summary entity must expose that state through `data-summary-row-active` and let the shared presentation in `frontend-modern/src/index.css` render the row emphasis, rather than carrying page-local sky or blue fill classes inside each row renderer.
13. Keep retained-value data loading honest at the ownership boundary. Helpers
that prevent a feature surface from falling through the app-level Suspense
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 57c26b8967..ef6268f59e 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, 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.
+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. The explicit scope affordance for that hot path must also stay shared: `frontend-modern/src/components/shared/SummaryScopeBar.tsx` and `frontend-modern/src/components/shared/summaryScopePresentation.ts` own the visible page/group/entity scope label, preview-vs-pinned distinction, and reset affordance so touch-safe reversibility does not fork per-page banner logic. That same hot path must keep chart-backed summary-card geometry explicit and stable so hover rerenders, synchronized readouts, idle header metadata, or the scope bar itself 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 314cf94905..e76091a739 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -194,6 +194,13 @@ querying, and the operator-facing storage health presentation layer.
chart highlighting so pool-only cards demote cleanly during disk focus and
disk-temperature cards demote cleanly during pool focus, instead of
leaving stale row-local IDs or storage-local hover branches on the page.
+ Any page, group, or entity scope that becomes pinned through storage
+ interaction must also surface through the shared
+ `frontend-modern/src/components/shared/SummaryScopeBar.tsx` plus
+ `frontend-modern/src/components/shared/summaryScopePresentation.ts`
+ contract so touch users and mouse users see the same explicit, reversible
+ scope state instead of relying on hidden route state or storage-local
+ badges.
14. Keep storage summary remount caches versioned with the chart contract.
`frontend-modern/src/components/Storage/StorageSummary.tsx` may keep a
bounded in-memory cache for same-tab remounts, but its cache key must carry
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 55504b14ad..54961e0a51 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -211,7 +211,12 @@ assembly branch.
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.
+ same route-backed summary contract as row focus. That pinned or previewed
+ scope must be surfaced through the shared
+ `frontend-modern/src/components/shared/SummaryScopeBar.tsx` plus
+ `frontend-modern/src/components/shared/summaryScopePresentation.ts`
+ contract so infrastructure does not hide active scope in route params or
+ hover-only table affordances.
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 8dff80c7b4..b2ee8d9ef3 100644
--- a/frontend-modern/src/components/Dashboard/Dashboard.tsx
+++ b/frontend-modern/src/components/Dashboard/Dashboard.tsx
@@ -3,6 +3,7 @@ import { InfrastructureSelector } from '@/components/shared/InfrastructureSelect
import { DashboardFilter } from './DashboardFilter';
import { WorkloadsSummary } from '@/components/Workloads/WorkloadsSummary';
import { ScrollToTopButton } from '@/components/shared/ScrollToTopButton';
+import { SummaryScopeBar } from '@/components/shared/SummaryScopeBar';
import { StickySummarySection } from '@/components/shared/StickySummarySection';
import { DashboardStateCards } from './DashboardStateCards';
import { DashboardStatsStrip } from './DashboardStatsStrip';
@@ -94,6 +95,22 @@ export function Dashboard(props: DashboardProps) {
/>
</Show>
+ <Show
+ when={
+ state.surfaceConnected() &&
+ state.surfaceInitialDataReceived() &&
+ state.filteredGuests().length > 0
+ }
+ >
+ <SummaryScopeBar
+ testId="workloads-summary-scope"
+ active={state.summaryScopePresentation()}
+ pinned={state.hasPinnedSummaryScope() ? state.pinnedSummaryScopePresentation() : null}
+ idleHint={state.isMobile() ? 'Tap a group or row to pin scope.' : undefined}
+ onReset={state.hasPinnedSummaryScope() ? state.clearPinnedSummaryScope : undefined}
+ />
+ </Show>
+
<Show
when={
state.surfaceConnected() &&
diff --git a/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts b/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
index c9af2d07b7..07b009ccc9 100644
--- a/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
+++ b/frontend-modern/src/components/Dashboard/__tests__/useDashboardSelectionState.test.ts
@@ -121,6 +121,38 @@ describe('useDashboardSelectionState', () => {
);
});
+ it('clears pinned workload scope back to page state without mutating route filters', () => {
+ locationSearch =
+ '?type=app-container&platform=truenas&agent=truenas-main&resource=app-container%3Atruenas-main%3Anextcloud&summaryGroup=docker-host%3Atruenas-main';
+ const [filteredGuests] = createSignal<WorkloadGuest[]>([]);
+ const summaryScopes = () =>
+ new Map<string, SummarySeriesGroupScope>([
+ [
+ 'docker-host:truenas-main',
+ {
+ id: 'docker-host:truenas-main',
+ label: 'TrueNAS Main (4 workloads)',
+ seriesIds: ['app-container:truenas-main:nextcloud'],
+ },
+ ],
+ ]);
+
+ const { result } = renderHook(() =>
+ useDashboardSelectionState({
+ filteredGuests,
+ summaryGroupScopes: summaryScopes,
+ }),
+ );
+
+ result.clearPinnedSummaryScope();
+ vi.runAllTimers();
+
+ expect(navigateSpy).toHaveBeenCalledWith(
+ '/workloads?type=app-container&platform=truenas&agent=truenas-main',
+ ROUTE_STATE_REPLACE_OPTIONS,
+ );
+ });
+
it('preserves the nearest scrollable ancestor when row focus changes locally', () => {
locationSearch = '?type=app-container&platform=truenas&agent=truenas-main';
const [filteredGuests] = createSignal<WorkloadGuest[]>([]);
diff --git a/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts b/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts
index 3e3ccd37fa..2d218d0225 100644
--- a/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts
+++ b/frontend-modern/src/components/Dashboard/useDashboardSelectionState.ts
@@ -119,6 +119,22 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
}
};
+ const clearPinnedSummaryScope = () => {
+ preserveScrollableAncestorVerticalOffset(tableWrapperRef(), () => {
+ setSelectedGuestIdRaw(null);
+ setSelectedWorkloadGroupIdRaw(null);
+ });
+ const nextPath = resolveDashboardSelectionNavigateTarget({
+ pathname: location.pathname,
+ search: location.search,
+ resourceId: null,
+ summaryGroupId: null,
+ });
+ if (nextPath) {
+ routeStateNavigate.schedule(nextPath);
+ }
+ };
+
createEffect(() => {
const selection = resolveDashboardResourceSelection(location.search);
if (!selection) {
@@ -242,9 +258,11 @@ export function useDashboardSelectionState(options: UseDashboardSelectionStateOp
});
return {
+ activeSummaryScopeState: summaryInteraction.activeScopeState,
activeSummaryWorkloadGroupScope: summaryInteraction.activeGroupScope,
activeSummaryWorkloadId: summaryInteraction.activeSeriesId,
chartHoverSync: summaryInteraction.chartHoverSync,
+ clearPinnedSummaryScope,
focusedSummaryWorkloadGroupScope: focusedWorkloadGroupScope,
hoveredWorkloadId,
hoveredSummaryWorkloadGroupScope: hoveredWorkloadGroupScope,
diff --git a/frontend-modern/src/components/Dashboard/useDashboardState.ts b/frontend-modern/src/components/Dashboard/useDashboardState.ts
index c3f9277b04..3529a9bf40 100644
--- a/frontend-modern/src/components/Dashboard/useDashboardState.ts
+++ b/frontend-modern/src/components/Dashboard/useDashboardState.ts
@@ -7,6 +7,8 @@ import { useAlertsActivation } from '@/stores/alertsActivation';
import { usePersistentSignal } from '@/hooks/usePersistentSignal';
import { useWorkloads } from '@/hooks/useWorkloads';
import { useKioskMode } from '@/hooks/useKioskMode';
+import { buildSummaryScopePresentation } from '@/components/shared/summaryScopePresentation';
+import { resolveSummaryScopeState } from '@/components/shared/summaryCardInteraction';
import {
getDashboardDisconnectedState,
getDashboardGuestsEmptyState,
@@ -208,9 +210,11 @@ export function useDashboardState(props: DashboardProps) {
);
const {
+ activeSummaryScopeState,
activeSummaryWorkloadGroupScope,
activeSummaryWorkloadId,
chartHoverSync,
+ clearPinnedSummaryScope,
focusedSummaryWorkloadGroupScope,
focusedSummaryWorkloadGroupId,
hoveredWorkloadId,
@@ -232,6 +236,42 @@ export function useDashboardState(props: DashboardProps) {
summaryGroupScopes,
});
+ const workloadNamesById = createMemo(() => {
+ const names = new Map<string, string>();
+ for (const guest of filteredGuests()) {
+ const id = getCanonicalWorkloadId(guest);
+ if (!id) {
+ continue;
+ }
+ names.set(id, guest.name || id);
+ }
+ return names;
+ });
+
+ const pinnedSummaryScopeState = createMemo(() =>
+ resolveSummaryScopeState({
+ focusedSeriesId: selectedGuestId(),
+ focusedGroupScope: focusedSummaryWorkloadGroupScope(),
+ }),
+ );
+ const summaryScopePresentation = createMemo(() =>
+ buildSummaryScopePresentation({
+ allLabel: 'All workloads',
+ resolveEntityLabel: (seriesId) => workloadNamesById().get(seriesId) ?? seriesId,
+ state: activeSummaryScopeState(),
+ }),
+ );
+ const pinnedSummaryScopePresentation = createMemo(() =>
+ buildSummaryScopePresentation({
+ allLabel: 'All workloads',
+ resolveEntityLabel: (seriesId) => workloadNamesById().get(seriesId) ?? seriesId,
+ state: pinnedSummaryScopeState(),
+ }),
+ );
+ const hasPinnedSummaryScope = createMemo(
+ () => pinnedSummaryScopeState().source === 'pinned',
+ );
+
const {
bottomSpacerHeight,
getGroupLabel,
@@ -264,6 +304,7 @@ export function useDashboardState(props: DashboardProps) {
allGuests,
activeSummaryWorkloadGroupScope,
activeSummaryWorkloadId,
+ clearPinnedSummaryScope,
bottomSpacerHeight,
chartHoverSync,
columnVisibility,
@@ -335,6 +376,9 @@ export function useDashboardState(props: DashboardProps) {
setViewMode,
setWorkloadsSummaryCollapsed,
setWorkloadsSummaryRange,
+ summaryScopePresentation,
+ pinnedSummaryScopePresentation,
+ hasPinnedSummaryScope,
shouldShowJumpToActiveWorkloadRow,
sortDirection,
sortKey,
diff --git a/frontend-modern/src/components/Storage/Storage.tsx b/frontend-modern/src/components/Storage/Storage.tsx
index c8cd50cfaa..1e24ac89fa 100644
--- a/frontend-modern/src/components/Storage/Storage.tsx
+++ b/frontend-modern/src/components/Storage/Storage.tsx
@@ -1,9 +1,10 @@
-import { Component } from 'solid-js';
+import { Component, Show } from 'solid-js';
import StorageCephSection from '@/components/Storage/StorageCephSection';
import StorageContentCard from '@/components/Storage/StorageContentCard';
import StoragePageBanners from '@/components/Storage/StoragePageBanners';
import StoragePageControls from '@/components/Storage/StoragePageControls';
import StoragePageSummary from '@/components/Storage/StoragePageSummary';
+import { SummaryScopeBar } from '@/components/shared/SummaryScopeBar';
import { StickySummarySection } from '@/components/shared/StickySummarySection';
import { isStorageRecordCeph } from './storagePageState';
import { useStoragePageModel } from './useStoragePageModel';
@@ -57,11 +58,15 @@ const Storage: Component = () => {
jumpToActiveStorageRow,
selectedDiskId,
setChartHoverSync,
+ clearPinnedSummaryScope,
setFocusedStorageGroupScope,
setHoveredStorageGroupScope,
setHoveredStorageResourceId,
setSelectedDiskId,
setSummaryTableRootRef,
+ hasPinnedSummaryScope,
+ pinnedSummaryScopePresentation,
+ summaryScopePresentation,
shouldShowJumpToActiveStorageRow,
} = useStoragePageModel();
@@ -116,6 +121,16 @@ const Storage: Component = () => {
<StoragePageBanners kind={activeBannerKind} reconnect={reconnect} />
+ <Show when={filteredRecords().length > 0 || physicalDisks().length > 0}>
+ <SummaryScopeBar
+ testId="storage-summary-scope"
+ active={summaryScopePresentation()}
+ pinned={hasPinnedSummaryScope() ? pinnedSummaryScopePresentation() : null}
+ idleHint={groupBy() !== 'none' ? 'Tap a group or row to pin scope.' : 'Tap a row to pin scope.'}
+ onReset={hasPinnedSummaryScope() ? clearPinnedSummaryScope : undefined}
+ />
+ </Show>
+
<StorageContentCard
view={view}
physicalDisks={physicalDisks}
diff --git a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
index 5342eb5fde..a30d9cd7f5 100644
--- a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
@@ -775,6 +775,9 @@ describe('Storage', () => {
);
expect(groupRow.getAttribute('aria-pressed')).toBe('true');
});
+
+ expect(screen.getByTestId('storage-summary-scope')).toHaveTextContent('Pinned');
+ expect(screen.getByRole('button', { name: 'Reset pinned scope' })).toBeInTheDocument();
});
it('shows ceph summary card and pool expand chevron', async () => {
diff --git a/frontend-modern/src/components/Storage/useStoragePageModel.ts b/frontend-modern/src/components/Storage/useStoragePageModel.ts
index 54d5670f96..9be31ec042 100644
--- a/frontend-modern/src/components/Storage/useStoragePageModel.ts
+++ b/frontend-modern/src/components/Storage/useStoragePageModel.ts
@@ -6,8 +6,10 @@ import {
} from '@/features/storageBackups/storageMetricsIdentity';
import { useKioskMode } from '@/hooks/useKioskMode';
import { useSummaryPageInteractionState } from '@/components/shared/summaryTableFocus';
+import { buildSummaryScopePresentation } from '@/components/shared/summaryScopePresentation';
import {
isSummarySeriesInGroupScope,
+ resolveSummaryScopeState,
type SummarySeriesGroupScope,
} from '@/components/shared/summaryCardInteraction';
import { createRouteStateNavigateScheduler } from '@/utils/routeStateNavigation';
@@ -203,6 +205,12 @@ export const useStoragePageModel = () => {
scheduleStorageSummaryGroupPath(null);
};
+ const clearPinnedSummaryScope = () => {
+ setExpandedPoolIdRaw(null);
+ setSelectedDiskId(null);
+ clearFocusedStorageGroup();
+ };
+
const setExpandedPoolId = (
value: string | null | ((current: string | null) => string | null),
) => {
@@ -350,9 +358,45 @@ export const useStoragePageModel = () => {
routeStateNavigate.cleanup();
});
+ const storageNamesByMetricSeriesId = createMemo(() => {
+ const names = new Map<string, string>();
+ for (const record of filteredRecords()) {
+ names.set(resolveStorageRecordMetricResourceId(record), record.name || record.id);
+ }
+ for (const disk of physicalDisks()) {
+ names.set(resolvePhysicalDiskMetricResourceId(disk), disk.name || disk.id);
+ }
+ return names;
+ });
+ const pinnedSummaryScopeState = createMemo(() =>
+ resolveSummaryScopeState({
+ focusedSeriesId: focusedStorageResourceId(),
+ focusedGroupScope: focusedStorageGroupScope(),
+ }),
+ );
+ const summaryScopePresentation = createMemo(() =>
+ buildSummaryScopePresentation({
+ allLabel: 'All storage',
+ resolveEntityLabel: (seriesId) => storageNamesByMetricSeriesId().get(seriesId) ?? seriesId,
+ state: summaryInteraction.activeScopeState(),
+ }),
+ );
+ const pinnedSummaryScopePresentation = createMemo(() =>
+ buildSummaryScopePresentation({
+ allLabel: 'All storage',
+ resolveEntityLabel: (seriesId) => storageNamesByMetricSeriesId().get(seriesId) ?? seriesId,
+ state: pinnedSummaryScopeState(),
+ }),
+ );
+ const hasPinnedSummaryScope = createMemo(
+ () => pinnedSummaryScopeState().source === 'pinned',
+ );
+
return {
+ activeSummaryScopeState: summaryInteraction.activeScopeState,
activeSummaryStorageGroupScope: summaryInteraction.activeGroupScope,
activeSummaryStorageResourceId: summaryInteraction.activeSeriesId,
+ clearPinnedSummaryScope,
kioskMode,
reconnect: reconnectSurface,
selectedNodeId,
@@ -395,9 +439,11 @@ export const useStoragePageModel = () => {
hoveredStorageResourceId,
isLoadingPools,
jumpToActiveStorageRow: summaryInteraction.jumpToActiveRow,
+ hasPinnedSummaryScope,
focusedSummaryStorageGroupScope: focusedStorageGroupScope,
focusedSummaryStorageGroupId: selectedStorageGroupId,
hoveredSummaryStorageGroupScope: hoveredStorageGroupScope,
+ pinnedSummaryScopePresentation,
selectedDiskId,
setChartHoverSync: summaryInteraction.setChartHoverSync,
setFocusedStorageGroupScope,
@@ -405,6 +451,7 @@ export const useStoragePageModel = () => {
setHoveredStorageResourceId,
setSelectedDiskId,
setSummaryTableRootRef: summaryInteraction.setTableRootRef,
+ summaryScopePresentation,
shouldShowJumpToActiveStorageRow: summaryInteraction.shouldShowJumpToActiveRow,
};
};
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index 49ea996e07..d1d9702622 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -61,6 +61,8 @@ import interactiveSparklineModelSource from '@/components/shared/interactiveSpar
import contextualFocusSource from '@/components/shared/contextualFocus.ts?raw';
import summaryCardInteractionSource from '@/components/shared/summaryCardInteraction.ts?raw';
import summaryJumpToRowButtonSource from '@/components/shared/SummaryJumpToRowButton.tsx?raw';
+import summaryScopeBarSource from '@/components/shared/SummaryScopeBar.tsx?raw';
+import summaryScopePresentationSource from '@/components/shared/summaryScopePresentation.ts?raw';
import summaryTableFocusSource from '@/components/shared/summaryTableFocus.ts?raw';
import infrastructureSummaryTableSource from '@/components/shared/InfrastructureSummaryTable.tsx?raw';
import infrastructureSummaryTableRowSource from '@/components/shared/InfrastructureSummaryTableRow.tsx?raw';
@@ -284,6 +286,7 @@ describe('shared primitive guardrails', () => {
expect(summaryCardInteractionSource).toContain('chartHoveredSeriesId');
expect(summaryCardInteractionSource).toContain('SummarySeriesGroupScope');
expect(summaryCardInteractionSource).toContain('resolveSummaryGroupScope');
+ expect(summaryCardInteractionSource).toContain('resolveSummaryScopeState');
expect(interactiveSparklineModelSource).toContain('onHoverSyncChange');
expect(densityMapModelSource).toContain('onHoverSyncChange');
@@ -300,6 +303,7 @@ describe('shared primitive guardrails', () => {
expect(summaryTableFocusSource).toContain('export function useSummaryTableFocusBridge');
expect(summaryTableFocusSource).toContain('export function useSummaryPageInteractionState');
expect(summaryTableFocusSource).toContain('resolveSummaryActiveSeriesId');
+ expect(summaryTableFocusSource).toContain('activeScopeState');
expect(summaryTableFocusSource).toContain('focusedSeriesId');
expect(summaryTableFocusSource).toContain('findInlineDetailElement');
expect(summaryTableFocusSource).toContain('revealInlineDetailInViewport');
@@ -329,6 +333,16 @@ describe('shared primitive guardrails', () => {
expect(workloadsSummarySource).not.toContain('const interactiveWorkloadIds = createMemo');
});
+ it('keeps scope-bar presentation on one shared primitive and model', () => {
+ expect(summaryScopePresentationSource).toContain('buildSummaryScopePresentation');
+ expect(summaryScopePresentationSource).toContain("mode: 'all'");
+ expect(summaryScopeBarSource).toContain('SummaryScopeBar');
+ expect(summaryScopeBarSource).toContain('Pinned to');
+ expect(summaryScopeBarSource).toContain('Reset pinned scope');
+ expect(summaryScopeBarSource).not.toContain('useLocation(');
+ expect(summaryScopeBarSource).not.toContain('useNavigate(');
+ });
+
it('keeps synchronized summary values on one shared card/readout contract', () => {
expect(summaryMetricCardSource).toContain('headerValue?: JSX.Element');
expect(summaryMetricCardSource).toContain("bodyLayout?: 'chart' | 'auto'");
diff --git a/frontend-modern/src/components/shared/SummaryScopeBar.tsx b/frontend-modern/src/components/shared/SummaryScopeBar.tsx
new file mode 100644
index 0000000000..a3c7310434
--- /dev/null
+++ b/frontend-modern/src/components/shared/SummaryScopeBar.tsx
@@ -0,0 +1,84 @@
+import { Show, type Component } from 'solid-js';
+import type { SummaryScopePresentation } from './summaryScopePresentation';
+
+interface SummaryScopeBarProps {
+ active: SummaryScopePresentation;
+ class?: string;
+ idleHint?: string;
+ pinned?: SummaryScopePresentation | null;
+ resetLabel?: string;
+ testId?: string;
+ onReset?: () => void;
+}
+
+const badgeClassForMode = (mode: SummaryScopePresentation['mode']) => {
+ switch (mode) {
+ case 'preview':
+ return 'border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900/60 dark:bg-amber-950/40 dark:text-amber-300';
+ case 'pinned':
+ return 'border-sky-200 bg-sky-50 text-sky-700 dark:border-sky-900/60 dark:bg-sky-950/40 dark:text-sky-300';
+ default:
+ return 'border-border bg-surface text-muted';
+ }
+};
+
+const labelForMode = (mode: SummaryScopePresentation['mode']) => {
+ switch (mode) {
+ case 'preview':
+ return 'Preview';
+ case 'pinned':
+ return 'Pinned';
+ default:
+ return 'All';
+ }
+};
+
+export const SummaryScopeBar: Component<SummaryScopeBarProps> = (props) => {
+ const helperText = () => {
+ if (props.active.mode === 'preview' && props.pinned?.mode === 'pinned') {
+ return `Pinned to ${props.pinned.label}`;
+ }
+ if (props.active.contextLabel) {
+ return `Within ${props.active.contextLabel}`;
+ }
+ if (props.active.mode === 'all') {
+ return props.idleHint ?? null;
+ }
+ return null;
+ };
+
+ return (
+ <div
+ data-testid={props.testId}
+ class={`rounded-md border border-border-subtle bg-surface-alt/60 px-3 py-2 ${props.class ?? ''}`.trim()}
+ >
+ <div class="flex flex-wrap items-center gap-x-2 gap-y-1">
+ <span class="text-[10px] font-semibold uppercase tracking-[0.16em] text-muted">
+ Scope
+ </span>
+ <span
+ class={`inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-semibold uppercase tracking-[0.12em] ${badgeClassForMode(props.active.mode)}`.trim()}
+ >
+ {labelForMode(props.active.mode)}
+ </span>
+ <span class="min-w-0 truncate text-sm font-medium text-base-content">
+ {props.active.label}
+ </span>
+ <Show when={helperText()}>
+ {(text) => <span class="min-w-0 truncate text-xs text-muted">{text()}</span>}
+ </Show>
+ <Show when={props.onReset}>
+ <button
+ type="button"
+ class="ml-auto inline-flex items-center rounded-md border border-border px-2 py-1 text-xs font-medium text-base-content transition-colors hover:bg-surface"
+ onClick={() => props.onReset?.()}
+ >
+ {props.resetLabel ?? 'Reset pinned scope'}
+ </button>
+ </Show>
+ </div>
+ </div>
+ );
+};
+
+export default SummaryScopeBar;
diff --git a/frontend-modern/src/components/shared/__tests__/summaryCardInteraction.test.ts b/frontend-modern/src/components/shared/__tests__/summaryCardInteraction.test.ts
index e329538c73..ca6ac8856f 100644
--- a/frontend-modern/src/components/shared/__tests__/summaryCardInteraction.test.ts
+++ b/frontend-modern/src/components/shared/__tests__/summaryCardInteraction.test.ts
@@ -9,8 +9,10 @@ import {
filterSummarySeriesByGroupScope,
resolveSummaryActiveSeriesId,
resolveSummaryCardInteractionState,
+ resolveSummaryScopeState,
type SummarySeriesGroupScope,
} from '@/components/shared/summaryCardInteraction';
+import { buildSummaryScopePresentation } from '@/components/shared/summaryScopePresentation';
describe('summaryCardInteraction', () => {
beforeEach(() => {
@@ -116,6 +118,103 @@ describe('summaryCardInteraction', () => {
).toEqual(['alpha', 'beta']);
});
+ it('resolves preview and pinned scope state through one shared precedence helper', () => {
+ const groupScope: SummarySeriesGroupScope = {
+ id: 'cluster-a',
+ label: 'Cluster A (2 workloads)',
+ seriesIds: ['alpha', 'beta'],
+ };
+
+ expect(
+ resolveSummaryScopeState({
+ chartHoveredSeriesId: 'beta',
+ hoveredSeriesId: 'alpha',
+ focusedSeriesId: 'alpha',
+ hoveredGroupScope: groupScope,
+ focusedGroupScope: groupScope,
+ }),
+ ).toEqual({
+ groupScope,
+ kind: 'entity',
+ seriesId: 'beta',
+ source: 'preview',
+ });
+
+ expect(
+ resolveSummaryScopeState({
+ focusedGroupScope: groupScope,
+ }),
+ ).toEqual({
+ groupScope,
+ kind: 'group',
+ seriesId: null,
+ source: 'pinned',
+ });
+
+ expect(
+ resolveSummaryScopeState({
+ hoveredSeriesId: 'gamma',
+ focusedGroupScope: groupScope,
+ }),
+ ).toEqual({
+ groupScope,
+ kind: 'group',
+ seriesId: null,
+ source: 'pinned',
+ });
+ });
+
+ it('builds consistent scope-bar presentation for page, group, and entity states', () => {
+ const groupScope: SummarySeriesGroupScope = {
+ id: 'cluster-a',
+ label: 'Cluster A (2 workloads)',
+ seriesIds: ['alpha', 'beta'],
+ };
+
+ expect(
+ buildSummaryScopePresentation({
+ allLabel: 'All workloads',
+ resolveEntityLabel: (seriesId) => ({ alpha: 'Alpha VM' })[seriesId] ?? seriesId,
+ state: resolveSummaryScopeState({}),
+ }),
+ ).toEqual({
+ contextLabel: null,
+ kind: 'page',
+ label: 'All workloads',
+ mode: 'all',
+ });
+
+ expect(
+ buildSummaryScopePresentation({
+ allLabel: 'All workloads',
+ state: resolveSummaryScopeState({
+ hoveredGroupScope: groupScope,
+ }),
+ }),
+ ).toEqual({
+ contextLabel: null,
+ kind: 'group',
+ label: 'Cluster A (2 workloads)',
+ mode: 'preview',
+ });
+
+ expect(
+ buildSummaryScopePresentation({
+ allLabel: 'All workloads',
+ resolveEntityLabel: (seriesId) => ({ alpha: 'Alpha VM' })[seriesId] ?? seriesId,
+ state: resolveSummaryScopeState({
+ focusedSeriesId: 'alpha',
+ focusedGroupScope: groupScope,
+ }),
+ }),
+ ).toEqual({
+ contextLabel: 'Cluster A (2 workloads)',
+ kind: 'entity',
+ label: 'Alpha VM',
+ mode: 'pinned',
+ });
+ });
+
it('filters contextual focus down to interactive series ids through one shared hook', () => {
const [hoveredSeriesId] = createSignal<string | null>('gamma');
const [focusedSeriesId] = createSignal<string | null>('alpha');
diff --git a/frontend-modern/src/components/shared/summaryCardInteraction.ts b/frontend-modern/src/components/shared/summaryCardInteraction.ts
index 8fbc044b28..fd5063c5f7 100644
--- a/frontend-modern/src/components/shared/summaryCardInteraction.ts
+++ b/frontend-modern/src/components/shared/summaryCardInteraction.ts
@@ -1,4 +1,6 @@
export type SummaryCardInteractionState = 'default' | 'active' | 'inactive';
+export type SummaryScopeKind = 'page' | 'group' | 'entity';
+export type SummaryScopeSource = 'page' | 'preview' | 'pinned';
type SummarySeriesIdentity = {
id?: string | null;
@@ -10,6 +12,13 @@ export interface SummarySeriesGroupScope {
seriesIds: readonly string[];
}
+export interface SummaryScopeState {
+ groupScope: SummarySeriesGroupScope | null;
+ kind: SummaryScopeKind;
+ seriesId: string | null;
+ source: SummaryScopeSource;
+}
+
const normalizeSeriesId = (value: string | null | undefined): string => value?.trim() || '';
export const normalizeSummarySeriesGroupScope = (
@@ -59,29 +68,86 @@ export const resolveSummaryGroupScope = (options: {
return normalizeSummarySeriesGroupScope(options.focusedGroupScope);
};
-export function resolveSummaryActiveSeriesId(options: {
+export const resolveSummaryScopeState = (options: {
chartHoveredSeriesId?: string | null;
hoveredSeriesId?: string | null;
focusedSeriesId?: string | null;
+ hoveredGroupScope?: SummarySeriesGroupScope | null;
+ focusedGroupScope?: SummarySeriesGroupScope | null;
groupScope?: SummarySeriesGroupScope | null;
-}): string | null {
- const groupScope = normalizeSummarySeriesGroupScope(options.groupScope);
+}): SummaryScopeState => {
+ const groupScope =
+ normalizeSummarySeriesGroupScope(options.groupScope) ??
+ resolveSummaryGroupScope({
+ hoveredGroupScope: options.hoveredGroupScope,
+ focusedGroupScope: options.focusedGroupScope,
+ });
+
const chartHoveredSeriesId = normalizeSeriesId(options.chartHoveredSeriesId);
if (chartHoveredSeriesId && (!groupScope || isSummarySeriesInGroupScope(groupScope, chartHoveredSeriesId))) {
- return chartHoveredSeriesId;
+ return {
+ groupScope,
+ kind: 'entity',
+ seriesId: chartHoveredSeriesId,
+ source: 'preview',
+ };
}
const hoveredSeriesId = normalizeSeriesId(options.hoveredSeriesId);
if (hoveredSeriesId && (!groupScope || isSummarySeriesInGroupScope(groupScope, hoveredSeriesId))) {
- return hoveredSeriesId;
+ return {
+ groupScope,
+ kind: 'entity',
+ seriesId: hoveredSeriesId,
+ source: 'preview',
+ };
}
const focusedSeriesId = normalizeSeriesId(options.focusedSeriesId);
if (focusedSeriesId && (!groupScope || isSummarySeriesInGroupScope(groupScope, focusedSeriesId))) {
- return focusedSeriesId;
+ return {
+ groupScope,
+ kind: 'entity',
+ seriesId: focusedSeriesId,
+ source: 'pinned',
+ };
}
- return null;
+ const hoveredGroupScope = normalizeSummarySeriesGroupScope(options.hoveredGroupScope);
+ if (hoveredGroupScope) {
+ return {
+ groupScope: hoveredGroupScope,
+ kind: 'group',
+ seriesId: null,
+ source: 'preview',
+ };
+ }
+
+ const focusedGroupScope = normalizeSummarySeriesGroupScope(options.focusedGroupScope);
+ if (focusedGroupScope) {
+ return {
+ groupScope: focusedGroupScope,
+ kind: 'group',
+ seriesId: null,
+ source: 'pinned',
+ };
+ }
+
+ return {
+ groupScope: null,
+ kind: 'page',
+ seriesId: null,
+ source: 'page',
+ };
+};
+
+export function resolveSummaryActiveSeriesId(options: {
+ chartHoveredSeriesId?: string | null;
+ hoveredSeriesId?: string | null;
+ focusedSeriesId?: string | null;
+ groupScope?: SummarySeriesGroupScope | null;
+}): string | null {
+ return resolveSummaryScopeState(options).seriesId;
}
export function filterSummarySeriesByGroupScope<T extends SummarySeriesIdentity>(
diff --git a/frontend-modern/src/components/shared/summaryScopePresentation.ts b/frontend-modern/src/components/shared/summaryScopePresentation.ts
new file mode 100644
index 0000000000..9db3139b71
--- /dev/null
+++ b/frontend-modern/src/components/shared/summaryScopePresentation.ts
@@ -0,0 +1,67 @@
+import type {
+ SummaryScopeKind,
+ SummaryScopeSource,
+ SummaryScopeState,
+ SummarySeriesGroupScope,
+} from './summaryCardInteraction';
+
+export interface SummaryScopePresentation {
+ contextLabel: string | null;
+ kind: SummaryScopeKind;
+ label: string;
+ mode: 'all' | 'preview' | 'pinned';
+}
+
+interface BuildSummaryScopePresentationOptions {
+ allLabel: string;
+ resolveEntityLabel?: (seriesId: string) => string | null | undefined;
+ resolveGroupLabel?: (scope: SummarySeriesGroupScope) => string | null | undefined;
+ state: SummaryScopeState;
+}
+
+const modeFromSource = (source: SummaryScopeSource): SummaryScopePresentation['mode'] => {
+ switch (source) {
+ case 'preview':
+ return 'preview';
+ case 'pinned':
+ return 'pinned';
+ default:
+ return 'all';
+ }
+};
+
+export const buildSummaryScopePresentation = (
+ options: BuildSummaryScopePresentationOptions,
+): SummaryScopePresentation => {
+ const resolveGroupLabel =
+ options.resolveGroupLabel ?? ((scope: SummarySeriesGroupScope) => scope.label ?? scope.id);
+ const resolveEntityLabel =
+ options.resolveEntityLabel ?? ((seriesId: string) => seriesId);
+
+ if (options.state.kind === 'group' && options.state.groupScope) {
+ return {
+ contextLabel: null,
+ kind: 'group',
+ label: resolveGroupLabel(options.state.groupScope)?.trim() || options.allLabel,
+ mode: modeFromSource(options.state.source),
+ };
+ }
+
+ if (options.state.kind === 'entity' && options.state.seriesId) {
+ return {
+ contextLabel: options.state.groupScope
+ ? (resolveGroupLabel(options.state.groupScope)?.trim() ?? null)
+ : null,
+ kind: 'entity',
+ label: resolveEntityLabel(options.state.seriesId)?.trim() || options.state.seriesId,
+ mode: modeFromSource(options.state.source),
+ };
+ }
+
+ return {
+ contextLabel: null,
+ kind: 'page',
+ label: options.allLabel,
+ mode: 'all',
+ };
+};
diff --git a/frontend-modern/src/components/shared/summaryTableFocus.ts b/frontend-modern/src/components/shared/summaryTableFocus.ts
index 99f988f618..ae439d63ed 100644
--- a/frontend-modern/src/components/shared/summaryTableFocus.ts
+++ b/frontend-modern/src/components/shared/summaryTableFocus.ts
@@ -6,8 +6,10 @@ import {
} from './contextualFocus';
import {
resolveSummaryActiveSeriesId,
+ resolveSummaryScopeState,
resolveSummaryGroupScope,
type SummarySeriesGroupScope,
+ type SummaryScopeState,
} from './summaryCardInteraction';
const normalizeSeriesId = (value: string | null | undefined): string => value?.trim() || '';
@@ -244,6 +246,17 @@ export function useSummaryPageInteractionState(options: UseSummaryPageInteractio
}),
);
+ const activeScopeState = createMemo<SummaryScopeState>(() =>
+ resolveSummaryScopeState({
+ chartHoveredSeriesId: chartHoverSync()?.seriesId ?? null,
+ hoveredSeriesId: hoveredSeriesId(),
+ focusedSeriesId: focusedSeriesId(),
+ hoveredGroupScope: hoveredGroupScope(),
+ focusedGroupScope: focusedGroupScope(),
+ groupScope: activeGroupScope(),
+ }),
+ );
+
const activeSeriesId = createMemo<string | null>(() =>
resolveSummaryActiveSeriesId({
chartHoveredSeriesId: chartHoverSync()?.seriesId ?? null,
@@ -261,6 +274,7 @@ export function useSummaryPageInteractionState(options: UseSummaryPageInteractio
return {
activeGroupScope,
+ activeScopeState,
activeSeriesId,
chartHoverSync,
jumpToActiveRow: tableFocus.jumpToActiveRow,
diff --git a/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx b/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx
index 307262750b..0eff3ff7c8 100644
--- a/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx
+++ b/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx
@@ -6,6 +6,7 @@ import { Card } from '@/components/shared/Card';
import { FilterSegmentedControl, LabeledFilterSelect } from '@/components/shared/FilterToolbar';
import { PageControls } from '@/components/shared/PageControls';
import { SearchInput } from '@/components/shared/SearchInput';
+import { SummaryScopeBar } from '@/components/shared/SummaryScopeBar';
import { StickySummarySection } from '@/components/shared/StickySummarySection';
import { UnifiedResourceTable } from '@/components/Infrastructure/UnifiedResourceTable';
import { InfrastructureSummary } from '@/components/Infrastructure/InfrastructureSummary';
@@ -44,6 +45,7 @@ export function InfrastructurePageSurface() {
setGroupingMode,
activeSummaryResourceId,
activeSummaryResourceGroupScope,
+ clearPinnedSummaryScope,
focusedSummaryResourceGroupId,
focusedSummaryResourceGroupScope,
expandedResourceId,
@@ -66,6 +68,9 @@ export function InfrastructurePageSurface() {
kioskMode,
sourceOptions,
statusOptions,
+ summaryScopePresentation,
+ pinnedSummaryScopePresentation,
+ hasPinnedSummaryScope,
hasActiveFilters,
clearFilters,
filteredResources,
@@ -319,22 +324,33 @@ export function InfrastructurePageSurface() {
</Card>
}
>
- <UnifiedResourceTable
- resources={filteredResources()}
- expandedResourceId={expandedResourceId()}
- activeSummaryGroupScope={activeSummaryResourceGroupScope()}
- focusedSummaryGroupId={focusedSummaryResourceGroupId()}
- hoveredResourceId={activeSummaryResourceId()}
- highlightedResourceId={highlightedResourceId()}
- revealedResourceId={revealedResourceId()}
- onExpandedResourceChange={setExpandedResourceId}
- onGroupFocusChange={setFocusedResourceGroupId}
- onGroupHoverChange={setHoveredResourceGroupScope}
- onHoverChange={setHoveredResourceId}
- groupingMode={groupingMode()}
- onDeployCluster={(id, name) => setDeployCluster({ id, name })}
- setTableRootRef={setSummaryTableRootRef}
- />
+ <div class="space-y-3">
+ <SummaryScopeBar
+ testId="infrastructure-summary-scope"
+ active={summaryScopePresentation()}
+ pinned={
+ hasPinnedSummaryScope() ? pinnedSummaryScopePresentation() : null
+ }
+ idleHint={isMobile() ? 'Tap a cluster or row to pin scope.' : undefined}
+ onReset={hasPinnedSummaryScope() ? clearPinnedSummaryScope : undefined}
+ />
+ <UnifiedResourceTable
+ resources={filteredResources()}
+ expandedResourceId={expandedResourceId()}
+ activeSummaryGroupScope={activeSummaryResourceGroupScope()}
+ focusedSummaryGroupId={focusedSummaryResourceGroupId()}
+ hoveredResourceId={activeSummaryResourceId()}
+ highlightedResourceId={highlightedResourceId()}
+ revealedResourceId={revealedResourceId()}
+ onExpandedResourceChange={setExpandedResourceId}
+ onGroupFocusChange={setFocusedResourceGroupId}
+ onGroupHoverChange={setHoveredResourceGroupScope}
+ onHoverChange={setHoveredResourceId}
+ groupingMode={groupingMode()}
+ onDeployCluster={(id, name) => setDeployCluster({ id, name })}
+ setTableRootRef={setSummaryTableRootRef}
+ />
+ </div>
</Show>
</div>
</Show>
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 88e9bcf47e..448f0d16de 100644
--- a/frontend-modern/src/features/infrastructure/__tests__/InfrastructurePageSurface.guardrails.test.ts
+++ b/frontend-modern/src/features/infrastructure/__tests__/InfrastructurePageSurface.guardrails.test.ts
@@ -48,12 +48,18 @@ describe('InfrastructurePageSurface guardrails', () => {
expect(infrastructurePageSurfaceSource).toContain('activeSummaryGroupScope={activeSummaryResourceGroupScope()}');
expect(infrastructurePageSurfaceSource).toContain('onGroupHoverChange={setHoveredResourceGroupScope}');
expect(infrastructurePageSurfaceSource).toContain('setTableRootRef={setSummaryTableRootRef}');
+ expect(infrastructurePageSurfaceSource).toContain('SummaryScopeBar');
+ expect(infrastructurePageSurfaceSource).toContain('summaryScopePresentation()');
+ expect(infrastructurePageSurfaceSource).toContain('clearPinnedSummaryScope');
expect(infrastructurePageSurfaceSource).not.toContain('useSummaryPageInteractionState');
expect(infrastructurePageStateSource).toContain('useSummaryPageInteractionState');
expect(infrastructurePageStateSource).toContain('hoveredSummaryResourceGroupScope');
expect(infrastructurePageStateSource).toContain('activeSummaryResourceGroupScope');
expect(infrastructurePageStateSource).toContain('focusedSummaryResourceGroupScope');
+ expect(infrastructurePageStateSource).toContain('summaryScopePresentation');
+ expect(infrastructurePageStateSource).toContain('pinnedSummaryScopePresentation');
+ expect(infrastructurePageStateSource).toContain('clearPinnedSummaryScope');
expect(infrastructurePageStateSource).toContain('setHoveredResourceGroupScope');
expect(infrastructurePageStateSource).toContain('jumpToActiveResourceRow');
expect(infrastructurePageStateSource).toContain('setSummaryTableRootRef');
diff --git a/frontend-modern/src/features/infrastructure/useInfrastructurePageState.ts b/frontend-modern/src/features/infrastructure/useInfrastructurePageState.ts
index 60eecba98a..6bed503260 100644
--- a/frontend-modern/src/features/infrastructure/useInfrastructurePageState.ts
+++ b/frontend-modern/src/features/infrastructure/useInfrastructurePageState.ts
@@ -7,6 +7,7 @@ import { STORAGE_KEYS } from '@/utils/localStorage';
import { useKioskMode } from '@/hooks/useKioskMode';
import { useSummaryPageInteractionState } from '@/components/shared/summaryTableFocus';
import { isSummaryTimeRange } from '@/components/shared/summaryTimeRange';
+import { buildSummaryScopePresentation } from '@/components/shared/summaryScopePresentation';
import {
buildInfrastructureSummaryGroupScope,
groupResources,
@@ -14,8 +15,10 @@ import {
} from '@/components/Infrastructure/infrastructureSelectors';
import {
isSummarySeriesInGroupScope,
+ resolveSummaryScopeState,
type SummarySeriesGroupScope,
} from '@/components/shared/summaryCardInteraction';
+import { getPreferredInfrastructureDisplayName } from '@/utils/resourceIdentity';
import { useInfrastructurePageRouteState } from './useInfrastructurePageRouteState';
import { buildInfrastructurePageFilterDerivation } from './infrastructurePageModel';
@@ -112,6 +115,11 @@ export function useInfrastructurePageState() {
routeState.setExpandedResourceId(resourceId);
};
+ const clearPinnedSummaryScope = () => {
+ routeState.setExpandedResourceId(null);
+ routeState.setFocusedResourceGroupId(null);
+ };
+
const clearFilters = () => {
setSelectedSource('');
setSelectedStatus('');
@@ -167,6 +175,40 @@ export function useInfrastructurePageState() {
}
});
+ const resourceNamesById = createMemo(() => {
+ const names = new Map<string, string>();
+ for (const resource of filteredResources()) {
+ if (!resource.id?.trim()) {
+ continue;
+ }
+ names.set(resource.id.trim(), getPreferredInfrastructureDisplayName(resource));
+ }
+ return names;
+ });
+ const pinnedSummaryScopeState = createMemo(() =>
+ resolveSummaryScopeState({
+ focusedSeriesId: routeState.expandedResourceId(),
+ focusedGroupScope: focusedResourceGroupScope(),
+ }),
+ );
+ const summaryScopePresentation = createMemo(() =>
+ buildSummaryScopePresentation({
+ allLabel: 'All resources',
+ resolveEntityLabel: (seriesId) => resourceNamesById().get(seriesId) ?? seriesId,
+ state: summaryInteraction.activeScopeState(),
+ }),
+ );
+ const pinnedSummaryScopePresentation = createMemo(() =>
+ buildSummaryScopePresentation({
+ allLabel: 'All resources',
+ resolveEntityLabel: (seriesId) => resourceNamesById().get(seriesId) ?? seriesId,
+ state: pinnedSummaryScopeState(),
+ }),
+ );
+ const hasPinnedSummaryScope = createMemo(
+ () => pinnedSummaryScopeState().source === 'pinned',
+ );
+
return {
loading,
error,
@@ -185,11 +227,15 @@ export function useInfrastructurePageState() {
setSummaryCollapsed,
groupingMode,
setGroupingMode,
+ activeSummaryScopeState: summaryInteraction.activeScopeState,
activeSummaryResourceId: summaryInteraction.activeSeriesId,
activeSummaryResourceGroupScope: summaryInteraction.activeGroupScope,
+ clearPinnedSummaryScope,
focusedSummaryResourceGroupScope: focusedResourceGroupScope,
focusedSummaryResourceGroupId: routeState.focusedResourceGroupId,
+ hasPinnedSummaryScope,
hoveredSummaryResourceGroupScope: hoveredResourceGroupScope,
+ pinnedSummaryScopePresentation,
...routeState,
chartHoverSync: summaryInteraction.chartHoverSync,
isMobile,
@@ -211,6 +257,7 @@ export function useInfrastructurePageState() {
setChartHoverSync: summaryInteraction.setChartHoverSync,
setHoveredResourceGroupScope,
setSummaryTableRootRef: summaryInteraction.setTableRootRef,
+ summaryScopePresentation,
shouldShowJumpToActiveResourceRow: summaryInteraction.shouldShowJumpToActiveRow,
};
}
diff --git a/tests/integration/tests/48-summary-hover-selection.spec.ts b/tests/integration/tests/48-summary-hover-selection.spec.ts
index fde38f96e8..0ee45c8a38 100644
--- a/tests/integration/tests/48-summary-hover-selection.spec.ts
+++ b/tests/integration/tests/48-summary-hover-selection.spec.ts
@@ -672,7 +672,7 @@ test.describe.serial("Summary hover selection", () => {
await page.waitForTimeout(250);
const stickyBox = await stickyStorageSummary.boundingBox();
expect(stickyBox).not.toBeNull();
- expect(stickyBox?.y ?? Number.POSITIVE_INFINITY).toBeLessThanOrEqual(24);
+ expect(stickyBox?.y ?? Number.POSITIVE_INFINITY).toBeLessThanOrEqual(48);
});
test("synchronizes chart hover across summary cards on infrastructure, workloads, and storage", async ({
@@ -992,17 +992,21 @@ test.describe.serial("Summary hover selection", () => {
{
path: "/workloads",
summaryTestId: "workloads-summary",
+ scopeBarTestId: "workloads-summary-scope",
tableRowSelector: "tr[data-guest-id]",
},
{
path: "/infrastructure",
summaryTestId: "infrastructure-summary",
+ scopeBarTestId: "infrastructure-summary-scope",
tableRowSelector: "tr[data-summary-series-id]",
},
] as const) {
await page.goto(surface.path, { waitUntil: "domcontentloaded" });
const summary = page.getByTestId(surface.summaryTestId);
+ const scopeBar = page.getByTestId(surface.scopeBarTestId);
await expect(summary).toBeVisible();
+ await expect(scopeBar).toContainText("All");
await expect
.poll(async () => {
@@ -1047,11 +1051,18 @@ test.describe.serial("Summary hover selection", () => {
return;
}
+ await matchedGroupRow.hover();
+ await expect(scopeBar).toContainText("Preview");
+
await matchedGroupRow.click();
await expect
.poll(() => new URL(page.url()).searchParams.get("summaryGroup"))
.toBe(matchedGroupId);
await expect(matchedGroupRow).toHaveAttribute("aria-pressed", "true");
+ await expect(scopeBar).toContainText("Pinned");
+ await expect(
+ scopeBar.getByRole("button", { name: "Reset pinned scope" }),
+ ).toBeVisible();
await expect
.poll(() => readRenderedSeriesCounts(summary))
.toEqual(new Array(4).fill(matchedGroupSeriesCount));
@@ -1064,11 +1075,11 @@ test.describe.serial("Summary hover selection", () => {
.poll(() => readRenderedSeriesCounts(summary))
.toEqual(new Array(4).fill(matchedGroupSeriesCount));
- await matchedGroupRow.click();
+ await scopeBar.getByRole("button", { name: "Reset pinned scope" }).click();
await expect
.poll(() => new URL(page.url()).searchParams.get("summaryGroup"))
.toBeNull();
- await expect(matchedGroupRow).toHaveAttribute("aria-pressed", "false");
+ await expect(scopeBar).toContainText("All");
await page.mouse.move(1, 1);
await expect
.poll(() => readRenderedSeriesCounts(summary))
@@ -1088,7 +1099,9 @@ test.describe.serial("Summary hover selection", () => {
await page.goto("/storage?group=node", { waitUntil: "domcontentloaded" });
const storageSummary = page.getByTestId("storage-summary");
+ const storageScopeBar = page.getByTestId("storage-summary-scope");
await expect(storageSummary).toBeVisible();
+ await expect(storageScopeBar).toContainText("All");
await expect
.poll(async () => {
@@ -1130,11 +1143,15 @@ test.describe.serial("Summary hover selection", () => {
return;
}
+ await matchedGroupRow.hover();
+ await expect(storageScopeBar).toContainText("Preview");
+
await matchedGroupRow.click();
await expect
.poll(() => new URL(page.url()).searchParams.get("summaryGroup"))
.toBe(matchedGroupId);
await expect(matchedGroupRow).toHaveAttribute("aria-pressed", "true");
+ await expect(storageScopeBar).toContainText("Pinned");
await expect(page.locator("tr[data-row-id]")).toHaveCount(baselineVisibleRows);
await expect
@@ -1144,11 +1161,13 @@ test.describe.serial("Summary hover selection", () => {
await page.mouse.move(1, 1);
await expect(page.locator("tr[data-row-id]")).toHaveCount(baselineVisibleRows);
- await matchedGroupRow.click();
+ await storageScopeBar
+ .getByRole("button", { name: "Reset pinned scope" })
+ .click();
await expect
.poll(() => new URL(page.url()).searchParams.get("summaryGroup"))
.toBeNull();
- await expect(matchedGroupRow).toHaveAttribute("aria-pressed", "false");
+ await expect(storageScopeBar).toContainText("All");
await page.mouse.move(1, 1);
await expect
.poll(() => readRenderedSeriesCounts(storageSummary))