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.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
feat(docker): add a URL-backed Host scope filter to the containers table
rcourtman4c0eb398e985
diff --git a/frontend-modern/src/features/docker/DockerContainersTable.tsx b/frontend-modern/src/features/docker/DockerContainersTable.tsxindex d26fa93866..f8bbe1ce40 100644--- a/frontend-modern/src/features/docker/DockerContainersTable.tsx+++ b/frontend-modern/src/features/docker/DockerContainersTable.tsx@@ -1,4 +1,6 @@import { For, Show, createMemo, type Component } from 'solid-js';+import { useSearchParams } from '@solidjs/router';+import type { FilterDef } from '@/components/shared/FilterBar';import { TableCard } from '@/components/shared/TableCard';import { TableCardHeader } from '@/components/shared/TableCardHeader';import {@@ -134,7 +136,50 @@ export const DockerContainersTable: Component<DockerNativeTableProps> = (props)initialStatus: 'all' as DockerResourceStatusFilter,filter: filterDockerResources,});- const sortedRows = createMemo(() => [...tableState.filtered()].sort(compareDockerContainers));++ // Host scope filter, URL-backed so it is shareable and captured by saved+ // views. Distinct hosts are derived from the current resource set; the facet+ // only appears once more than one host is present (a single-host fleet has+ // nothing to scope by).+ const [searchParams, setSearchParams] = useSearchParams();+ const hostFilter = () => (typeof searchParams.host === 'string' ? searchParams.host : '');+ const setHostFilter = (value: string) => setSearchParams({ host: value || null });+ const hostOptions = createMemo(() => {+ const seen = new Set<string>();+ for (const resource of props.resources) {+ const host = dockerHostName(resource);+ if (host && host !== '—') seen.add(host);+ }+ return [...seen].sort((a, b) => a.localeCompare(b));+ });+ const scopeFilters = createMemo<FilterDef[]>(() => {+ if (hostOptions().length <= 1) return [];+ return [+ {+ id: 'host',+ label: 'Host',+ group: 'scope',+ options: () => [+ { value: '', label: 'All hosts' },+ ...hostOptions().map((host) => ({ value: host, label: host })),+ ],+ value: hostFilter,+ setValue: setHostFilter,+ defaultValue: '',+ },+ ];+ });+ const scopedRows = createMemo(() => {+ const host = hostFilter();+ const base = tableState.filtered();+ return host ? base.filter((resource) => dockerHostName(resource) === host) : base;+ });+ const hasActiveFilters = () => tableState.hasActiveFilters() || hostFilter() !== '';+ const resetFilters = () => {+ tableState.resetFilters();+ setHostFilter('');+ };+ const sortedRows = createMemo(() => [...scopedRows()].sort(compareDockerContainers));const drawer = createPlatformResourceDetailState({ idPrefix: 'docker-container-drawer' });const resolveResourceLabel = createPlatformResourceLabelResolver(() => props.resources);@@ -158,19 +203,23 @@ export const DockerContainersTable: Component<DockerNativeTableProps> = (props)status={tableState.status()}onStatusChange={tableState.setStatus}statusOptions={PLATFORM_HEALTH_FILTER_OPTIONS}- visible={tableState.visible()}+ filters={scopeFilters()}+ savedViewsKey="docker-containers"+ visible={scopedRows().length}total={tableState.total()}rowNoun="containers"+ hasActiveFilters={hasActiveFilters()}+ onResetFilters={resetFilters}/></Show><Show- when={tableState.filtered().length > 0}+ when={scopedRows().length > 0}fallback={<PlatformTableEmptyStateicon={props.emptyIcon}title="No containers match current filters"- description="Adjust the search or status filter to see more Docker containers."+ description="Adjust the search, status, or host filter to see more Docker containers."/>}>diff --git a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsxindex a0c0b6d5bb..acc763601e 100644--- a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx+++ b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx@@ -1,4 +1,6 @@import { cleanup, fireEvent, render, screen } from '@solidjs/testing-library';+import { Route, Router } from '@solidjs/router';+import type { JSX } from 'solid-js';import { afterEach, describe, expect, it } from 'vitest';import type { Resource } from '@/types/resource';@@ -31,13 +33,22 @@ const makeResource = ({...overrides,});+// DockerContainersTable URL-backs its host scope filter (useSearchParams), so+// it must render inside a Router context.+const renderInRouter = (component: () => JSX.Element) =>+ render(() => (+ <Router>+ <Route path="/" component={component} />+ </Router>+ ));+afterEach(() => {cleanup();});describe('Docker native tables', () => {it('renders Docker container API fields', () => {- render(() => (+ renderInRouter(() => (<DockerContainersTableresources={[makeResource({@@ -97,7 +108,7 @@ describe('Docker native tables', () => {});it('renders container rows with status mapped from containerState + health + exitCode, attention rows first', () => {- render(() => (+ renderInRouter(() => (<DockerContainersTableresources={[makeResource({diff --git a/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts b/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.tsindex 9962d54db7..1d1d079f93 100644--- a/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts+++ b/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts@@ -183,7 +183,11 @@ describe('platform overview layout guardrails', () => {expect(source).toContain('PLATFORM_HEALTH_FILTER_OPTIONS');expect(source).not.toContain("from '@/components/shared/SearchInput'");expect(source).not.toContain("from '@/components/shared/FilterButtonGroup'");- expect(source).not.toContain('const [search');+ // Forbid a bespoke search signal (`const [search, setSearch] = createSignal`)+ // — tables must read search from createPlatformTableFilterState. The comma+ // keeps URL-backed scope state (`const [searchParams, ...] = useSearchParams`)+ // out of the net, since that is shared-FilterBar plumbing, not a rogue box.+ expect(source).not.toContain('const [search, ');}});diff --git a/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx b/frontend-modern/src/features/platformPage/sharedPlatformPage.tsxindex b7df3e0b85..15e3e6e2c7 100644--- a/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx+++ b/frontend-modern/src/features/platformPage/sharedPlatformPage.tsx@@ -347,6 +347,13 @@ export function PlatformTableToolbar<T extends string | number>(props: {rowNoun: string;hasActiveFilters?: boolean;onResetFilters?: () => void;+ // Optional scope filters (host / node / namespace / pool ...) appended after+ // the status facet, plus an optional saved-views storage key. Tables opt into+ // richer combinable filtering without bypassing the shared toolbar; the+ // status facet stays the inline segmented control and scope filters render as+ // chips behind "+ Filter".+ filters?: FilterDef[];+ savedViewsKey?: string;}) {const { isMobile } = useBreakpoint();@@ -356,7 +363,7 @@ export function PlatformTableToolbar<T extends string | number>(props: {// 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[] = [+ const allFilters: FilterDef[] = [{id: 'status',label: 'Status',@@ -381,6 +388,7 @@ export function PlatformTableToolbar<T extends string | number>(props: {},defaultValue: String(props.statusOptions[0]?.value ?? 'all'),},+ ...(props.filters ?? []),];return (@@ -394,7 +402,8 @@ export function PlatformTableToolbar<T extends string | number>(props: {emptyMessage: props.searchHistory?.emptyMessage,tips: props.searchTips,}}- filters={filters}+ filters={allFilters}+ savedViewsKey={props.savedViewsKey}viewOptionsTrailing={<PlatformResourceCountervisible={props.visible}