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.

refactor(recovery): route workspace strips through page controls

rcourtman887c8d316860
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index dcda5fa689..a7eac40cf1 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -639,6 +639,14 @@ and `frontend-modern/src/components/shared/searchInputModel.ts` owns the shared
search-input contract plus shortcut-hint and trailing-control policy. Future
search-input work should extend those owners instead of pushing type-to-search
or enhancement wiring back into the shared shell.
+The shared page-controls bar now follows that same owner split.
+`frontend-modern/src/components/shared/PageControls.tsx` stays the render shell
+for canonical page-level control composition, while
+`frontend-modern/src/components/shared/FilterToolbar.tsx` owns the shared
+search-row, filter-row, and inline-leading-slot layout surface. Monitoring
+pages that need workspace tabs or count chips next to search should route that
+through the shared `searchLeading` slot instead of recreating a second local
+header strip above the control bar.
The search-input enhancement surfaces now follow that same owner split.
`frontend-modern/src/components/shared/SearchInputEnhancements.tsx` stays the
render shell, `frontend-modern/src/components/shared/useSearchInputEnhancements.ts`
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index a779466111..6b9aad8d63 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -721,6 +721,11 @@ rows. Recovery inventory and event tables should use the same restrained
title-case header typography, compact control heights, and thin row density as
the established Pulse monitoring tables instead of drifting into report-style
uppercase headers or oversized filter chrome.
+That same workspace-shell rule should also avoid a dedicated recovery-only
+status strip above the control bar. Protected-items and recovery-events should
+surface their tabs, counts, and issue cues through the shared page-controls
+search row so the page hands from summary directly into one canonical control
+surface, the same way other Pulse monitoring pages do.
That same workspace rule also means the protected-items versus recovery-events
switcher should live inside the active workspace header strip, not in its own
separate band above the cards, so the page hands off from summary directly into
diff --git a/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx
index 7bd607fbad..b232770bcc 100644
--- a/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryHistorySection.tsx
@@ -130,30 +130,28 @@ export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (p
return (
<Card padding="none" tone="card" class="overflow-hidden border-border-subtle bg-surface">
- <div class="border-b border-border-subtle/80 bg-surface px-4 py-2">
- <div class="flex flex-col gap-2 lg:flex-row lg:items-center lg:justify-between">
- <div class="flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center sm:gap-3">
- <Show when={props.workspaceControls}>
- <div class="shrink-0">{props.workspaceControls}</div>
- </Show>
- <div class="flex flex-wrap items-center gap-3 text-[11px] text-muted">
- <span class="font-medium text-base-content">
- {props.recoveryPoints.meta().total} event
- {props.recoveryPoints.meta().total === 1 ? '' : 's'}
- </span>
- <Show when={props.groupedByDay().length > 0}>
- <span>
- {props.groupedByDay().length} day group
- {props.groupedByDay().length === 1 ? '' : 's'}
- </span>
- </Show>
- </div>
- </div>
- </div>
- </div>
<Show when={!props.kioskMode}>
<div class="border-b border-border-subtle/80 bg-surface px-4 py-2.5">
<PageControls
+ role="group"
+ aria-label="Recovery events controls"
+ searchLeading={
+ <div class="flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted">
+ <Show when={props.workspaceControls}>
+ <div class="shrink-0">{props.workspaceControls}</div>
+ </Show>
+ <span class="font-medium text-base-content">
+ {props.recoveryPoints.meta().total} event
+ {props.recoveryPoints.meta().total === 1 ? '' : 's'}
+ </span>
+ <Show when={props.groupedByDay().length > 0}>
+ <span>
+ {props.groupedByDay().length} day group
+ {props.groupedByDay().length === 1 ? '' : 's'}
+ </span>
+ </Show>
+ </div>
+ }
search={
<SearchInput
value={props.queryFilter}
@@ -162,7 +160,7 @@ export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (p
props.setCurrentPage(1);
}}
placeholder={getRecoveryHistorySearchPlaceholder()}
- class="w-full"
+ class="min-w-[16rem] flex-1 !w-auto"
inputClass="py-2 text-sm"
clearOnEscape
history={{
@@ -364,6 +362,7 @@ export const RecoveryHistorySection: Component<RecoveryHistorySectionProps> = (p
label: 'Reset all',
}}
showFilters={!props.isMobile || historyFiltersOpen()}
+ searchRowClass="flex w-full flex-wrap items-center gap-3 sm:grid sm:grid-cols-[auto,minmax(16rem,1fr)] sm:items-center"
toolbarClass="lg:flex-nowrap"
>
<LabeledFilterSelect
diff --git a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
index c941cba12f..533bf836e7 100644
--- a/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
+++ b/frontend-modern/src/components/Recovery/RecoveryProtectedInventorySection.tsx
@@ -202,43 +202,38 @@ export const RecoveryProtectedInventorySection: Component<
tone="card"
class="overflow-hidden border-border-subtle bg-surface"
>
- <div class="border-b border-border-subtle/80 bg-surface px-4 py-1.5">
- <div class="flex flex-col gap-2 lg:flex-row lg:items-center lg:justify-between">
- <div class="flex min-w-0 flex-col gap-2 sm:flex-row sm:flex-wrap sm:items-center sm:gap-3">
- <Show when={props.workspaceControls}>
- <div class="shrink-0">{props.workspaceControls}</div>
- </Show>
- <div class="flex flex-wrap items-center gap-2.5 text-[11px] text-muted">
- <span class="font-medium text-base-content">
- {sortedRollups().length}{' '}
- {sortedRollups().length === 1 ? 'protected item' : 'protected items'}
- </span>
- </div>
- </div>
- <div class="flex flex-wrap items-center gap-2 text-xs">
- <Show when={props.rollupsSummary().stale > 0}>
- <span class={`${getRecoveryRollupStatusPillClass('stale')} px-2 py-0.5`}>
- {props.rollupsSummary().stale} stale
- </span>
- </Show>
- <Show when={props.rollupsSummary().neverSucceeded > 0}>
- <span class={`${getRecoveryRollupStatusPillClass('never-succeeded')} px-2 py-0.5`}>
- {props.rollupsSummary().neverSucceeded} never succeeded
- </span>
- </Show>
- </div>
- </div>
- </div>
-
<Show when={!props.kioskMode}>
<div class="border-b border-border-subtle/80 bg-surface px-4 py-2">
<PageControls
+ role="group"
+ aria-label="Protected items controls"
+ searchLeading={
+ <div class="flex min-w-0 flex-wrap items-center gap-2 text-[11px] text-muted">
+ <Show when={props.workspaceControls}>
+ <div class="shrink-0">{props.workspaceControls}</div>
+ </Show>
+ <span class="font-medium text-base-content">
+ {sortedRollups().length}{' '}
+ {sortedRollups().length === 1 ? 'protected item' : 'protected items'}
+ </span>
+ <Show when={props.rollupsSummary().stale > 0}>
+ <span class={`${getRecoveryRollupStatusPillClass('stale')} px-2 py-0.5`}>
+ {props.rollupsSummary().stale} stale
+ </span>
+ </Show>
+ <Show when={props.rollupsSummary().neverSucceeded > 0}>
+ <span class={`${getRecoveryRollupStatusPillClass('never-succeeded')} px-2 py-0.5`}>
+ {props.rollupsSummary().neverSucceeded} never succeeded
+ </span>
+ </Show>
+ </div>
+ }
search={
<SearchInput
value={props.queryFilter}
onChange={(value) => props.setQueryFilter(value)}
placeholder={getRecoveryProtectedSearchPlaceholder()}
- class="w-full"
+ class="min-w-[16rem] flex-1 !w-auto"
inputClass="py-1.5 text-sm"
clearOnEscape
history={{
@@ -252,9 +247,9 @@ export const RecoveryProtectedInventorySection: Component<
onToggle: () => setProtectedFiltersOpen((open) => !open),
count: protectedActiveFilterCount(),
}}
- showFilters={!props.isMobile || protectedFiltersOpen()}
- searchRowClass="flex w-full items-center gap-3"
- toolbarClass="gap-3 lg:flex-nowrap"
+ showFilters={!props.isMobile || protectedFiltersOpen()}
+ searchRowClass="flex w-full flex-wrap items-center gap-3 sm:grid sm:grid-cols-[auto,minmax(16rem,1fr)] sm:items-center"
+ toolbarClass="gap-3 lg:flex-nowrap"
>
<LabeledFilterSelect
id="recovery-item-type-filter"
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index 95372e1f30..13c8be8382 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -205,10 +205,21 @@ describe('Recovery', () => {
expect(screen.getByText('Recovery Posture')).toBeInTheDocument();
expect(await screen.findByRole('tab', { name: /protected items/i })).toBeInTheDocument();
await screen.findByText('VM 123');
+ const inventoryControls = screen.getByRole('group', { name: /protected items controls/i });
+ expect(
+ within(inventoryControls).getByPlaceholderText('Search protected items...'),
+ ).toBeInTheDocument();
+ expect(
+ within(inventoryControls).getByRole('tab', { name: /protected items/i }),
+ ).toBeInTheDocument();
+ expect(
+ within(inventoryControls).getByRole('tab', { name: /recovery events/i }),
+ ).toBeInTheDocument();
+ expect(within(inventoryControls).getByText(/^2 protected items$/i)).toBeInTheDocument();
expect(screen.queryByText('Protected inventory')).not.toBeInTheDocument();
expect(screen.queryByText('Needs Attention')).not.toBeInTheDocument();
expect(screen.getAllByText(/Page 1 \/ 1/i).length).toBeGreaterThan(0);
- expect(screen.getAllByText(/2 protected items/i).length).toBeGreaterThan(0);
+ expect(screen.getAllByText(/^2 protected items$/i)).toHaveLength(1);
expect(screen.getByRole('tab', { name: /recovery events/i })).toHaveAttribute(
'aria-selected',
'false',
@@ -248,8 +259,20 @@ describe('Recovery', () => {
expect(screen.getAllByRole('table')).toHaveLength(1);
});
const historyTable = screen.getAllByRole('table')[0];
+ const historyControls = screen.getByRole('group', { name: /recovery events controls/i });
+ expect(
+ within(historyControls).getByPlaceholderText('Search recovery history...'),
+ ).toBeInTheDocument();
+ expect(
+ within(historyControls).getByRole('tab', { name: /protected items/i }),
+ ).toBeInTheDocument();
+ expect(
+ within(historyControls).getByRole('tab', { name: /recovery events/i }),
+ ).toBeInTheDocument();
+ expect(within(historyControls).getByText(/1 event/i)).toBeInTheDocument();
+ expect(within(historyControls).getByText(/^1 day group$/i)).toBeInTheDocument();
expect(screen.getAllByText(/1 event/i).length).toBeGreaterThan(0);
- expect(screen.getByText(/1 day group/i)).toBeInTheDocument();
+ expect(screen.getAllByText(/^1 day group$/i)).toHaveLength(1);
expect(within(historyTable).getByText('Item Type')).toBeInTheDocument();
expect(within(historyTable).getByText('Item')).toBeInTheDocument();
expect(within(historyTable).getByText('Platform')).toBeInTheDocument();
diff --git a/frontend-modern/src/components/shared/FilterToolbar.tsx b/frontend-modern/src/components/shared/FilterToolbar.tsx
index bfc8a3a740..252c2e3a1a 100644
--- a/frontend-modern/src/components/shared/FilterToolbar.tsx
+++ b/frontend-modern/src/components/shared/FilterToolbar.tsx
@@ -41,6 +41,7 @@ export const FilterToolbarShell: Component<FilterToolbarShellProps> = (props) =>
};
interface FilterHeaderProps extends JSX.HTMLAttributes<HTMLDivElement> {
+ searchLeading?: JSX.Element;
search: JSX.Element;
showFilters: boolean;
children: JSX.Element;
@@ -56,6 +57,7 @@ interface FilterHeaderProps extends JSX.HTMLAttributes<HTMLDivElement> {
export const FilterHeader: Component<FilterHeaderProps> = (props) => {
const [local, divProps] = splitProps(props, [
+ 'searchLeading',
'search',
'showFilters',
'children',
@@ -91,6 +93,7 @@ export const FilterHeader: Component<FilterHeaderProps> = (props) => {
) : (
<FilterToolbarContent class={local.contentClass}>
<FilterToolbarSearchRow class={local.searchRowClass}>
+ {local.searchLeading}
{local.search}
{local.searchAccessory}
</FilterToolbarSearchRow>
diff --git a/frontend-modern/src/components/shared/PageControls.guardrails.test.ts b/frontend-modern/src/components/shared/PageControls.guardrails.test.ts
index 989a5aa43b..d55e51f450 100644
--- a/frontend-modern/src/components/shared/PageControls.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/PageControls.guardrails.test.ts
@@ -1,8 +1,9 @@
import { describe, expect, it } from 'vitest';
import pageControlsSource from '@/components/shared/PageControls.tsx?raw';
import dashboardFilterSource from '@/components/Dashboard/DashboardFilter.tsx?raw';
-import recoverySource from '@/components/Recovery/Recovery.tsx?raw';
-import infrastructureSource from '@/pages/Infrastructure.tsx?raw';
+import recoveryHistorySectionSource from '@/components/Recovery/RecoveryHistorySection.tsx?raw';
+import recoveryProtectedInventorySectionSource from '@/components/Recovery/RecoveryProtectedInventorySection.tsx?raw';
+import infrastructurePageSurfaceSource from '@/features/infrastructure/InfrastructurePageSurface.tsx?raw';
const tsxSources = import.meta.glob('../../**/*.tsx', {
query: '?raw',
@@ -15,17 +16,25 @@ describe('page controls guardrails', () => {
expect(pageControlsSource).toContain('FilterHeader');
expect(pageControlsSource).toContain('FilterMobileToggleButton');
expect(pageControlsSource).toContain('ColumnPicker');
+ expect(pageControlsSource).toContain('searchLeading');
+ expect(pageControlsSource).toContain('splitProps');
+ expect(pageControlsSource).toContain('<FilterHeader');
+ expect(pageControlsSource).toContain('{...divProps}');
expect(dashboardFilterSource).toContain('PageControls');
expect(dashboardFilterSource).not.toContain('<FilterHeader');
expect(dashboardFilterSource).not.toContain('<ColumnPicker');
- expect(recoverySource).toContain('PageControls');
- expect(recoverySource).not.toContain('<FilterHeader');
- expect(recoverySource).not.toContain('<ColumnPicker');
+ expect(recoveryProtectedInventorySectionSource).toContain('PageControls');
+ expect(recoveryProtectedInventorySectionSource).not.toContain('<FilterHeader');
+ expect(recoveryProtectedInventorySectionSource).not.toContain('<ColumnPicker');
- expect(infrastructureSource).toContain('PageControls');
- expect(infrastructureSource).not.toContain('<FilterHeader');
+ expect(recoveryHistorySectionSource).toContain('PageControls');
+ expect(recoveryHistorySectionSource).not.toContain('<FilterHeader');
+ expect(recoveryHistorySectionSource).not.toContain('<ColumnPicker');
+
+ expect(infrastructurePageSurfaceSource).toContain('PageControls');
+ expect(infrastructurePageSurfaceSource).not.toContain('<FilterHeader');
});
it('limits raw FilterHeader and ColumnPicker usage to the known allowlist', () => {
@@ -82,4 +91,12 @@ describe('page controls guardrails', () => {
'./PageControls.tsx',
]);
});
+
+ it('keeps search-row leading content routed through PageControls rather than local FilterHeader forks', () => {
+ expect(pageControlsSource).toContain('searchLeading?: JSX.Element');
+ expect(pageControlsSource).toContain('searchLeading={local.searchLeading}');
+ expect(pageControlsSource).toContain('{...divProps}');
+ expect(recoveryProtectedInventorySectionSource).not.toContain('<FilterHeader');
+ expect(recoveryHistorySectionSource).not.toContain('<FilterHeader');
+ });
});
diff --git a/frontend-modern/src/components/shared/PageControls.tsx b/frontend-modern/src/components/shared/PageControls.tsx
index d415a99155..646e7f3faf 100644
--- a/frontend-modern/src/components/shared/PageControls.tsx
+++ b/frontend-modern/src/components/shared/PageControls.tsx
@@ -1,4 +1,4 @@
-import { Component, JSX, Show } from 'solid-js';
+import { Component, JSX, Show, splitProps } from 'solid-js';
import { ColumnPicker } from '@/components/shared/ColumnPicker';
import {
FilterActionButton,
@@ -31,6 +31,7 @@ interface PageControlsMobileFilters {
}
interface PageControlsProps extends JSX.HTMLAttributes<HTMLDivElement> {
+ searchLeading?: JSX.Element;
search: JSX.Element;
showFilters: boolean;
children: JSX.Element;
@@ -47,56 +48,75 @@ interface PageControlsProps extends JSX.HTMLAttributes<HTMLDivElement> {
}
export const PageControls: Component<PageControlsProps> = (props) => {
+ const [local, divProps] = splitProps(props, [
+ 'searchLeading',
+ 'search',
+ 'showFilters',
+ 'children',
+ 'contentClass',
+ 'searchRowClass',
+ 'toolbarClass',
+ 'mobileRowClass',
+ 'mobileLeading',
+ 'mobileTrailing',
+ 'utilityActions',
+ 'columnVisibility',
+ 'resetAction',
+ 'mobileFilters',
+ 'class',
+ ]);
const mobileSearchAccessory = () => (
- <Show when={props.mobileFilters?.enabled}>
+ <Show when={local.mobileFilters?.enabled}>
<FilterMobileToggleButton
- onClick={() => props.mobileFilters?.onToggle()}
- count={props.mobileFilters?.count ?? 0}
+ onClick={() => local.mobileFilters?.onToggle()}
+ count={local.mobileFilters?.count ?? 0}
/>
</Show>
);
return (
<FilterHeader
- search={props.search}
- searchAccessory={mobileSearchAccessory()}
- showFilters={props.showFilters}
- contentClass={props.contentClass}
- searchRowClass={props.searchRowClass}
- toolbarClass={props.toolbarClass}
- mobileRowClass={props.mobileRowClass}
- mobileLeading={props.mobileLeading}
- mobileTrailing={props.mobileTrailing}
- class={props.class}
+ {...divProps}
+ searchLeading={local.searchLeading}
+ search={local.search}
+ searchAccessory={mobileSearchAccessory()}
+ showFilters={local.showFilters}
+ contentClass={local.contentClass}
+ searchRowClass={local.searchRowClass}
+ toolbarClass={local.toolbarClass}
+ mobileRowClass={local.mobileRowClass}
+ mobileLeading={local.mobileLeading}
+ mobileTrailing={local.mobileTrailing}
+ class={local.class}
>
- {props.children}
+ {local.children}
- <Show when={props.utilityActions}>
+ <Show when={local.utilityActions}>
<FilterDivider />
- {props.utilityActions}
+ {local.utilityActions}
</Show>
<Show
- when={props.columnVisibility && props.columnVisibility.availableToggles().length > 0}
+ when={local.columnVisibility && local.columnVisibility.availableToggles().length > 0}
>
<FilterDivider />
<ColumnPicker
- columns={props.columnVisibility!.availableToggles()}
- isHidden={props.columnVisibility!.isHiddenByUser}
- onToggle={props.columnVisibility!.toggle}
- onReset={props.columnVisibility!.resetToDefaults}
+ columns={local.columnVisibility!.availableToggles()}
+ isHidden={local.columnVisibility!.isHiddenByUser}
+ onToggle={local.columnVisibility!.toggle}
+ onReset={local.columnVisibility!.resetToDefaults}
/>
</Show>
- <Show when={props.resetAction?.show}>
+ <Show when={local.resetAction?.show}>
<FilterDivider />
<FilterActionButton
- onClick={() => props.resetAction?.onClick()}
- title={props.resetAction?.title}
- class={props.resetAction?.class}
+ onClick={() => local.resetAction?.onClick()}
+ title={local.resetAction?.title}
+ class={local.resetAction?.class}
>
- {props.resetAction?.icon}
- {props.resetAction?.label ?? 'Reset'}
+ {local.resetAction?.icon}
+ {local.resetAction?.label ?? 'Reset'}
</FilterActionButton>
</Show>
</FilterHeader>