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
Restore grouped-by-host view and web links on Docker containers
rcourtmand5c4f9adf35a
diff --git a/frontend-modern/src/features/docker/DockerContainersTable.tsx b/frontend-modern/src/features/docker/DockerContainersTable.tsxindex bbe4df1c83..6e1ca4ddf6 100644--- a/frontend-modern/src/features/docker/DockerContainersTable.tsx+++ b/frontend-modern/src/features/docker/DockerContainersTable.tsx@@ -2,7 +2,20 @@ import { For, Show, createMemo, type Component, type JSX } from 'solid-js';import { useSearchParams } from '@solidjs/router';import type { FilterDef } from '@/components/shared/FilterBar';import { UpdateButton } from '@/components/shared/ContainerUpdateBadge';+import {+ GroupedTableModeSegmentedControl,+ type GroupedTableMode,+} from '@/components/shared/GroupedTableModeSegmentedControl';+import {+ GROUPED_TABLE_ROW_BADGE_CLASS,+ getGroupedTableRowCellClass,+ getGroupedTableRowClass,+} from '@/components/shared/groupedTableRowPresentation';import { ResponsiveMetricCell } from '@/components/shared/responsive';+import { StatusDot } from '@/components/shared/StatusDot';+import { WebInterfaceNameLink } from '@/components/shared/WebInterfaceNameLink';+import { usePersistentSignal } from '@/hooks/usePersistentSignal';+import { getSimpleStatusIndicator } from '@/utils/status';import { StackedMemoryBar } from '@/components/Workloads/StackedMemoryBar';import { getWorkloadTableLayoutMode } from '@/components/Workloads/guestRowModel';import { useBreakpoint } from '@/hooks/useBreakpoint';@@ -58,6 +71,15 @@ type DockerMount = NonNullable<NonNullable<Resource['docker']>['mounts']>[numbertype DockerContainersTableProps = DockerNativeTableProps & {onLifecycleActionSettled?: () => void | Promise<void>;+ // Host resources backing the group headers in grouped mode: they carry the+ // host's status and custom web-interface URL, which container rows do not.+ hosts?: Resource[];+};++type DockerContainerHostGroup = {+ host: string;+ hostResource?: Resource;+ rows: Resource[];};const networkLabel = (network: DockerNetwork): string => {@@ -278,6 +300,43 @@ export const DockerContainersTable: Component<DockerContainersTableProps> = (pro{ replace: true },);const sortedRows = createMemo(() => [...scopedRows()].sort(compareDockerContainers));+ // Grouped-by-host view, mirroring the workloads table: preference persists+ // locally (not in the URL) and only applies once the fleet spans more than+ // one host; a single-host list gains nothing from a group header.+ const [groupingModePreference, setGroupingModePreference] =+ usePersistentSignal<GroupedTableMode>('dockerContainersGroupingMode', 'grouped', {+ deserialize: (raw) => (raw === 'grouped' || raw === 'flat' ? raw : 'grouped'),+ });+ const isGroupable = createMemo(() => hostOptions().length > 1);+ const groupingMode = createMemo<GroupedTableMode>(() =>+ isGroupable() ? groupingModePreference() : 'flat',+ );+ const hostResourceByName = createMemo(() => {+ const map = new Map<string, Resource>();+ for (const hostResource of props.hosts ?? []) {+ const keys = [+ dockerHostName(hostResource),+ asTrimmedString(hostResource.name) ?? '',+ asTrimmedString(hostResource.displayName) ?? '',+ ];+ for (const key of keys) {+ if (key && key !== '—' && !map.has(key)) map.set(key, hostResource);+ }+ }+ return map;+ });+ const groupedRows = createMemo<DockerContainerHostGroup[]>(() => {+ const groups = new Map<string, Resource[]>();+ for (const resource of sortedRows()) {+ const host = dockerHostName(resource);+ const rows = groups.get(host);+ if (rows) rows.push(resource);+ else groups.set(host, [resource]);+ }+ return [...groups.entries()]+ .sort(([a], [b]) => a.localeCompare(b))+ .map(([host, rows]) => ({ host, hostResource: hostResourceByName().get(host), rows }));+ });// Runtime is host-level data repeated on every container row; it only// informs when the fleet actually mixes runtimes (docker vs podman).const showRuntimeColumn = createMemo(() => {@@ -313,6 +372,271 @@ export const DockerContainersTable: Component<DockerContainersTableProps> = (proconst drawer = createPlatformResourceDetailState({ idPrefix: 'docker-container-drawer' });const resolveResourceLabel = createPlatformResourceLabelResolver(() => props.resources);+ const renderContainerRow = (resource: Resource): JSX.Element => {+ const indicator = mapDockerContainerStatus(resource);+ const image = () => dockerTextValue(resource.docker?.image);+ const state = () => containerState(resource);+ const runtime = () => runtimeSummary(resource);+ const host = () => dockerHostName(resource);+ const running = () => isContainerRunning(resource);+ const metricsKey = () => buildMetricKeyForUnifiedResource(resource);+ const cpuPercent = () => getPlatformTableFiniteMetric(resource.cpu?.current);+ const memoryUsed = () =>+ getPlatformTableFiniteMetric(resource.memory?.used) ?? 0;+ const memoryTotal = () =>+ getPlatformTableFiniteMetric(resource.memory?.total) ?? 0;+ const memoryPercentOnly = () =>+ memoryTotal() > 0+ ? undefined+ : getPlatformTableFiniteMetric(resource.memory?.current);+ const hasMemoryMetric = () =>+ memoryTotal() > 0 || memoryPercentOnly() !== undefined;+ const restartCount = () => resource.docker?.restartCount ?? 0;+ const ports = () => dockerContainerPortsSummary(resource);+ const networks = () => networksSummary(resource);+ const mounts = () => mountsSummary(resource);+ const updates = () => updateStatusLabel(resource);+ const updateTitle = () => updateStatusTitle(resource);+ const action = containerUpdateAction(resource);+ const detailRowId = () => drawer.detailRowId(resource);+ const isExpanded = () => drawer.isExpanded(resource);+ const renderColumnCell = (column: DockerContainerTableColumn): JSX.Element => {+ switch (column.id) {+ case 'container':+ return (+ <DockerResourceNameCell+ resource={resource}+ indicator={indicator}+ detailToggle={+ <PlatformResourceDetailToggleButton+ expanded={isExpanded()}+ resourceLabel={dockerResourceName(resource)}+ controlsId={detailRowId()}+ onToggle={() => drawer.toggle(resource)}+ />+ }+ />+ );+ case 'host':+ return (+ <TableCell+ class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}+ >+ <span class="block max-w-full truncate" title={host()}>+ {host()}+ </span>+ </TableCell>+ );+ case 'runtime':+ return (+ <TableCell+ class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}+ >+ <span class="block max-w-full truncate" title={runtime()}>+ {runtime()}+ </span>+ </TableCell>+ );+ case 'image':+ return (+ <TableCell+ class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}+ >+ <span class="block max-w-full truncate" title={image()}>+ {image()}+ </span>+ </TableCell>+ );+ case 'state':+ return (+ <TableCell+ class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}+ >+ <span class="block max-w-full truncate" title={state()}>+ {state()}+ </span>+ </TableCell>+ );+ case 'cpu':+ return (+ <TableCell class={getPlatformTableCellClassForKind(column.kind)}>+ <ResponsiveMetricCell+ class="w-full"+ value={cpuPercent() ?? 0}+ type="cpu"+ resourceId={metricsKey()}+ isRunning={running() && cpuPercent() !== undefined}+ showMobile={false}+ />+ </TableCell>+ );+ case 'memory':+ return (+ <TableCell class={getPlatformTableCellClassForKind(column.kind)}>+ <Show+ when={running() && hasMemoryMetric()}+ fallback={<PlatformTableMetricFallback />}+ >+ <StackedMemoryBar+ used={memoryUsed()}+ total={memoryTotal()}+ percentOnly={memoryPercentOnly()}+ />+ </Show>+ </TableCell>+ );+ case 'restarts':+ return (+ <TableCell+ class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}+ >+ <Show+ when={typeof resource.docker?.restartCount === 'number'}+ fallback={<span>—</span>}+ >+ <span+ class={`tabular-nums ${+ restartCount() > RESTART_ATTENTION_THRESHOLD+ ? 'font-medium text-red-600 dark:text-red-400'+ : ''+ }`}+ >+ {resource.docker?.restartCount}+ </span>+ </Show>+ </TableCell>+ );+ case 'ports':+ return (+ <TableCell+ class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}+ >+ <span+ class="block max-w-full truncate font-mono text-[11px]"+ title={ports()}+ >+ {ports()}+ </span>+ </TableCell>+ );+ case 'networks':+ return (+ <TableCell+ class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}+ >+ <span class="block max-w-full truncate" title={networks()}>+ {networks()}+ </span>+ </TableCell>+ );+ case 'mounts':+ return (+ <TableCell+ class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}+ >+ <span class="block max-w-full truncate" title={mounts()}>+ {mounts()}+ </span>+ </TableCell>+ );+ case 'updates':+ return (+ <TableCell+ class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}+ >+ <Show+ when={action}+ fallback={+ <span class="block max-w-full truncate" title={updateTitle()}>+ {updates()}+ </span>+ }+ >+ {(updateAction) => (+ <UpdateButton+ agentId={updateAction().agentId}+ containerId={updateAction().containerId}+ containerName={updateAction().containerName}+ updateStatus={updateAction().updateStatus}+ />+ )}+ </Show>+ </TableCell>+ );+ case 'actions':+ return (+ <TableCell class={getPlatformTableCellClassForKind(column.kind)}>+ <DockerContainerLifecycleControls+ resource={resource}+ onActionSettled={props.onLifecycleActionSettled}+ />+ </TableCell>+ );+ default:+ column.id satisfies never;+ return <></>;+ }+ };++ return (+ <>+ <TableRow+ class={`${getPlatformResourceDetailRowClass(isExpanded())} text-[11px] sm:text-xs`}+ aria-controls={isExpanded() ? detailRowId() : undefined}+ aria-expanded={isExpanded() ? 'true' : 'false'}+ data-docker-container-row={resource.id}+ onClick={() => drawer.toggle(resource)}+ onKeyDown={drawer.handleActivationKey(resource)}+ tabIndex={0}+ >+ <For each={visibleColumns()}>{(column) => renderColumnCell(column)}</For>+ </TableRow>+ <PlatformResourceDetailTableRow+ resource={resource}+ open={isExpanded()}+ detailRowId={detailRowId()}+ colSpan={drawerColSpan()}+ resolveResourceLabel={resolveResourceLabel}+ onClose={() => drawer.close(resource)}+ onResourceActionSettled={props.onLifecycleActionSettled}+ />+ </>+ );+ };++ const renderHostGroupHeader = (group: DockerContainerHostGroup): JSX.Element => {+ const indicator = group.hostResource+ ? getSimpleStatusIndicator(group.hostResource.status)+ : undefined;+ return (+ <TableRow class={getGroupedTableRowClass()} data-docker-host-group={group.host}>+ <TableCell class={getGroupedTableRowCellClass()} colspan={visibleColumns().length}>+ <div class="flex min-w-0 items-center gap-2">+ <Show when={indicator}>+ {(hostIndicator) => (+ <StatusDot+ size="sm"+ variant={hostIndicator().variant}+ title={hostIndicator().label}+ ariaHidden+ />+ )}+ </Show>+ <WebInterfaceNameLink+ name={group.host}+ url={group.hostResource?.customUrl}+ class="truncate text-blue-600 hover:text-blue-700 hover:underline dark:text-blue-400 dark:hover:text-blue-300"+ fallbackClass="truncate"+ />+ <span class={GROUPED_TABLE_ROW_BADGE_CLASS}>+ {group.rows.length} {group.rows.length === 1 ? 'container' : 'containers'}+ </span>+ </div>+ </TableCell>+ </TableRow>+ );+ };+return (<Showwhen={props.resources.length > 0}@@ -341,6 +665,14 @@ export const DockerContainersTable: Component<DockerContainersTableProps> = (prorowNoun="containers"hasActiveFilters={hasActiveFilters()}onResetFilters={resetFilters}+ viewOptionsTrailing={+ <Show when={isGroupable()}>+ <GroupedTableModeSegmentedControl+ value={groupingMode()}+ onChange={setGroupingModePreference}+ />+ </Show>+ }/></Show>@@ -387,241 +719,19 @@ export const DockerContainersTable: Component<DockerContainersTableProps> = (pro</>}body={- <>- <For each={sortedRows()}>- {(resource) => {- const indicator = mapDockerContainerStatus(resource);- const image = () => dockerTextValue(resource.docker?.image);- const state = () => containerState(resource);- const runtime = () => runtimeSummary(resource);- const host = () => dockerHostName(resource);- const running = () => isContainerRunning(resource);- const metricsKey = () => buildMetricKeyForUnifiedResource(resource);- const cpuPercent = () => getPlatformTableFiniteMetric(resource.cpu?.current);- const memoryUsed = () =>- getPlatformTableFiniteMetric(resource.memory?.used) ?? 0;- const memoryTotal = () =>- getPlatformTableFiniteMetric(resource.memory?.total) ?? 0;- const memoryPercentOnly = () =>- memoryTotal() > 0- ? undefined- : getPlatformTableFiniteMetric(resource.memory?.current);- const hasMemoryMetric = () =>- memoryTotal() > 0 || memoryPercentOnly() !== undefined;- const restartCount = () => resource.docker?.restartCount ?? 0;- const ports = () => dockerContainerPortsSummary(resource);- const networks = () => networksSummary(resource);- const mounts = () => mountsSummary(resource);- const updates = () => updateStatusLabel(resource);- const updateTitle = () => updateStatusTitle(resource);- const action = containerUpdateAction(resource);- const detailRowId = () => drawer.detailRowId(resource);- const isExpanded = () => drawer.isExpanded(resource);- const renderColumnCell = (column: DockerContainerTableColumn): JSX.Element => {- switch (column.id) {- case 'container':- return (- <DockerResourceNameCell- resource={resource}- indicator={indicator}- detailToggle={- <PlatformResourceDetailToggleButton- expanded={isExpanded()}- resourceLabel={dockerResourceName(resource)}- controlsId={detailRowId()}- onToggle={() => drawer.toggle(resource)}- />- }- />- );- case 'host':- return (- <TableCell- class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}- >- <span class="block max-w-full truncate" title={host()}>- {host()}- </span>- </TableCell>- );- case 'runtime':- return (- <TableCell- class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}- >- <span class="block max-w-full truncate" title={runtime()}>- {runtime()}- </span>- </TableCell>- );- case 'image':- return (- <TableCell- class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}- >- <span class="block max-w-full truncate" title={image()}>- {image()}- </span>- </TableCell>- );- case 'state':- return (- <TableCell- class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}- >- <span class="block max-w-full truncate" title={state()}>- {state()}- </span>- </TableCell>- );- case 'cpu':- return (- <TableCell class={getPlatformTableCellClassForKind(column.kind)}>- <ResponsiveMetricCell- class="w-full"- value={cpuPercent() ?? 0}- type="cpu"- resourceId={metricsKey()}- isRunning={running() && cpuPercent() !== undefined}- showMobile={false}- />- </TableCell>- );- case 'memory':- return (- <TableCell class={getPlatformTableCellClassForKind(column.kind)}>- <Show- when={running() && hasMemoryMetric()}- fallback={<PlatformTableMetricFallback />}- >- <StackedMemoryBar- used={memoryUsed()}- total={memoryTotal()}- percentOnly={memoryPercentOnly()}- />- </Show>- </TableCell>- );- case 'restarts':- return (- <TableCell- class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}- >- <Show- when={typeof resource.docker?.restartCount === 'number'}- fallback={<span>—</span>}- >- <span- class={`tabular-nums ${- restartCount() > RESTART_ATTENTION_THRESHOLD- ? 'font-medium text-red-600 dark:text-red-400'- : ''- }`}- >- {resource.docker?.restartCount}- </span>- </Show>- </TableCell>- );- case 'ports':- return (- <TableCell- class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}- >- <span- class="block max-w-full truncate font-mono text-[11px]"- title={ports()}- >- {ports()}- </span>- </TableCell>- );- case 'networks':- return (- <TableCell- class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}- >- <span class="block max-w-full truncate" title={networks()}>- {networks()}- </span>- </TableCell>- );- case 'mounts':- return (- <TableCell- class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}- >- <span class="block max-w-full truncate" title={mounts()}>- {mounts()}- </span>- </TableCell>- );- case 'updates':- return (- <TableCell- class={`${getPlatformTableCellClassForKind(column.kind)} text-base-content`}- >- <Show- when={action}- fallback={- <span class="block max-w-full truncate" title={updateTitle()}>- {updates()}- </span>- }- >- {(updateAction) => (- <UpdateButton- agentId={updateAction().agentId}- containerId={updateAction().containerId}- containerName={updateAction().containerName}- updateStatus={updateAction().updateStatus}- />- )}- </Show>- </TableCell>- );- case 'actions':- return (- <TableCell class={getPlatformTableCellClassForKind(column.kind)}>- <DockerContainerLifecycleControls- resource={resource}- onActionSettled={props.onLifecycleActionSettled}- />- </TableCell>- );- default:- column.id satisfies never;- return <></>;- }- };-- return (- <>- <TableRow- class={`${getPlatformResourceDetailRowClass(isExpanded())} text-[11px] sm:text-xs`}- aria-controls={isExpanded() ? detailRowId() : undefined}- aria-expanded={isExpanded() ? 'true' : 'false'}- data-docker-container-row={resource.id}- onClick={() => drawer.toggle(resource)}- onKeyDown={drawer.handleActivationKey(resource)}- tabIndex={0}- >- <For each={visibleColumns()}>{(column) => renderColumnCell(column)}</For>- </TableRow>- <PlatformResourceDetailTableRow- resource={resource}- open={isExpanded()}- detailRowId={detailRowId()}- colSpan={drawerColSpan()}- resolveResourceLabel={resolveResourceLabel}- onClose={() => drawer.close(resource)}- onResourceActionSettled={props.onLifecycleActionSettled}- />- </>- );- }}+ <Show+ when={groupingMode() === 'grouped'}+ fallback={<For each={sortedRows()}>{(resource) => renderContainerRow(resource)}</For>}+ >+ <For each={groupedRows()}>+ {(group) => (+ <>+ {renderHostGroupHeader(group)}+ <For each={group.rows}>{(resource) => renderContainerRow(resource)}</For>+ </>+ )}</For>- </>+ </Show>}/></Show>diff --git a/frontend-modern/src/features/docker/DockerNativeTableShared.tsx b/frontend-modern/src/features/docker/DockerNativeTableShared.tsxindex ca9bdf59bd..1f30739a70 100644--- a/frontend-modern/src/features/docker/DockerNativeTableShared.tsx+++ b/frontend-modern/src/features/docker/DockerNativeTableShared.tsx@@ -1,6 +1,7 @@import { type Component, type JSX } from 'solid-js';import { StatusDot } from '@/components/shared/StatusDot';import { TableCell } from '@/components/shared/Table';+import { WebInterfaceNameLink } from '@/components/shared/WebInterfaceNameLink';import { getSimpleStatusIndicator, type StatusIndicator } from '@/utils/status';import { asTrimmedString } from '@/utils/stringUtils';import {@@ -83,9 +84,12 @@ export const DockerResourceNameCell: Component<{title={resolvedIndicator().label}ariaHidden/>- <span class="truncate font-semibold text-base-content" title={name()}>- {name()}- </span>+ <WebInterfaceNameLink+ name={name()}+ url={props.resource.customUrl}+ class="truncate font-semibold text-blue-600 hover:text-blue-700 hover:underline dark:text-blue-400 dark:hover:text-blue-300"+ fallbackClass="truncate font-semibold text-base-content"+ /></div></TableCell>);diff --git a/frontend-modern/src/features/docker/DockerPageSurface.tsx b/frontend-modern/src/features/docker/DockerPageSurface.tsxindex 394c58fec7..227e870885 100644--- a/frontend-modern/src/features/docker/DockerPageSurface.tsx+++ b/frontend-modern/src/features/docker/DockerPageSurface.tsx@@ -357,6 +357,7 @@ function DockerOverview(props: {/><DockerContainersTableresources={props.containers}+ hosts={props.hosts}emptyIcon={dockerIcon()}emptyTitle="No Docker or Podman containers"emptyDescription="Containers appear here when a Docker or Podman host reports workload inventory."diff --git a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsxindex 3092b6e154..ae4720a401 100644--- a/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx+++ b/frontend-modern/src/features/docker/__tests__/DockerNativeTables.test.tsx@@ -140,6 +140,7 @@ const setViewportWidth = (width: number) => {afterEach(() => {window.history.pushState({}, '', '/');setViewportWidth(1024);+ window.localStorage.clear();cleanup();vi.clearAllMocks();});@@ -220,7 +221,9 @@ describe('Docker native tables', () => {expect(screen.queryByText('Health')).not.toBeInTheDocument();expect(screen.queryByText('State')).not.toBeInTheDocument();expect(screen.getByText('edge-web')).toBeInTheDocument();- expect(screen.getByText('edge-01')).toBeInTheDocument();+ // Multi-host fleets group by host by default, so the host name renders+ // twice: once in the group header row and once in the host column.+ expect(screen.getAllByText('edge-01')).toHaveLength(2);expect(screen.getByText('docker 27.5.1')).toBeInTheDocument();expect(screen.getByText('podman 5.2.1')).toBeInTheDocument();expect(screen.getByText('nginx:latest')).toBeInTheDocument();@@ -323,11 +326,146 @@ describe('Docker native tables', () => {));expect(screen.getByText('edge-cache')).toBeInTheDocument();- expect(screen.getByText('edge-02')).toBeInTheDocument();+ // Scoped to edge-02: group header + host column both show the host name.+ expect(screen.getAllByText('edge-02')).toHaveLength(2);expect(screen.queryByText('edge-web')).not.toBeInTheDocument();expect(screen.queryByText('edge-01')).not.toBeInTheDocument();});+ it('groups containers under host headers with counts and host web links', () => {+ const { container } = renderInRouter(() => (+ <DockerContainersTable+ resources={[+ makeResource({+ id: 'container-1',+ type: 'app-container',+ name: 'edge-web',+ status: 'running',+ docker: { hostname: 'edge-01', image: 'nginx:latest', containerState: 'running' },+ }),+ makeResource({+ id: 'container-2',+ type: 'app-container',+ name: 'edge-cache',+ status: 'running',+ docker: { hostname: 'edge-02', image: 'redis:7.4', containerState: 'running' },+ }),+ makeResource({+ id: 'container-3',+ type: 'app-container',+ name: 'edge-proxy',+ status: 'running',+ docker: { hostname: 'edge-01', image: 'traefik:v3', containerState: 'running' },+ }),+ ]}+ hosts={[+ makeResource({+ id: 'host-1',+ type: 'docker-host',+ name: 'edge-01',+ status: 'online',+ customUrl: 'https://edge-01.example:9443',+ docker: { hostname: 'edge-01' },+ }),+ ]}+ emptyIcon={<span />}+ emptyTitle="No containers"+ emptyDescription="No containers"+ showToolbar={false}+ />+ ));++ const headers = [...container.querySelectorAll('[data-docker-host-group]')];+ expect(headers.map((row) => row.getAttribute('data-docker-host-group'))).toEqual([+ 'edge-01',+ 'edge-02',+ ]);+ expect(within(headers[0] as HTMLElement).getByText('2 containers')).toBeInTheDocument();+ expect(within(headers[1] as HTMLElement).getByText('1 container')).toBeInTheDocument();+ // Host resource provides the group header's web interface link.+ const hostLink = within(headers[0] as HTMLElement).getByRole('link', {+ name: 'Open web interface for edge-01',+ });+ expect(hostLink).toHaveAttribute('href', 'https://edge-01.example:9443');+ });++ it('renders a flat list when only one host is present', () => {+ const { container } = renderInRouter(() => (+ <DockerContainersTable+ resources={[+ makeResource({+ id: 'container-1',+ type: 'app-container',+ name: 'edge-web',+ status: 'running',+ docker: { hostname: 'edge-01', image: 'nginx:latest', containerState: 'running' },+ }),+ ]}+ emptyIcon={<span />}+ emptyTitle="No containers"+ emptyDescription="No containers"+ showToolbar={false}+ />+ ));++ expect(container.querySelector('[data-docker-host-group]')).toBeNull();+ });++ it('honors a persisted flat preference for multi-host fleets', () => {+ window.localStorage.setItem('dockerContainersGroupingMode', 'flat');++ const { container } = renderInRouter(() => (+ <DockerContainersTable+ resources={[+ makeResource({+ id: 'container-1',+ type: 'app-container',+ name: 'edge-web',+ status: 'running',+ docker: { hostname: 'edge-01', image: 'nginx:latest', containerState: 'running' },+ }),+ makeResource({+ id: 'container-2',+ type: 'app-container',+ name: 'edge-cache',+ status: 'running',+ docker: { hostname: 'edge-02', image: 'redis:7.4', containerState: 'running' },+ }),+ ]}+ emptyIcon={<span />}+ emptyTitle="No containers"+ emptyDescription="No containers"+ showToolbar={false}+ />+ ));++ expect(container.querySelector('[data-docker-host-group]')).toBeNull();+ });++ it('links the container name to its custom web interface URL', () => {+ renderInRouter(() => (+ <DockerContainersTable+ resources={[+ makeResource({+ id: 'container-1',+ type: 'app-container',+ name: 'edge-web',+ status: 'running',+ customUrl: 'http://edge-01.example:8080',+ docker: { hostname: 'edge-01', image: 'nginx:latest', containerState: 'running' },+ }),+ ]}+ emptyIcon={<span />}+ emptyTitle="No containers"+ emptyDescription="No containers"+ showToolbar={false}+ />+ ));++ const nameLink = screen.getByRole('link', { name: 'Open web interface for edge-web' });+ expect(nameLink).toHaveAttribute('href', 'http://edge-01.example:8080');+ });+it('applies the URL search filter, including -term exclusions, to container rows', () => {window.history.pushState({}, '', '/?q=-redis');