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): add local summary scope reset actions

rcourtman7ab048e6691b
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 05b5236b14..d5488e4a56 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -132,6 +132,7 @@ work extends shared components instead of creating new local variants.
110. `frontend-modern/src/components/shared/summaryInteractionA11y.ts`
111. `frontend-modern/src/components/shared/SummaryRowActionButton.tsx`
112. `frontend-modern/src/hooks/createNonSuspendingQuery.ts`
+113. `frontend-modern/src/components/shared/SummaryTableCardHeader.tsx`
## Shared Boundaries
@@ -167,6 +168,12 @@ work extends shared components instead of creating new local variants.
off-screen fallback strips. Workloads, infrastructure,
and storage must not rebuild row-as-button keyboard handling or trailing
one-off expand columns once the shared action primitive exists.
+ When pinned page, group, or entity scope needs a local explicit reset,
+ the only shared table-chrome owner is
+ `frontend-modern/src/components/shared/SummaryTableCardHeader.tsx`: the
+ reset action stays as one compact header-level `Clear` control with an
+ accessible `Clear selection` label, not a second page-level scope strip,
+ search-row accessory, or filter-bar badge.
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. Group-scoped preview and pin must use that same shared presentation boundary: child rows that belong to a hovered or pinned summary group should expose `data-summary-group-member-active="preview|pinned"` so the block-level emphasis stays subtle, consistent, and reversible instead of each table inventing its own outline, badge, or full-strength fill treatment.
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 cfddd2b9d6..d63e0ef467 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 hot path stays row-first rather than adding fallback chrome: the on-screen row or group header is the scoped state, and clearing belongs to governed neutral interaction surfaces instead of bolting one-off clear buttons or search-row widgets into each page shell. The same hot path must therefore separate row-lookup roots from broader clear-surface roots when page whitespace should clear pinned scope, and it must route `Escape` through the same shared clear owner so page filters and pinned summary selections reset together instead of stacking competing page-local listeners. 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. That hot path stays row-first rather than adding fallback chrome: the on-screen row or group header is the scoped state, and any explicit reset belongs to one compact shared table-header action plus the shared `Escape` path, not to page-level scope strips, search-row widgets, or filter-bar badges. Background whitespace clearing may exist as a convenience, but the hot path must not depend on brittle dead-space hit testing as the only reversible control. The same hot path must therefore keep one page-level reset owner for filters plus pinned summary selections, and it 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.
The input path for that hot summary contract must stay shared too:
`frontend-modern/src/components/shared/summaryInteractionA11y.ts` owns
fine-pointer preview and focus-preview continuity, while
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index 17357efda0..ff48f5a1c9 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -202,11 +202,11 @@ querying, and the operator-facing storage health presentation layer.
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 stay row-first: the pinned row or group remains the
- visible scoped state, and clearing belongs to governed neutral
- interaction-surface whitespace plus the shared `Escape` reset path rather
- than an extra storage-local strip or search-row widget, with storage
- owning a broader clear-surface root separately from the content-card
- row-lookup root.
+ visible scoped state, and explicit clearing belongs to the shared storage
+ content-card header action plus the shared `Escape` reset path rather than
+ an extra storage-local strip, search-row widget, or filter-bar badge.
+ Background whitespace clearing may remain a convenience, but storage must
+ not rely on it as the only reversible control.
When that scope is a storage
pool group, member pool rows should expose shared
`data-summary-group-member-active="preview|pinned"` state so the grouped
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index d17327bf6d..7141d4829e 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -216,12 +216,12 @@ assembly branch.
query state, so pinned scope is shareable, reversible, and owned by the
same route-backed summary contract as row focus. Infrastructure must stay
row-first here: the pinned cluster header remains the visible scoped
- state, and clearing belongs to governed neutral interaction-surface
- whitespace plus the shared `Escape` reset path rather than a search-row
- fallback widget or a second scope/pinned pill inside the cluster row
- chrome, with infrastructure owning a broader clear-surface root
- separately from the table row-lookup
- root.
+ state, and explicit clearing belongs to the shared infrastructure table
+ card header action plus the shared `Escape` reset path rather than a
+ search-row fallback widget, page-level scope strip, or a second
+ scope/pinned pill inside the cluster row chrome. Background whitespace
+ clearing may remain a convenience, but infrastructure must not rely on it
+ as the only reversible control.
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 d6603071c6..e75b7608d7 100644
--- a/frontend-modern/src/components/Dashboard/Dashboard.tsx
+++ b/frontend-modern/src/components/Dashboard/Dashboard.tsx
@@ -112,6 +112,7 @@ export function Dashboard(props: DashboardProps) {
activeAlerts={state.activeAlerts}
alertsEnabled={state.alertsEnabled}
bottomSpacerHeight={state.bottomSpacerHeight}
+ clearPinnedSummaryScope={state.clearPinnedSummaryScope}
getGroupLabel={state.getGroupLabel}
groupedGuests={state.groupedGuests}
groupedWindowing={state.groupedWindowing}
diff --git a/frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx b/frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx
index 4f25b82a00..2a39d2627f 100644
--- a/frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx
+++ b/frontend-modern/src/components/Dashboard/DashboardWorkloadTable.tsx
@@ -1,5 +1,6 @@
import { ComponentErrorBoundary } from '@/components/ErrorBoundary';
import { Card } from '@/components/shared/Card';
+import { SummaryTableCardHeader } from '@/components/shared/SummaryTableCardHeader';
import { Table } from '@/components/shared/Table';
import type { DashboardState } from './useDashboardState';
@@ -22,6 +23,7 @@ type DashboardWorkloadTableProps = Pick<
| 'handleTagClick'
| 'activeSummaryWorkloadGroupScope'
| 'activeSummaryWorkloadId'
+ | 'clearPinnedSummaryScope'
| 'focusedSummaryWorkloadGroupScope'
| 'focusedSummaryWorkloadGroupId'
| 'hoveredSummaryWorkloadGroupScope'
@@ -49,6 +51,9 @@ type DashboardWorkloadTableProps = Pick<
>;
export function DashboardWorkloadTable(props: DashboardWorkloadTableProps) {
+ const showClearSelection = () =>
+ Boolean(props.selectedGuestId() || props.focusedSummaryWorkloadGroupId());
+
return (
<ComponentErrorBoundary name="Guest Table">
<Card
@@ -59,9 +64,11 @@ export function DashboardWorkloadTable(props: DashboardWorkloadTableProps) {
data-summary-clear-surface
data-testid="workloads-table-surface"
>
- <div class="border-b border-border bg-surface-hover px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-muted">
- Workloads
- </div>
+ <SummaryTableCardHeader
+ title="Workloads"
+ showClearAction={showClearSelection()}
+ onClear={props.clearPinnedSummaryScope}
+ />
<Table
wrapperRef={props.setTableWrapperRef}
class="whitespace-nowrap min-w-[max-content]"
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 712f0e6ea1..3db59b4515 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
@@ -727,8 +727,12 @@ describe('Dashboard performance contract', () => {
expect(dashboardSource).toContain('setTableRootRef={state.setTableRootRef}');
expect(dashboardSource).toContain('data-testid="workloads-interaction-surface"');
expect(dashboardSource).toContain('data-summary-clear-ignore');
+ expect(dashboardSource).toContain('clearPinnedSummaryScope={state.clearPinnedSummaryScope}');
expect(dashboardWorkloadTableSource).toContain('data-summary-clear-surface');
expect(dashboardWorkloadTableSource).toContain('data-testid="workloads-table-surface"');
+ expect(dashboardWorkloadTableSource).toContain('SummaryTableCardHeader');
+ expect(dashboardWorkloadTableSource).toContain('showClearSelection');
+ expect(dashboardWorkloadTableSource).toContain('clearPinnedSummaryScope');
expect(dashboardFilterSource).not.toContain('const [filtersOpen, setFiltersOpen] =');
expect(dashboardFilterSource).not.toContain('useBreakpoint');
expect(dashboardFilterSource).not.toContain("props.setSortKey('name')");
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
index f33aeb2294..7161ad5cc8 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceHostTableCard.tsx
@@ -4,6 +4,7 @@ import type { Disk } from '@/types/api';
import { formatBytes, formatSpeed, formatUptime, normalizeDiskArray } from '@/utils/format';
import { formatTemperature } from '@/utils/temperature';
import { Card } from '@/components/shared/Card';
+import { SummaryTableCardHeader } from '@/components/shared/SummaryTableCardHeader';
import {
Table,
TableBody,
@@ -59,10 +60,12 @@ export const UnifiedResourceHostTableCard: Component<UnifiedResourceHostTableCar
return (
<Show when={table.showHostTable()}>
<Card padding="none" tone="card" class="mb-0 overflow-hidden">
- <div class="border-b border-border bg-surface-hover px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-muted">
- Agent Infrastructure
- </div>
- <div class="overflow-x-auto">
+ <SummaryTableCardHeader
+ title="Agent Infrastructure"
+ showClearAction={table.showHostClearAction()}
+ onClear={tableProps.clearPinnedSummaryScope}
+ />
+ <div class="overflow-x-auto">
<Table
class="whitespace-nowrap min-w-[max-content]"
style={{
diff --git a/frontend-modern/src/components/Infrastructure/UnifiedResourceServiceInfrastructureCard.tsx b/frontend-modern/src/components/Infrastructure/UnifiedResourceServiceInfrastructureCard.tsx
index a2504d4458..70e861bf51 100644
--- a/frontend-modern/src/components/Infrastructure/UnifiedResourceServiceInfrastructureCard.tsx
+++ b/frontend-modern/src/components/Infrastructure/UnifiedResourceServiceInfrastructureCard.tsx
@@ -1,6 +1,7 @@
import { Show } from 'solid-js';
import type { Component } from 'solid-js';
import { Card } from '@/components/shared/Card';
+import { SummaryTableCardHeader } from '@/components/shared/SummaryTableCardHeader';
import {
type UnifiedResourceTableProps,
type UnifiedResourceTableState,
@@ -21,9 +22,11 @@ export const UnifiedResourceServiceInfrastructureCard: Component<
return (
<Show when={table.sortedPBSResources().length > 0 || table.sortedPMGResources().length > 0}>
<Card padding="none" tone="card" class="mb-0 overflow-hidden">
- <div class="border-b border-border bg-surface-hover px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-muted">
- Service Infrastructure
- </div>
+ <SummaryTableCardHeader
+ title="Service Infrastructure"
+ showClearAction={table.showServiceClearAction()}
+ onClear={tableProps.clearPinnedSummaryScope}
+ />
<UnifiedResourcePBSTableSection tableProps={tableProps} table={table} />
<UnifiedResourcePMGTableSection tableProps={tableProps} table={table} />
</Card>
diff --git a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
index 90914a2ca2..3d89f534f7 100644
--- a/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
+++ b/frontend-modern/src/components/Infrastructure/__tests__/UnifiedResourceTable.performance.contract.test.tsx
@@ -16,6 +16,7 @@ import infrastructureSummarySource from '@/components/Infrastructure/Infrastruct
import infrastructureSummaryStateSource from '@/components/Infrastructure/useInfrastructureSummaryState.ts?raw';
import infrastructureSummaryModelSource from '@/components/Infrastructure/infrastructureSummaryModel.ts?raw';
import unifiedResourceHostTableCardSource from '@/components/Infrastructure/UnifiedResourceHostTableCard.tsx?raw';
+import unifiedResourceServiceInfrastructureCardSource from '@/components/Infrastructure/UnifiedResourceServiceInfrastructureCard.tsx?raw';
import unifiedResourcePBSTableSectionSource from '@/components/Infrastructure/UnifiedResourcePBSTableSection.tsx?raw';
import unifiedResourcePMGTableSectionSource from '@/components/Infrastructure/UnifiedResourcePMGTableSection.tsx?raw';
import summaryRowActionButtonSource from '@/components/shared/SummaryRowActionButton.tsx?raw';
@@ -200,6 +201,7 @@ describe('UnifiedResourceTable performance contract', () => {
expect(unifiedResourceTableSource).toContain('useUnifiedResourceTableState');
expect(unifiedResourceTableSource).toContain('UnifiedResourceHostTableCard');
expect(unifiedResourceTableSource).toContain('UnifiedResourceServiceInfrastructureCard');
+ expect(unifiedResourceTableSource).toContain('data-summary-clear-surface');
expect(unifiedResourceTableSource).not.toContain('const sortedPBSResources = createMemo(() =>');
expect(unifiedResourceTableSource).not.toContain('const getOutlierEmphasis =');
expect(unifiedResourceTableSource).not.toContain('const getPBSTableRow =');
@@ -208,6 +210,9 @@ describe('UnifiedResourceTable performance contract', () => {
expect(unifiedResourceTableStateSource).toContain('getUnifiedResourceTableColumnStyles');
expect(unifiedResourceTableStateSource).toContain('useTableWindowing');
expect(unifiedResourceTableStateSource).toContain('useUnifiedResourceTableViewportSync');
+ expect(unifiedResourceTableStateSource).toContain('clearPinnedSummaryScope?: () => void;');
+ expect(unifiedResourceTableStateSource).toContain('showHostClearAction');
+ expect(unifiedResourceTableStateSource).toContain('showServiceClearAction');
expect(unifiedResourceTableStateSource).not.toContain('const resourceColumnStyle = createMemo(() =>');
expect(unifiedResourceTableStateSource).not.toContain("const showGroupHeaders = props.groupingMode === 'grouped'");
expect(unifiedResourceTableStateSource).not.toContain('const items: HostTableItem[] = [];');
@@ -294,6 +299,13 @@ describe('UnifiedResourceTable performance contract', () => {
}
expect(unifiedResourceHostTableCardSource).not.toContain('kind="scope"');
+ expect(unifiedResourceHostTableCardSource).toContain('SummaryTableCardHeader');
+ expect(unifiedResourceHostTableCardSource).toContain('onClear={tableProps.clearPinnedSummaryScope}');
+ expect(unifiedResourceServiceInfrastructureCardSource).toContain('SummaryTableCardHeader');
+ expect(unifiedResourceServiceInfrastructureCardSource).toContain('showClearAction');
+ expect(unifiedResourceServiceInfrastructureCardSource).toContain(
+ 'onClear={tableProps.clearPinnedSummaryScope}',
+ );
});
it('keeps source filtering on the shared canonical source-platform helper', () => {
diff --git a/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts b/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts
index 1dee0cbb49..959e092a76 100644
--- a/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts
+++ b/frontend-modern/src/components/Infrastructure/useUnifiedResourceTableState.ts
@@ -33,6 +33,7 @@ import {
export interface UnifiedResourceTableProps {
resources: Resource[];
expandedResourceId: string | null;
+ clearPinnedSummaryScope?: () => void;
highlightedResourceId?: string | null;
revealedResourceId?: string | null;
hoveredResourceId?: string | null;
@@ -57,6 +58,8 @@ export function useUnifiedResourceTableState(props: UnifiedResourceTableProps) {
const split = createMemo(() => splitPrimaryAndServiceResources(props.resources));
const primaryResources = createMemo(() => split().primaryResources);
const serviceResources = createMemo(() => split().services);
+ const primaryResourceIds = createMemo(() => new Set(primaryResources().map((resource) => resource.id)));
+ const serviceResourceIds = createMemo(() => new Set(serviceResources().map((resource) => resource.id)));
const sortedResources = createMemo(() =>
sortResources(primaryResources(), sortKey(), sortDirection()),
@@ -130,6 +133,15 @@ export function useUnifiedResourceTableState(props: UnifiedResourceTableProps) {
const showHostTable = createMemo(() =>
shouldShowUnifiedResourceHostTable(primaryResources().length, serviceResources().length),
);
+ const showHostClearAction = createMemo(() =>
+ Boolean(
+ props.focusedSummaryGroupId ||
+ (props.expandedResourceId && primaryResourceIds().has(props.expandedResourceId)),
+ ),
+ );
+ const showServiceClearAction = createMemo(() =>
+ Boolean(props.expandedResourceId && serviceResourceIds().has(props.expandedResourceId)),
+ );
return {
isMobile,
@@ -152,6 +164,8 @@ export function useUnifiedResourceTableState(props: UnifiedResourceTableProps) {
uptimeColumnStyle: () => columnStyles().uptimeColumnStyle,
tempColumnStyle: () => columnStyles().tempColumnStyle,
showHostTable,
+ showHostClearAction,
+ showServiceClearAction,
serviceCountColumnStyle: () => columnStyles().serviceCountColumnStyle,
serviceQueueColumnStyle: () => columnStyles().serviceQueueColumnStyle,
serviceHealthColumnStyle: () => columnStyles().serviceHealthColumnStyle,
diff --git a/frontend-modern/src/components/Storage/Storage.tsx b/frontend-modern/src/components/Storage/Storage.tsx
index 04c6131095..7cbf2df21a 100644
--- a/frontend-modern/src/components/Storage/Storage.tsx
+++ b/frontend-modern/src/components/Storage/Storage.tsx
@@ -33,6 +33,7 @@ const Storage: Component = () => {
nodeFilterOptions,
activeBannerKind,
cephSummaryStats,
+ clearPinnedSummaryScope,
filteredRecords,
activeSummaryStorageGroupScope,
activeSummaryStorageResourceId,
@@ -141,6 +142,7 @@ const Storage: Component = () => {
getRecordAlertState={getRecordAlertState}
isLoadingPools={isLoadingPools}
activeSummaryGroupScope={activeSummaryStorageGroupScope}
+ clearPinnedSummaryScope={clearPinnedSummaryScope}
hoveredSummaryGroupScope={hoveredSummaryStorageGroupScope}
focusedSummaryGroupScope={focusedSummaryStorageGroupScope}
focusedSummaryGroupId={focusedSummaryStorageGroupId}
diff --git a/frontend-modern/src/components/Storage/StorageContentCard.tsx b/frontend-modern/src/components/Storage/StorageContentCard.tsx
index f2d97aabb5..b3f6a43c59 100644
--- a/frontend-modern/src/components/Storage/StorageContentCard.tsx
+++ b/frontend-modern/src/components/Storage/StorageContentCard.tsx
@@ -1,10 +1,10 @@
import { Component, Show } from 'solid-js';
import { Card } from '@/components/shared/Card';
+import { SummaryTableCardHeader } from '@/components/shared/SummaryTableCardHeader';
import { DiskList } from '@/components/Storage/DiskList';
import StoragePoolsTable from '@/components/Storage/StoragePoolsTable';
import {
STORAGE_CONTENT_CARD_BODY_CLASS,
- STORAGE_CONTENT_CARD_HEADER_CLASS,
} from '@/features/storageBackups/storagePagePresentation';
import type { Resource } from '@/types/resource';
import type { StorageGroupKey, StorageGroupedRecords } from './useStorageModel';
@@ -30,6 +30,7 @@ type StorageContentCardProps = {
getRecordAlertState: (recordId: string) => StorageAlertRowState;
isLoadingPools: () => boolean;
activeSummaryGroupScope: () => SummarySeriesGroupScope | null;
+ clearPinnedSummaryScope: () => void;
hoveredSummaryGroupScope: () => SummarySeriesGroupScope | null;
focusedSummaryGroupScope: () => SummarySeriesGroupScope | null;
focusedSummaryGroupId: () => string | null;
@@ -48,6 +49,8 @@ export const StorageContentCard: Component<StorageContentCardProps> = (props) =>
view: props.view,
selectedNodeId: props.selectedNodeId,
});
+ const showClearSelection = () =>
+ Boolean(props.focusedSummaryGroupId() || props.expandedPoolId() || props.selectedDiskId());
return (
<Card
@@ -58,7 +61,11 @@ export const StorageContentCard: Component<StorageContentCardProps> = (props) =>
data-summary-clear-surface
data-testid="storage-content-surface"
>
- <div class={STORAGE_CONTENT_CARD_HEADER_CLASS}>{model.heading()}</div>
+ <SummaryTableCardHeader
+ title={model.heading()}
+ showClearAction={showClearSelection()}
+ onClear={props.clearPinnedSummaryScope}
+ />
<Show when={model.showDisks()}>
<div class={STORAGE_CONTENT_CARD_BODY_CLASS}>
<DiskList
diff --git a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
index 90f3079827..f8720ff43e 100644
--- a/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
+++ b/frontend-modern/src/components/Storage/__tests__/Storage.test.tsx
@@ -1,4 +1,4 @@
-import { cleanup, fireEvent, render, screen, waitFor } from '@solidjs/testing-library';
+import { cleanup, fireEvent, render, screen, waitFor, within } from '@solidjs/testing-library';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { ChartsAPI } from '@/api/charts';
import StorageSummary from '@/components/Storage/StorageSummary';
@@ -797,7 +797,7 @@ describe('Storage', () => {
).not.toBeInTheDocument();
});
- it('clears pinned storage group scope from table whitespace', async () => {
+ it('clears pinned storage group scope from the content-card header action', async () => {
hookResources = [
buildStorageResource('storage-1', 'Node-Store', 'pve1'),
buildStorageResource('storage-2', 'Edge-Store', 'pve2'),
@@ -815,10 +815,10 @@ describe('Storage', () => {
).toBeTruthy();
});
- const clearSurface = screen.getByTestId('storage-page');
- expect(clearSurface).not.toBeNull();
-
- fireEvent.click(clearSurface);
+ const clearButton = within(screen.getByTestId('storage-content-surface')).getByRole('button', {
+ name: 'Clear selection',
+ });
+ fireEvent.click(clearButton);
await waitFor(() => {
expect(navigateSpy).toHaveBeenCalledWith('/storage?group=node', ROUTE_STATE_REPLACE_OPTIONS);
diff --git a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
index d3bfc42952..0e5c570eda 100644
--- a/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/SharedPrimitives.guardrails.test.ts
@@ -63,6 +63,7 @@ import summaryCardInteractionSource from '@/components/shared/summaryCardInterac
import summaryJumpToRowButtonSource from '@/components/shared/SummaryJumpToRowButton.tsx?raw';
import summaryRowActionButtonSource from '@/components/shared/SummaryRowActionButton.tsx?raw';
import summaryInteractionA11ySource from '@/components/shared/summaryInteractionA11y.ts?raw';
+import summaryTableCardHeaderSource from '@/components/shared/SummaryTableCardHeader.tsx?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';
@@ -109,6 +110,7 @@ import webInterfaceUrlFieldSource from '@/components/shared/WebInterfaceUrlField
import webInterfaceUrlFieldModelSource from '@/components/shared/webInterfaceUrlFieldModel.ts?raw';
import webInterfaceUrlFieldStateSource from '@/components/shared/useWebInterfaceUrlFieldState.ts?raw';
import guestRowSource from '@/components/Dashboard/GuestRow.tsx?raw';
+import dashboardWorkloadTableSource from '@/components/Dashboard/DashboardWorkloadTable.tsx?raw';
import workloadPanelSource from '@/components/Dashboard/WorkloadPanel.tsx?raw';
import guestRowStateSource from '@/components/Dashboard/useGuestRowState.ts?raw';
import dashboardSelectionStateSource from '@/components/Dashboard/useDashboardSelectionState.ts?raw';
@@ -242,6 +244,18 @@ describe('shared primitive guardrails', () => {
expect(interactiveSparklineSource).not.toContain("'background-color': 'rgb(15, 23, 42)'");
});
+ it('keeps shared summary table chrome on one canonical header owner', () => {
+ expect(summaryTableCardHeaderSource).toContain('Clear selection');
+ expect(summaryTableCardHeaderSource).toContain("props.clearLabel ?? 'Clear'");
+ expect(summaryTableCardHeaderSource).toContain('props.clearAriaLabel ??');
+ expect(summaryTableCardHeaderSource).toContain('event.stopPropagation()');
+ expect(summaryTableCardHeaderSource).not.toContain('Pinned to');
+ expect(summaryTableCardHeaderSource).not.toContain('Scoped to');
+ expect(dashboardWorkloadTableSource).toContain('SummaryTableCardHeader');
+ expect(unifiedResourceHostTableCardSource).toContain('SummaryTableCardHeader');
+ expect(storagePoolRowSource).not.toContain('Clear selection');
+ });
+
it('keeps active use trial nudge on shell, runtime, and model owners', () => {
expect(activeUseTrialNudgeSource).toContain('useActiveUseTrialNudgeState');
expect(activeUseTrialNudgeSource).toContain('ACTIVE_USE_TRIAL_NUDGE_TITLE');
diff --git a/frontend-modern/src/components/shared/SummaryTableCardHeader.tsx b/frontend-modern/src/components/shared/SummaryTableCardHeader.tsx
new file mode 100644
index 0000000000..dd4bba5006
--- /dev/null
+++ b/frontend-modern/src/components/shared/SummaryTableCardHeader.tsx
@@ -0,0 +1,43 @@
+import { Show, type Component, type JSX } from 'solid-js';
+
+type SummaryTableCardHeaderProps = {
+ title: JSX.Element;
+ showClearAction?: boolean;
+ clearLabel?: string;
+ clearAriaLabel?: string;
+ onClear?: () => void;
+};
+
+const HEADER_CLASS =
+ 'flex items-center gap-3 border-b border-border bg-surface-hover px-3 py-2 text-[11px] font-semibold uppercase tracking-wide text-muted';
+
+const CLEAR_BUTTON_CLASS = [
+ 'ml-auto inline-flex items-center rounded-sm text-[11px] font-medium normal-case tracking-normal text-muted transition-colors',
+ 'hover:text-base-content focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-1',
+].join(' ');
+
+export const SummaryTableCardHeader: Component<SummaryTableCardHeaderProps> = (props) => {
+ const clearLabel = () => props.clearLabel ?? 'Clear';
+ const clearAriaLabel = () => props.clearAriaLabel ?? 'Clear selection';
+
+ return (
+ <div class={HEADER_CLASS}>
+ <span>{props.title}</span>
+ <Show when={props.showClearAction && props.onClear}>
+ <button
+ type="button"
+ class={CLEAR_BUTTON_CLASS}
+ aria-label={clearAriaLabel()}
+ onClick={(event) => {
+ event.stopPropagation();
+ props.onClear?.();
+ }}
+ >
+ {clearLabel()}
+ </button>
+ </Show>
+ </div>
+ );
+};
+
+export default SummaryTableCardHeader;
diff --git a/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx b/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx
index a9f600b666..890fc91fa4 100644
--- a/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx
+++ b/frontend-modern/src/features/infrastructure/InfrastructurePageSurface.tsx
@@ -64,6 +64,7 @@ export function InfrastructurePageSurface() {
setFiltersOpen,
activeFilterCount,
kioskMode,
+ clearPinnedSummaryScope,
sourceOptions,
statusOptions,
hasActiveFilters,
@@ -330,6 +331,7 @@ export function InfrastructurePageSurface() {
<UnifiedResourceTable
resources={filteredResources()}
expandedResourceId={expandedResourceId()}
+ clearPinnedSummaryScope={clearPinnedSummaryScope}
activeSummaryGroupScope={activeSummaryResourceGroupScope()}
hoveredSummaryGroupScope={hoveredSummaryResourceGroupScope()}
focusedSummaryGroupScope={focusedSummaryResourceGroupScope()}
diff --git a/tests/integration/tests/48-summary-hover-selection.spec.ts b/tests/integration/tests/48-summary-hover-selection.spec.ts
index 496648cf8e..1601cda112 100644
--- a/tests/integration/tests/48-summary-hover-selection.spec.ts
+++ b/tests/integration/tests/48-summary-hover-selection.spec.ts
@@ -94,65 +94,6 @@ async function readSummaryHighlightCount(
);
}
-async function findNeutralClearPoint(
- page: import("@playwright/test").Page,
- surfaceTestId: string,
- tableTestId: string,
-): Promise<{ x: number; y: number }> {
- return page.evaluate(
- ({ surfaceTestId, tableTestId }) => {
- const surface = document.querySelector<HTMLElement>(`[data-testid="${surfaceTestId}"]`);
- const table = document.querySelector<HTMLElement>(`[data-testid="${tableTestId}"]`);
- if (!surface) {
- throw new Error(`Missing surface ${surfaceTestId}`);
- }
- if (!table) {
- throw new Error(`Missing table ${tableTestId}`);
- }
-
- const ignoreSelector = [
- 'button',
- 'a',
- 'input',
- 'select',
- 'textarea',
- 'th',
- 'label',
- 'summary',
- '[role="button"]',
- '[role="link"]',
- '[role="menuitem"]',
- '[data-summary-clear-ignore]',
- '[data-summary-series-id]',
- '[data-summary-group-id]',
- '[data-inline-detail-for]',
- ].join(', ');
-
- const surfaceRect = surface.getBoundingClientRect();
- const tableRect = table.getBoundingClientRect();
- const startY = Math.max(surfaceRect.top + 12, tableRect.top + 12);
- for (let y = startY; y <= surfaceRect.bottom - 12; y += 12) {
- for (let x = surfaceRect.left + 12; x <= surfaceRect.right - 12; x += 12) {
- const target = document.elementFromPoint(x, y);
- if (!(target instanceof HTMLElement) || !surface.contains(target)) {
- continue;
- }
- if (target.closest(ignoreSelector)) {
- continue;
- }
- if (table.contains(target) && !target.closest('[data-summary-clear-surface]')) {
- continue;
- }
- return { x, y };
- }
- }
-
- throw new Error(`No neutral clear point found inside ${surfaceTestId}`);
- },
- { surfaceTestId, tableTestId },
- );
-}
-
async function hoverRowUntilSummaryHighlights(
page: import("@playwright/test").Page,
rows: import("@playwright/test").Locator,
@@ -1059,14 +1000,12 @@ test.describe.serial("Summary hover selection", () => {
{
path: "/workloads",
summaryTestId: "workloads-summary",
- interactionSurfaceTestId: "workloads-page",
tableSurfaceTestId: "workloads-table-surface",
tableRowSelector: "tr[data-guest-id]",
},
{
path: "/infrastructure",
summaryTestId: "infrastructure-summary",
- interactionSurfaceTestId: "infrastructure-page",
tableSurfaceTestId: "infrastructure-table-surface",
tableRowSelector: "tr[data-summary-series-id]",
},
@@ -1175,12 +1114,10 @@ test.describe.serial("Summary hover selection", () => {
.toBe(true);
await expect(page.getByText("Pinned to")).toHaveCount(0);
- const clearPoint = await findNeutralClearPoint(
- page,
- surface.interactionSurfaceTestId,
- surface.tableSurfaceTestId,
- );
- await page.mouse.click(clearPoint.x, clearPoint.y);
+ await page
+ .getByTestId(surface.tableSurfaceTestId)
+ .getByRole("button", { name: "Clear selection" })
+ .click();
await expect
.poll(() => new URL(page.url()).searchParams.get("summaryGroup"))
.toBeNull();
@@ -1220,7 +1157,6 @@ test.describe.serial("Summary hover selection", () => {
await page.goto("/storage?group=node", { waitUntil: "domcontentloaded" });
const storageSummary = page.getByTestId("storage-summary");
- const storageInteractionSurface = page.getByTestId("storage-page");
await expect(storageSummary).toBeVisible();
await expect(page.getByText("Pinned to")).toHaveCount(0);
@@ -1320,13 +1256,10 @@ test.describe.serial("Summary hover selection", () => {
.toBe(true);
await expect(page.getByText("Pinned to")).toHaveCount(0);
- const clearPoint = await findNeutralClearPoint(
- page,
- "storage-page",
- "storage-content-surface",
- );
- await expect(storageInteractionSurface).toBeVisible();
- await page.mouse.click(clearPoint.x, clearPoint.y);
+ await page
+ .getByTestId("storage-content-surface")
+ .getByRole("button", { name: "Clear selection" })
+ .click();
await expect(page.locator('tr[data-summary-group-member-active="pinned"]')).toHaveCount(0);
await expect
.poll(() => new URL(page.url()).searchParams.get("summaryGroup"))