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.

frontend: migrate shared PlatformTableToolbar onto the canonical FilterBar

rcourtman911fce961447
diff --git a/frontend-modern/src/components/shared/FilterBar/FilterBar.tsx b/frontend-modern/src/components/shared/FilterBar/FilterBar.tsx
index c384bf3db8..2def243c59 100644
--- a/frontend-modern/src/components/shared/FilterBar/FilterBar.tsx
+++ b/frontend-modern/src/components/shared/FilterBar/FilterBar.tsx
@@ -115,6 +115,7 @@ export const FilterBar: Component<FilterBarProps> = (props) => {
clearOnEscape={props.search.clearOnEscape}
onBeforeAutoFocus={props.search.onBeforeAutoFocus}
history={searchHistory()}
+ tips={props.search.tips}
/>
</div>
{props.searchTrailing}
diff --git a/frontend-modern/src/components/shared/FilterBar/filterCatalog.ts b/frontend-modern/src/components/shared/FilterBar/filterCatalog.ts
index 1f54c217ac..171eab47e9 100644
--- a/frontend-modern/src/components/shared/FilterBar/filterCatalog.ts
+++ b/frontend-modern/src/components/shared/FilterBar/filterCatalog.ts
@@ -1,5 +1,6 @@
import type { Accessor, JSX } from 'solid-js';
import type { FilterButtonGroupOptionTone } from '@/components/shared/filterButtonGroupModel';
+import type { SearchTipsConfig } from '@/components/shared/useSearchInputEnhancements';
export interface FilterSelectOption {
value: string;
@@ -38,6 +39,7 @@ export interface FilterBarSearch {
placeholder: string;
historyKey?: string;
emptyMessage?: string;
+ tips?: SearchTipsConfig;
clearOnEscape?: boolean;
onBeforeAutoFocus?: () => boolean;
}
diff --git a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
index 98c8590624..a0c0b6d5bb 100644
--- a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
+++ b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx
@@ -245,7 +245,7 @@ describe('Docker native tables', () => {
expect(screen.getByText('0 of 2 volumes')).toBeInTheDocument();
expect(screen.getByText('No volumes match current filters')).toBeInTheDocument();
- fireEvent.click(screen.getByRole('button', { name: 'Reset filters' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Clear all' }));
expect(search).toHaveValue('');
expect(screen.getByText('2 volumes')).toBeInTheDocument();
@@ -463,7 +463,7 @@ describe('Docker native tables', () => {
expect(document.querySelector('[data-docker-storage-row="host-archive"]')).not.toBeNull();
expect(document.querySelector('[data-docker-storage-row="host-edge"]')).toBeNull();
- fireEvent.click(screen.getByRole('button', { name: 'Reset filters' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Clear all' }));
expect(search).toHaveValue('');
expect(screen.getByText('2 hosts')).toBeInTheDocument();
diff --git a/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx
index be5f87c3ea..8c15bdfb4b 100644
--- a/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx
+++ b/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx
@@ -388,7 +388,7 @@ describe('DockerPageSurface', () => {
'offline',
);
- fireEvent.click(screen.getByRole('button', { name: 'Reset filters' }));
+ fireEvent.click(screen.getByRole('button', { name: 'Clear all' }));
expect(search).toHaveValue('');
expect(screen.getByText('2 rows')).toBeInTheDocument();
diff --git a/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx b/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx
index 70d771dffe..b7df3e0b85 100644
--- a/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx
+++ b/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx
@@ -3,12 +3,11 @@ import RotateCcwIcon from 'lucide-solid/icons/rotate-ccw';
import TriangleAlertIcon from 'lucide-solid/icons/triangle-alert';
import { For, Show, createMemo, createSignal, type Component, type JSX } from 'solid-js';
import { EmptyState } from '@/components/shared/EmptyState';
-import {
- FilterButtonGroup,
- type FilterOption as PlatformTableFilterOption,
-} from '@/components/shared/FilterButtonGroup';
-import { SearchInput, type SearchInputProps } from '@/components/shared/SearchInput';
+import { type FilterOption as PlatformTableFilterOption } from '@/components/shared/FilterButtonGroup';
+import { FilterBar, type FilterDef } from '@/components/shared/FilterBar';
+import { type SearchInputProps } from '@/components/shared/SearchInput';
import { TableCard } from '@/components/shared/TableCard';
+import { useBreakpoint } from '@/hooks/useBreakpoint';
import { UnifiedResourceTable } from '@/components/Infrastructure/UnifiedResourceTable';
import type { Resource, ResourceStatus } from '@/types/resource';
import { formatVmwareClusterServices } from '@/utils/vmwareDisplay';
@@ -349,33 +348,63 @@ export function PlatformTableToolbar<T extends string | number>(props: {
hasActiveFilters?: boolean;
onResetFilters?: () => void;
}) {
+ const { isMobile } = useBreakpoint();
+
+ // Migrated onto the shared FilterBar so every platform table inherits the
+ // same combinable-filter UX (chip rail, saved-view scaffolding, mobile
+ // collapse) instead of a bespoke search + segmented-status row. The public
+ // prop surface is unchanged: search passes straight through and the single
+ // status facet is modelled as an inline segmented control. Tables that want
+ // additional scope filters or saved views opt in via the FilterBar directly.
+ const filters: FilterDef[] = [
+ {
+ id: 'status',
+ label: 'Status',
+ group: 'status',
+ inline: true,
+ options: () =>
+ props.statusOptions.map((option) => ({
+ value: String(option.value),
+ label: option.label,
+ ariaLabel: option.ariaLabel,
+ title: option.title,
+ compactLabel: option.compactLabel,
+ leading: option.leading,
+ visualLabel: option.visualLabel,
+ icon: option.icon,
+ tone: option.tone,
+ })),
+ value: () => String(props.status),
+ setValue: (value) => {
+ const match = props.statusOptions.find((option) => String(option.value) === value);
+ if (match) props.onStatusChange(match.value);
+ },
+ defaultValue: String(props.statusOptions[0]?.value ?? 'all'),
+ },
+ ];
+
return (
- <div class="flex flex-wrap items-center gap-2">
- <div class="min-w-[200px] flex-1 sm:max-w-xs">
- <SearchInput
- value={props.search}
- onChange={props.onSearchChange}
- placeholder={props.searchPlaceholder}
- title={props.searchPlaceholder}
- history={props.searchHistory}
- tips={props.searchTips}
+ <FilterBar
+ isMobile={isMobile}
+ search={{
+ value: props.search,
+ setValue: props.onSearchChange,
+ placeholder: props.searchPlaceholder,
+ historyKey: props.searchHistory?.storageKey,
+ emptyMessage: props.searchHistory?.emptyMessage,
+ tips: props.searchTips,
+ }}
+ filters={filters}
+ viewOptionsTrailing={
+ <PlatformResourceCounter
+ visible={props.visible}
+ total={props.total}
+ rowNoun={props.rowNoun}
/>
- </div>
- <FilterButtonGroup
- variant="compact"
- options={props.statusOptions}
- value={props.status}
- onChange={props.onStatusChange}
- />
- <Show when={props.hasActiveFilters && props.onResetFilters}>
- <PlatformTableResetFiltersButton onReset={props.onResetFilters!} />
- </Show>
- <PlatformResourceCounter
- visible={props.visible}
- total={props.total}
- rowNoun={props.rowNoun}
- />
- </div>
+ }
+ showClearAll={() => Boolean(props.hasActiveFilters && props.onResetFilters)}
+ onClearAll={props.onResetFilters}
+ />
);
}