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.

Stabilize page control filter wrapping

rcourtman977764bc0997
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index bdb75c8ff9..5dc588db8b 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -341,10 +341,11 @@ work extends shared components instead of creating new local variants.
of staying as loose filter-row children, and those controls must stay
grouped when dense toolbars wrap so popovers remain viewport-safe instead of
drifting off-screen from page-local flex behavior. The shared action rail
- must align to the trailing edge at wrapped desktop widths instead of waiting
- for a wide breakpoint, so Recovery events, Workloads, Storage,
- Infrastructure, and future dense toolbars do not strand Filter/Columns/Reset
- actions at the left edge of a second row. Shared `FilterToolbarPanel` owns
+ must align to the trailing edge at wrapped desktop widths and remain
+ separate from the filter-control wrap zone instead of waiting for a wide
+ breakpoint, so Recovery events, Workloads, Storage, Infrastructure, and
+ future dense toolbars do not strand Filter/Columns/Reset actions as an
+ isolated second-row fragment. Shared `FilterToolbarPanel` owns
default filter-popover geometry, and `FilterToolbar` owns the shared chart
visibility display action: Workloads, Storage, Infrastructure, and future
summary-bearing pages must use `ChartVisibilityToggleButton` so the
diff --git a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
index 92a1bac19f..6efc40780b 100644
--- a/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
+++ b/frontend-modern/src/components/Recovery/__tests__/Recovery.test.tsx
@@ -1075,10 +1075,16 @@ describe('Recovery', () => {
const filterButton = within(controls).getByRole('button', { name: 'Filter' });
const columnsButton = within(controls).getByRole('button', { name: /columns/i });
const actionRail = filterButton.closest('.page-controls-toolbar-actions');
+ const filterControls = within(controls)
+ .getByTestId('recovery-history-item-filter-trigger')
+ .closest('.page-controls-filter-controls');
expect(actionRail).not.toBeNull();
expect(actionRail).toContainElement(filterButton);
expect(actionRail).toContainElement(columnsButton);
+ expect(filterControls).not.toBeNull();
+ expect(filterControls).not.toContainElement(filterButton);
+ expect(filterControls).not.toContainElement(columnsButton);
});
it('lets operators create and clear the item filter from the recovery events controls', async () => {
diff --git a/frontend-modern/src/components/shared/PageControls.guardrails.test.ts b/frontend-modern/src/components/shared/PageControls.guardrails.test.ts
index e98ee32a6b..83c526181e 100644
--- a/frontend-modern/src/components/shared/PageControls.guardrails.test.ts
+++ b/frontend-modern/src/components/shared/PageControls.guardrails.test.ts
@@ -126,8 +126,11 @@ describe('page controls guardrails', () => {
expect(workloadsFilterSource).not.toContain('aria-label="Charts"');
expect(storageFilterSource).not.toContain('aria-label="Charts"');
expect(infrastructurePageSurfaceSource).not.toContain('aria-label="Charts"');
+ expect(pageControlsSource).toContain('page-controls-filter-controls');
expect(pageControlsSource).toContain('page-controls-toolbar-actions ml-auto');
- expect(pageControlsSource).toContain('justify-end gap-2');
+ expect(pageControlsSource).toContain(
+ 'shrink-0 flex-wrap items-center justify-end gap-2 self-start',
+ );
expect(pageControlsSource).not.toContain('2xl:ml-auto');
expect(recoveryHistorySectionSource).not.toContain('toolbarClass="lg:flex-nowrap"');
expect(recoveryHistorySectionSource).not.toContain('ml-auto flex items-center gap-2');
diff --git a/frontend-modern/src/components/shared/PageControls.test.tsx b/frontend-modern/src/components/shared/PageControls.test.tsx
index efb011f34b..6ac0be29c6 100644
--- a/frontend-modern/src/components/shared/PageControls.test.tsx
+++ b/frontend-modern/src/components/shared/PageControls.test.tsx
@@ -39,8 +39,15 @@ describe('PageControls', () => {
expect(trailingActions).not.toBeNull();
expect(trailingActions!).toContainElement(resetButton);
expect(trailingActions!).toHaveClass('ml-auto');
+ expect(trailingActions!).toHaveClass('shrink-0');
expect(trailingActions!).toHaveClass('justify-end');
+ expect(trailingActions!).toHaveClass('self-start');
expect(trailingActions!).not.toHaveClass('2xl:ml-auto');
+ const filterControls = screen
+ .getByText('Filters', { selector: 'div' })
+ .closest('.page-controls-filter-controls');
+ expect(filterControls).not.toBeNull();
+ expect(filterControls!).not.toContainElement(columnsButton);
fireEvent.click(screen.getByRole('button', { name: /filters/i }));
expect(onToggleFilters).toHaveBeenCalledTimes(1);
@@ -114,7 +121,15 @@ describe('PageControls', () => {
expect(trailingActions!).toContainElement(trailing);
expect(trailingActions!).toContainElement(columnsButton);
expect(trailingActions!).toHaveClass('ml-auto');
+ expect(trailingActions!).toHaveClass('shrink-0');
expect(trailingActions!).toHaveClass('justify-end');
+ expect(trailingActions!).toHaveClass('self-start');
+ const filterControls = screen
+ .getByText('Filters', { selector: 'div' })
+ .closest('.page-controls-filter-controls');
+ expect(filterControls).not.toBeNull();
+ expect(filterControls!).not.toContainElement(trailing);
+ expect(filterControls!).not.toContainElement(columnsButton);
expect(screen.queryByTestId('desktop-utility')).not.toBeInTheDocument();
});
});
diff --git a/frontend-modern/src/components/shared/PageControls.tsx b/frontend-modern/src/components/shared/PageControls.tsx
index 472ae8f282..97a54cf77f 100644
--- a/frontend-modern/src/components/shared/PageControls.tsx
+++ b/frontend-modern/src/components/shared/PageControls.tsx
@@ -107,10 +107,12 @@ export const PageControls: Component<PageControlsProps> = (props) => {
mobileTrailing={activeMobileTrailing()}
class={local.class}
>
- {local.children}
-
<Show when={hasTrailingActions()}>
- <div class="page-controls-toolbar-actions ml-auto inline-flex flex-wrap items-center justify-end gap-2">
+ <div class="page-controls-filter-controls flex min-w-0 flex-1 basis-0 flex-wrap items-center gap-2">
+ {local.children}
+ </div>
+
+ <div class="page-controls-toolbar-actions ml-auto inline-flex shrink-0 flex-wrap items-center justify-end gap-2 self-start">
<Show when={local.toolbarTrailing}>{local.toolbarTrailing}</Show>
<Show when={activeUtilityActions()}>
@@ -141,6 +143,8 @@ export const PageControls: Component<PageControlsProps> = (props) => {
</Show>
</div>
</Show>
+
+ <Show when={!hasTrailingActions()}>{local.children}</Show>
</FilterHeader>
);
};