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.

Let Docker and vSphere host rows show their workloads

[email protected]3745f4738d2f
diff --git a/docs/release-control/v6/internal/subsystems/frontend-primitives.md b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
index 93ac4e6dcd..1a5a9969c6 100644
--- a/docs/release-control/v6/internal/subsystems/frontend-primitives.md
+++ b/docs/release-control/v6/internal/subsystems/frontend-primitives.md
@@ -10065,3 +10065,14 @@ table nested in a drawer row). A value that must wrap sets the wrap on its own
element inside the cell, as `DetailSectionTable` does with
`block whitespace-normal`; the Coverage drawer's restore evidence Location and
Details values now follow that pattern.
+
+`PlatformHostScope.tsx` owns the host-to-workload scope interaction for
+platform overviews: `PlatformHostScopeNameButton` (the host name as a pressed
+toggle naming the workload section it controls), `PlatformHostScopedTableTitle`
+("<Workloads> on <host>" with its count and the clear button) and
+`createPlatformHostScopeFocus` (selecting a host focuses and reveals that
+heading). The Proxmox, Docker and vSphere overviews use them, so the three stay
+one shape. A host table that scopes keeps its details chevron on phones and
+takes the `platform-table-mobile-w-38` identity column (Uptime drops to 10%),
+the same allowance the Proxmox node column has for the toggle and dot before
+the name.
diff --git a/docs/release-control/v6/internal/subsystems/storage-recovery.md b/docs/release-control/v6/internal/subsystems/storage-recovery.md
index cb869ddc44..61df861998 100644
--- a/docs/release-control/v6/internal/subsystems/storage-recovery.md
+++ b/docs/release-control/v6/internal/subsystems/storage-recovery.md
@@ -7153,3 +7153,8 @@ wrap is set on each value's span, because the global `.table-fixed td` rule
forces nowrap on table cells and outranks a utility class on the cell itself,
which left a long snapshot description cut off at the drawer edge. Coverage,
restore evidence and recovery rules are unchanged.
+
+The Proxmox page surface's Overview guest heading ("Guests on <node>", Show all
+nodes) now renders through the shared `PlatformHostScopedTableTitle` that the
+Docker and vSphere overviews also use; its Storage, Replication, Backups, Ceph
+and Mail Gateway tabs, and every storage and recovery rule, are unchanged.
diff --git a/docs/release-control/v6/internal/subsystems/unified-resources.md b/docs/release-control/v6/internal/subsystems/unified-resources.md
index 96ebbaa58a..d90ab9d9b8 100644
--- a/docs/release-control/v6/internal/subsystems/unified-resources.md
+++ b/docs/release-control/v6/internal/subsystems/unified-resources.md
@@ -8673,3 +8673,18 @@ The Proxmox Coverage drawer's restore evidence values (location and details)
wrap on their own spans rather than through the table cell, so a long snapshot
description no longer runs past the drawer edge. No resource identity, status
or recovery rule changes.
+
+A platform overview's host table narrows the workloads below it on every
+platform that pairs the two: a Proxmox node row shows its guests, a Docker
+host row its containers and a vSphere host row its VMs, and a second click or
+"Show all nodes" / "Show all hosts" clears it; the row's chevron alone opens
+the host drawer, and stays visible on phones. Docker scopes through the URL
+host filter its containers table already reads (`?host=`, the host's Docker
+hostname); every host stays listed and the scoped one is marked, where that
+filter used to hide the other hosts. A vSphere host scopes the shared workload
+table to the scope that table already gave one of its own VMs
+(`getVsphereHostWorkloadScope`), the VMs matched to the host by managed object
+ID within its vCenter connection so two vCenters' `host-12` stay apart; a host
+with no VMs gets a scope that names it and matches none. A host table with no
+workloads under it (Docker Swarm hosts) keeps opening the drawer on a row
+click. No resource identity, status or alert rule changes.
diff --git a/frontend-modern/browser-verification/9f5eb078b861fbf7.json b/frontend-modern/browser-verification/9f5eb078b861fbf7.json
new file mode 100644
index 0000000000..b35e93bfbc
--- /dev/null
+++ b/frontend-modern/browser-verification/9f5eb078b861fbf7.json
@@ -0,0 +1,67 @@
+{
+ "version": 1,
+ "base_sha": "904f1104bee17422eb532b9268ff96aa651a8fa7",
+ "verified_at": "2026-10-22T21:11:51Z",
+ "result": "passed",
+ "changed_paths": [
+ "frontend-modern/src/features/docker/DockerHostsTable.tsx",
+ "frontend-modern/src/features/docker/DockerNativeTableShared.tsx",
+ "frontend-modern/src/features/docker/DockerPageSurface.tsx",
+ "frontend-modern/src/features/platformPage/PlatformHostScope.tsx",
+ "frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx",
+ "frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx",
+ "frontend-modern/src/features/vmware/VmwarePageSurface.tsx",
+ "frontend-modern/src/features/vmware/VsphereHostsTable.tsx",
+ "frontend-modern/src/features/vmware/vmwarePageModel.ts",
+ "frontend-modern/src/index.css"
+ ],
+ "content_sha256": {
+ "frontend-modern/src/features/docker/DockerHostsTable.tsx": "e6b82c648c0a9dc4154d58fdd2fe99e43f033e7c163c62557d855a33428d16dc",
+ "frontend-modern/src/features/docker/DockerNativeTableShared.tsx": "99554f4a35b165c339d251890e16a54b9cbc20219e8ed9ca22024d4997886547",
+ "frontend-modern/src/features/docker/DockerPageSurface.tsx": "195b155becb585c139b499b5cd169a8bbd1ab21f5f6189806d516693d42e3d42",
+ "frontend-modern/src/features/platformPage/PlatformHostScope.tsx": "5d4aa1d431d93f9791edd010bc3a3bba949a48ac5a154d7481b3e68a693fb29f",
+ "frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx": "db841c1d850ac51e52d748c11837019fee7fb5d975d282eda454cc393618c479",
+ "frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx": "ca4fc9c0a4a5d2124a3f1541de136d38f983f47ef46cf20c14b78ab8d4d52803",
+ "frontend-modern/src/features/vmware/VmwarePageSurface.tsx": "b32138e2cec74be61b2033a5391ab94791dfb3293d84f32742ae31f602edd91e",
+ "frontend-modern/src/features/vmware/VsphereHostsTable.tsx": "c9affc83e46373ff84588ce2227e4d83a3aa98b5e8c6d7faf902967857cb13ad",
+ "frontend-modern/src/features/vmware/vmwarePageModel.ts": "a86f7a89f9413be9e23bf1495b687f2334a4995f212104c8facfe869b00ae380",
+ "frontend-modern/src/index.css": "e4bcbb8ce98db36428e22f0bbedf2a6a056359a05f232c84f04343f8b6a72a8a"
+ },
+ "routes": [
+ "/proxmox/overview",
+ "/docker/overview",
+ "/vmware/overview",
+ "/docker/swarm"
+ ],
+ "viewports": [
+ {
+ "width": 1440,
+ "height": 900
+ },
+ {
+ "width": 390,
+ "height": 844
+ }
+ ],
+ "states": [
+ "Embedded production build of this change on the full mock estate, signed in through the real login",
+ "Proxmox: clicking a node row narrows the guests from 58 rows to that node's 3, marks the row, titles the table \"Guests on London Edge Standalone\" and moves focus to that heading; unchanged from main",
+ "Docker: clicking a host row sets ?host=auth-service-01, keeps all 7 hosts listed with that row marked, adds the Host chip, narrows the containers from 82 rows to 5 and titles them \"Containers on auth-service-01\" with Show all hosts",
+ "vSphere: clicking a host row sets the workload host scope, keeps all 7 hosts listed with that row marked, narrows the VMs from 25 rows to esxi-02's group and titles them \"VMs on esxi-02.lab.local 1\"",
+ "On every platform the row chevron opens the host drawer without changing the scope, Show all clears the scope and refocuses the heading, and phones keep the chevron visible",
+ "At 390px the Docker and vSphere host names stay readable (App Platfor..., esxi-01.lab.l...) after the chevron is added",
+ "Docker Swarm tab: its host table has no containers under it, so a row click still opens the host drawer and no scope buttons render",
+ "No console or page errors at either width"
+ ],
+ "interactions": [
+ "Row click on a host scopes the workload table; a second click on the same host clears it",
+ "Chevron click opens and closes the host drawer",
+ "Show all hosts / Show all nodes clears the scope"
+ ],
+ "browser": {
+ "client": "playwright 1.62.1",
+ "engine": "Chromium",
+ "version": "chromium-1234 headless"
+ },
+ "scope": "Full authenticated application on a mock estate; mock data, not live provider connections."
+}
diff --git a/frontend-modern/src/__tests__/App.architecture.test.ts b/frontend-modern/src/__tests__/App.architecture.test.ts
index 1d82003bf8..6f4235147f 100644
--- a/frontend-modern/src/__tests__/App.architecture.test.ts
+++ b/frontend-modern/src/__tests__/App.architecture.test.ts
@@ -748,6 +748,7 @@ describe('App architecture', () => {
expect(appStylesSource).toContain('container-type: inline-size');
expect(appStylesSource).toContain('.table-fixed.platform-table th.platform-table-name-column');
expect(appStylesSource).toContain('th.platform-table-mobile-w-10');
+ expect(appStylesSource).toContain('th.platform-table-mobile-w-38');
expect(appStylesSource).toMatch(/th\.platform-table-name-column\s*\{\s*width:\s*30%;\s*\}/);
expect(appStylesSource).toContain('@container (min-width: 72rem)');
expect(appStylesSource).toContain('.hidden.md\\:table-cell');
diff --git a/frontend-modern/src/features/docker/DockerHostsTable.tsx b/frontend-modern/src/features/docker/DockerHostsTable.tsx
index 0c798eb6f6..eb19a93a1d 100644
--- a/frontend-modern/src/features/docker/DockerHostsTable.tsx
+++ b/frontend-modern/src/features/docker/DockerHostsTable.tsx
@@ -35,7 +35,11 @@ import {
type PlatformTableSortValue,
withPlatformStatusCounts,
} from '@/features/platformPage/sharedPlatformPage';
-import { PlatformResourceDetailToggleButton } from '@/features/platformPage/PlatformResourceDetailTableRow';
+import {
+ PlatformResourceDetailToggleButton,
+ getPlatformResourceDetailRowInteractionProps,
+} from '@/features/platformPage/PlatformResourceDetailTableRow';
+import { PlatformHostScopeNameButton } from '@/features/platformPage/PlatformHostScope';
import type { Disk } from '@/types/api';
import type { Resource } from '@/types/resource';
import {
@@ -170,6 +174,15 @@ export const DockerHostsTable: Component<{
title?: JSX.Element;
actions?: JSX.Element;
showToolbar?: boolean;
+ /**
+ * When set, a row click narrows the page's container table to that host
+ * (as on the Proxmox overview) and the chevron alone opens the host's drawer.
+ */
+ containerScope?: {
+ sectionId: string;
+ isSelected: (host: Resource) => boolean;
+ onShow: (host: Resource) => void;
+ };
}> = (props) => {
const { activeAlerts } = useWebSocket();
const alertsActivation = useAlertsActivation();
@@ -192,6 +205,12 @@ export const DockerHostsTable: Component<{
);
const hasFilteredSourceRows = () => (props.sourceCount ?? props.resources.length) > 0;
+ // A scoping table keeps the details chevron on phones, so the host column
+ // takes the width Uptime does not need.
+ const phoneWidths = () =>
+ props.containerScope
+ ? { host: 'platform-table-mobile-w-38', uptime: 'platform-table-mobile-w-10' }
+ : { host: 'platform-table-mobile-w-30', uptime: 'platform-table-mobile-w-20' };
return (
<Show
@@ -254,7 +273,7 @@ export const DockerHostsTable: Component<{
kind="name"
sort={sort}
sortKey="host"
- class="platform-table-mobile-w-30 md:w-[13%]"
+ class={`${phoneWidths().host} md:w-[13%]`}
>
Host
</PlatformSortableTableHead>
@@ -311,7 +330,7 @@ export const DockerHostsTable: Component<{
kind="numeric-value"
sort={sort}
sortKey="uptime"
- class="platform-table-mobile-w-20 w-[20%] min-[360px]:w-[11%] sm:hidden md:table-cell md:w-[6%]"
+ class={`${phoneWidths().uptime} w-[20%] min-[360px]:w-[11%] sm:hidden md:table-cell md:w-[6%]`}
>
<PlatformResponsiveTableLabel compact="Up" full="Uptime" />
</PlatformSortableTableHead>
@@ -374,6 +393,13 @@ export const DockerHostsTable: Component<{
const isSelected = () => selectedHostId() === host.id;
const toggleDrawer = () =>
setSelectedHostId((current) => (current === host.id ? null : host.id));
+ const isContainerScopeSelected = () =>
+ props.containerScope?.isSelected(host) ?? false;
+ const rowInteraction = getPlatformResourceDetailRowInteractionProps({
+ expanded: false,
+ onToggle: () =>
+ props.containerScope ? props.containerScope.onShow(host) : toggleDrawer(),
+ });
// The same open alerts the host's drawer lists: Docker alerts
// are keyed on the Docker host id and carry the hostname, so
// matching the row's id or display name finds none of them.
@@ -399,14 +425,18 @@ export const DockerHostsTable: Component<{
isSelected() ? 'bg-surface-hover' : hostAlertBg()
}`}
data-docker-host-row={host.id}
- onClick={toggleDrawer}
+ data-summary-row-active={isContainerScopeSelected() ? 'true' : undefined}
+ onClick={rowInteraction.onClick}
>
<TableCell class={getPlatformTableCellClassForKind('name')}>
- <div class="flex min-w-0 items-center gap-2">
+ <div
+ class={`flex min-w-0 items-center ${props.containerScope ? 'gap-1 sm:gap-2' : 'gap-2'}`}
+ >
<PlatformResourceDetailToggleButton
expanded={isSelected()}
resourceLabel={name()}
controlsId={detailRowId()}
+ hideWhenRowTappableOnMobile={!props.containerScope}
onToggle={toggleDrawer}
/>
<StatusDot
@@ -420,7 +450,19 @@ export const DockerHostsTable: Component<{
url={customUrl()}
class="min-w-0"
nameClass="truncate font-semibold text-base-content"
- />
+ >
+ <Show when={props.containerScope} fallback={name()}>
+ {(scope) => (
+ <PlatformHostScopeNameButton
+ name={name()}
+ workloadNoun="containers"
+ controlsId={scope().sectionId}
+ selected={isContainerScopeSelected()}
+ onSelect={() => scope().onShow(host)}
+ />
+ )}
+ </Show>
+ </ResourceNameWithWebInterfaceLink>
</div>
</TableCell>
<TableCell
diff --git a/frontend-modern/src/features/docker/DockerNativeTableShared.tsx b/frontend-modern/src/features/docker/DockerNativeTableShared.tsx
index 5947c58858..3e637ba1ea 100644
--- a/frontend-modern/src/features/docker/DockerNativeTableShared.tsx
+++ b/frontend-modern/src/features/docker/DockerNativeTableShared.tsx
@@ -35,7 +35,7 @@ export type DockerNativeTableProps = {
emptyIcon: JSX.Element;
emptyTitle: string;
emptyDescription: string;
- title?: string;
+ title?: JSX.Element;
showToolbar?: boolean;
externalSearch?: () => string;
externalStatus?: () => DockerResourceStatusFilter;
diff --git a/frontend-modern/src/features/docker/DockerPageSurface.tsx b/frontend-modern/src/features/docker/DockerPageSurface.tsx
index 3a8aa4f3e9..ac01e70777 100644
--- a/frontend-modern/src/features/docker/DockerPageSurface.tsx
+++ b/frontend-modern/src/features/docker/DockerPageSurface.tsx
@@ -44,6 +44,10 @@ import {
formatAgentVersionDisplay,
} from '@/features/platformPage/agentVersion';
import { PlatformOutdatedAgentNotice } from '@/features/platformPage/PlatformOutdatedAgentNotice';
+import {
+ PlatformHostScopedTableTitle,
+ createPlatformHostScopeFocus,
+} from '@/features/platformPage/PlatformHostScope';
import { collectIdentityConflictHosts } from './dockerIdentityConflict';
import { DockerIdentityConflictNotice } from './DockerIdentityConflictNotice';
import { updateStore } from '@/stores/updates';
@@ -435,6 +439,8 @@ function DockerSwarm(props: { model: DockerPageModel }) {
);
}
+const DOCKER_CONTAINERS_SECTION_ID = 'docker-containers-section';
+
function DockerOverview(props: {
hosts: ReturnType<typeof buildDockerPageModel>['hosts'];
hostSourceCount: number;
@@ -454,15 +460,39 @@ function DockerOverview(props: {
resource.docker?.hostSourceId,
].some((candidate) => asTrimmedString(candidate) === normalized);
};
- const scopedHosts = createMemo(() =>
- props.hosts.filter((host) => hostMatchesFilter(host, props.hostFilter)),
- );
const hasMachineInventory = createMemo(() => props.hosts.some(isPulseAgentPlatformResource));
+ // A host row narrows the containers table to that host through the URL host
+ // scope the table already reads, as a Proxmox node row does for its guests.
+ // Every host stays listed so another can be picked; the scoped one is marked.
+ const [, setSearchParams] = useSearchParams();
+ const isScopedHost = (host: Resource) =>
+ props.hostFilter.trim() !== '' && hostMatchesFilter(host, props.hostFilter);
+ const scopedHostLabel = createMemo(() => {
+ const filter = props.hostFilter.trim();
+ if (!filter) return null;
+ return asTrimmedString(props.hosts.find(isScopedHost)?.name) || filter;
+ });
+ const containersFocus = createPlatformHostScopeFocus();
+ const showHostContainers = (host: Resource) => {
+ // Containers name their host by its Docker hostname.
+ const value = asTrimmedString(host.docker?.hostname) || asTrimmedString(host.name) || host.id;
+ const next = isScopedHost(host) ? null : value;
+ setSearchParams({ [DOCKER_QUERY_PARAMS.host]: next });
+ if (next) {
+ requestAnimationFrame(() => {
+ if (props.hostFilter.trim() === next) containersFocus.reveal();
+ });
+ }
+ };
+ const clearHostScope = () => {
+ setSearchParams({ [DOCKER_QUERY_PARAMS.host]: null });
+ containersFocus.focus();
+ };
return (
<div class="space-y-4">
<DockerHostsTable
- resources={scopedHosts()}
+ resources={props.hosts}
sourceCount={props.hostSourceCount}
emptyIcon={dockerIcon()}
emptyTitle="No Docker or Podman hosts"
@@ -475,15 +505,37 @@ function DockerOverview(props: {
</Show>
}
showToolbar={false}
+ containerScope={{
+ sectionId: DOCKER_CONTAINERS_SECTION_ID,
+ isSelected: isScopedHost,
+ onShow: showHostContainers,
+ }}
/>
- <DockerContainersTable
- resources={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."
- onLifecycleActionSettled={props.onLifecycleActionSettled}
- />
+ <section
+ id={DOCKER_CONTAINERS_SECTION_ID}
+ aria-label="Containers"
+ class="scroll-mt-4"
+ data-testid="docker-containers-section"
+ >
+ <DockerContainersTable
+ resources={props.containers}
+ hosts={props.hosts}
+ title={
+ <PlatformHostScopedTableTitle
+ noun="Containers"
+ hostLabel={scopedHostLabel()}
+ clearLabel="Show all hosts"
+ onClear={clearHostScope}
+ headingId="docker-containers-heading"
+ headingRef={containersFocus.setHeading}
+ />
+ }
+ emptyIcon={dockerIcon()}
+ emptyTitle="No Docker or Podman containers"
+ emptyDescription="Containers appear here when a Docker or Podman host reports workload inventory."
+ onLifecycleActionSettled={props.onLifecycleActionSettled}
+ />
+ </section>
<Show when={props.incidents.length > 0}>
<DockerAlertsTable
incidents={props.incidents}
diff --git a/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx
index 8868b688fb..031e1af6cc 100644
--- a/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx
+++ b/frontend-modern/src/features/docker/__tests__/DockerHostsTable.test.tsx
@@ -1,5 +1,6 @@
import { cleanup, fireEvent, render, screen, within } from '@solidjs/testing-library';
import { afterEach, describe, expect, it, vi } from 'vitest';
+import { createSignal } from 'solid-js';
import type { Alert, Disk } from '@/types/api';
import type { Resource } from '@/types/resource';
@@ -379,6 +380,68 @@ describe('DockerHostsTable', () => {
expect(screen.queryByRole('tab', { name: 'History' })).toBeNull();
});
+ it('narrows the containers from a row click and keeps the drawer on the chevron', () => {
+ window.history.pushState({}, '', '/docker/overview');
+ const onShow = vi.fn();
+ const [selectedId, setSelectedId] = createSignal<string | null>(null);
+
+ render(() => (
+ <DockerHostsTable
+ resources={[makeDockerHost()]}
+ emptyIcon={<span />}
+ emptyTitle="No Docker hosts"
+ emptyDescription="No hosts"
+ showToolbar={false}
+ containerScope={{
+ sectionId: 'docker-containers-section',
+ isSelected: (host) => selectedId() === host.id,
+ onShow,
+ }}
+ />
+ ));
+
+ const hostRow = screen.getByText('docker-01').closest('tr')!;
+ const chevron = hostRow.querySelector('[data-row-action="true"]')!;
+ // The row no longer opens the drawer, so phones keep the chevron.
+ expect(chevron).not.toHaveClass('sr-only');
+
+ fireEvent.click(hostRow);
+ expect(onShow).toHaveBeenCalledWith(expect.objectContaining({ id: 'agent:docker-01' }));
+ expect(screen.queryByTestId('docker-host-drawer')).toBeNull();
+
+ const nameButton = screen.getByRole('button', { name: 'Show containers on docker-01' });
+ expect(nameButton).toHaveAttribute('aria-controls', 'docker-containers-section');
+ expect(nameButton).toHaveAttribute('aria-pressed', 'false');
+ fireEvent.click(nameButton);
+ expect(onShow).toHaveBeenCalledTimes(2);
+
+ setSelectedId('agent:docker-01');
+ expect(hostRow).toHaveAttribute('data-summary-row-active', 'true');
+ expect(nameButton).toHaveAttribute('aria-pressed', 'true');
+
+ fireEvent.click(chevron);
+ expect(screen.getByTestId('docker-host-drawer')).toBeInTheDocument();
+ expect(onShow).toHaveBeenCalledTimes(2);
+ });
+
+ it('keeps the plain host name and row-click drawer where nothing is scoped', () => {
+ render(() => (
+ <DockerHostsTable
+ resources={[makeDockerHost()]}
+ emptyIcon={<span />}
+ emptyTitle="No Docker hosts"
+ emptyDescription="No hosts"
+ title="Swarm hosts"
+ />
+ ));
+
+ expect(screen.queryByRole('button', { name: /^Show containers on/ })).toBeNull();
+ const hostRow = screen.getByText('docker-01').closest('tr')!;
+ expect(hostRow.querySelector('[data-row-action="true"]')).toHaveClass('sr-only');
+ fireEvent.click(hostRow);
+ expect(screen.getByTestId('docker-host-drawer')).toBeInTheDocument();
+ });
+
it('opens a saved Docker host web interface without toggling the row', () => {
render(() => (
<DockerHostsTable
diff --git a/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx b/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx
index 3d63129c64..e914d29fd6 100644
--- a/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx
+++ b/frontend-modern/src/features/docker/__tests__/DockerPageSurface.test.tsx
@@ -7,6 +7,7 @@ import { DockerPageSurface } from '../DockerPageSurface';
const mocks = vi.hoisted(() => ({
pathname: '/docker/overview',
searchParams: {} as Record<string, string>,
+ setSearchParams: vi.fn(),
useUnifiedResources: vi.fn(),
DockerHostsTable: vi.fn(
(props: {
@@ -26,12 +27,18 @@ const mocks = vi.hoisted(() => ({
),
),
DockerContainersTable: vi.fn(
- (props: { resources: Resource[]; showToolbar?: boolean; emptyTitle: string }) => (
+ (props: {
+ resources: Resource[];
+ showToolbar?: boolean;
+ emptyTitle: string;
+ title?: unknown;
+ }) => (
<div
data-testid="docker-containers-table"
data-resource-count={props.resources.length}
data-show-toolbar={String(props.showToolbar)}
>
+ {props.title as never}
{props.emptyTitle}
</div>
),
@@ -94,7 +101,7 @@ vi.mock('@solidjs/router', () => ({
return mocks.pathname;
},
}),
- useSearchParams: () => [mocks.searchParams, vi.fn()],
+ useSearchParams: () => [mocks.searchParams, mocks.setSearchParams],
}));
vi.mock('../DockerContainersTable', () => ({
@@ -228,6 +235,7 @@ const makeDockerNetwork = (overrides: Partial<Resource> = {}): Resource => ({
beforeEach(() => {
mocks.pathname = '/docker/overview';
mocks.searchParams = {};
+ mocks.setSearchParams.mockReset();
mocks.useUnifiedResources.mockReturnValue({
error: () => null,
loading: () => false,
@@ -299,7 +307,7 @@ describe('DockerPageSurface', () => {
);
});
- it('applies the URL host scope to the overview host table', () => {
+ it('keeps every host listed under the URL host scope and names it on the containers', () => {
mocks.searchParams = { host: 'frigate.mist-stork.ts.net' };
mocks.useUnifiedResources.mockReturnValue({
error: () => null,
@@ -341,11 +349,45 @@ describe('DockerPageSurface', () => {
render(() => <DockerPageSurface />);
- expect(screen.getByTestId('docker-hosts-table')).toHaveAttribute('data-resource-count', '1');
- expect(screen.getByTestId('docker-containers-table')).toHaveAttribute(
- 'data-resource-count',
- '1',
+ // Another host stays pickable; the scoped one is marked, as on Proxmox.
+ expect(screen.getByTestId('docker-hosts-table')).toHaveAttribute('data-resource-count', '2');
+ const hostsProps = mocks.DockerHostsTable.mock.lastCall![0] as {
+ resources: Resource[];
+ containerScope?: {
+ sectionId: string;
+ isSelected: (host: Resource) => boolean;
+ onShow: (host: Resource) => void;
+ };
+ };
+ const frigate = hostsProps.resources.find((host) => host.id === 'agent:frigate')!;
+ const tower = hostsProps.resources.find((host) => host.id === 'agent:tower')!;
+ expect(hostsProps.containerScope?.sectionId).toBe('docker-containers-section');
+ expect(hostsProps.containerScope?.isSelected(frigate)).toBe(true);
+ expect(hostsProps.containerScope?.isSelected(tower)).toBe(false);
+ expect(screen.getByTestId('docker-containers-section')).toContainElement(
+ screen.getByTestId('docker-containers-table'),
);
+ expect(screen.getByRole('heading', { name: 'Containers on frigate' })).toBeInTheDocument();
+
+ // Clicking the scoped host clears it; another host scopes by its Docker hostname.
+ hostsProps.containerScope?.onShow(frigate);
+ expect(mocks.setSearchParams).toHaveBeenLastCalledWith({ host: null });
+ hostsProps.containerScope?.onShow(tower);
+ expect(mocks.setSearchParams).toHaveBeenLastCalledWith({ host: 'tower' });
+ fireEvent.click(screen.getByRole('button', { name: 'Show all hosts' }));
+ expect(mocks.setSearchParams).toHaveBeenLastCalledWith({ host: null });
+ });
+
+ it('titles the containers plainly until a host is picked', () => {
+ render(() => <DockerPageSurface />);
+
+ expect(screen.getByRole('heading', { name: 'Containers' })).toBeInTheDocument();
+ expect(screen.queryByRole('button', { name: 'Show all hosts' })).not.toBeInTheDocument();
+ const hostsProps = mocks.DockerHostsTable.mock.lastCall![0] as {
+ resources: Resource[];
+ containerScope?: { isSelected: (host: Resource) => boolean };
+ };
+ expect(hostsProps.containerScope?.isSelected(hostsProps.resources[0])).toBe(false);
});
it('does not link to Machines for provider-owned guest Docker inventory', () => {
diff --git a/frontend-modern/src/features/platformPage/PlatformHostScope.tsx b/frontend-modern/src/features/platformPage/PlatformHostScope.tsx
new file mode 100644
index 0000000000..32cf39e0c5
--- /dev/null
+++ b/frontend-modern/src/features/platformPage/PlatformHostScope.tsx
@@ -0,0 +1,101 @@
+import { Show, type Component, type JSX } from 'solid-js';
+import { revealElementInViewport } from '@/components/shared/contextualFocus';
+import { SUMMARY_ROW_ACTION_BUTTON_FOCUS_CLASS } from '@/components/shared/summaryInteractionA11y';
+import { TABLE_CARD_HEADER_CLEAR_BUTTON_CLASS } from '@/components/shared/TableCardHeader';
+
+// A platform overview pairs a host table with the workloads those hosts run
+// (Proxmox nodes and guests, Docker hosts and containers, vSphere hosts and
+// VMs). Clicking a host row narrows the workload table to that host and a
+// second click clears it; the row's chevron opens the host's drawer. These
+// pieces keep that interaction one shape on every platform.
+
+/** A host row's name, as the control that narrows the workload table to it. */
+export const PlatformHostScopeNameButton: Component<{
+ /** The host's full name, for the accessible label and tooltip. */
+ name: string;
+ /** Plural workload noun: "guests", "containers", "VMs". */
+ workloadNoun: string;
+ /** The id of the section holding the workload table. */
+ controlsId: string;
+ selected: boolean;
+ onSelect: () => void;
+ /** What the cell shows, when it differs from `name`. */
+ children?: JSX.Element;
+}> = (props) => (
+ <button
+ type="button"
+ class={`block max-w-full truncate rounded-xs text-left ${SUMMARY_ROW_ACTION_BUTTON_FOCUS_CLASS}`}
+ aria-label={`Show ${props.workloadNoun} on ${props.name}`}
+ aria-controls={props.controlsId}
+ aria-pressed={props.selected}
+ title={
+ props.selected
+ ? `Clear ${props.workloadNoun} filter for ${props.name}`
+ : `Show ${props.workloadNoun} on ${props.name}`
+ }
+ onClick={(event) => {
+ event.stopPropagation();
+ props.onSelect();
+ }}
+ >
+ {props.children ?? props.name}
+ </button>
+);
+
+/**
+ * The workload table's heading, which names the host it is narrowed to and
+ * offers the way back. Selecting a host moves focus here and reveals it, so a
+ * keyboard or screen-reader user lands on the result of their click.
+ */
+export function createPlatformHostScopeFocus() {
+ let heading: HTMLHeadingElement | undefined;
+ return {
+ setHeading: (element: HTMLHeadingElement) => {
+ heading = element;
+ },
+ /** Focus the heading and scroll it into view if it is off screen. */
+ reveal: () => {
+ heading?.focus({ preventScroll: true });
+ if (heading) revealElementInViewport({ element: heading, bottomPadding: 96 });
+ },
+ /** Focus the heading without scrolling, after the scope is cleared. */
+ focus: () => heading?.focus({ preventScroll: true }),
+ };
+}
+
+export const PlatformHostScopedTableTitle: Component<{
+ /** Workload noun as a title: "Guests", "Containers", "VMs". */
+ noun: string;
+ /** The selected host's name, or null when the table is not narrowed. */
+ hostLabel: string | null;
+ /** Rows shown, when the page counts them. */
+ count?: number | null;
+ /** The clear button's label: "Show all nodes", "Show all hosts". */
+ clearLabel: string;
+ onClear: () => void;
+ headingId: string;
+ headingRef: (element: HTMLHeadingElement) => void;
+}> = (props) => (
+ <div class="flex flex-wrap items-center gap-x-3 gap-y-1">
+ <h2
+ ref={props.headingRef}
+ id={props.headingId}
+ tabIndex={-1}
+ class="inline-flex flex-wrap items-center gap-1.5 rounded-xs focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40"
+ >
+ {props.hostLabel ? `${props.noun} on ${props.hostLabel}` : props.noun}
+ <Show when={typeof props.count === 'number'}>
+ <span class="font-semibold tabular-nums text-base-content">{props.count}</span>
+ </Show>
+ </h2>
+ <Show when={props.hostLabel}>
+ <button
+ type="button"
+ class={`${TABLE_CARD_HEADER_CLEAR_BUTTON_CLASS} min-h-6`}
+ onClick={props.onClear}
+ >
+ {props.clearLabel}
+ </button>
+ </Show>
+ </div>
+);
diff --git a/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts b/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts
index a3c2a0743f..8b566375d3 100644
--- a/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts
+++ b/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts
@@ -9,6 +9,7 @@ import dockerAlertsTableSource from '@/features/docker/DockerAlertsTable.tsx?raw
import dockerConfigsTableSource from '@/features/docker/DockerConfigsTable.tsx?raw';
import dockerContainersTableSource from '@/features/docker/DockerContainersTable.tsx?raw';
import dockerHostsTableSource from '@/features/docker/DockerHostsTable.tsx?raw';
+import platformHostScopeSource from '@/features/platformPage/PlatformHostScope.tsx?raw';
import dockerImagesTableSource from '@/features/docker/DockerImagesTable.tsx?raw';
import dockerNetworksTableSource from '@/features/docker/DockerNetworksTable.tsx?raw';
import dockerPageSurfaceSource from '@/features/docker/DockerPageSurface.tsx?raw';
@@ -772,11 +773,16 @@ describe('platform overview layout guardrails', () => {
['ProxmoxPageSurface', proxmoxPageSurfaceSource],
['VmwarePageSurface', vmwarePageSurfaceSource],
];
+ expect(platformHostScopeSource, 'the shared title is an accessible heading').toContain('<h2');
for (const [name, source] of surfacesWithSharedToolbar) {
const filterCount = (source.match(/<WorkloadsFilter\b/g) ?? []).length;
expect(filterCount, `${name} should render exactly one <WorkloadsFilter>`).toBe(1);
expect(source, `${name} names its workloads table even in kiosk`).toContain('tableTitle={');
- expect(source, `${name} uses an accessible table heading`).toContain('<h2');
+ // The shared host-scoped title renders the heading, so a scoped table
+ // names its host the same way on every platform.
+ expect(source, `${name} uses the shared table heading`).toContain(
+ '<PlatformHostScopedTableTitle',
+ );
expect(
source.indexOf('<WorkloadsFilter'),
`${name} filter precedes the surface`,
diff --git a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
index 9f53349682..409027cbde 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxNodesTable.tsx
@@ -24,7 +24,6 @@ import { hostOverrideIdCandidates } from '@/features/alerts/alertOverridesModel'
import { getMetricAlertPresentation } from '@/features/alerts/metricAlertPresentation';
import { useBreakpoint } from '@/hooks/useBreakpoint';
import { TableCell, TableRow } from '@/components/shared/Table';
-import { SUMMARY_ROW_ACTION_BUTTON_FOCUS_CLASS } from '@/components/shared/summaryInteractionA11y';
import { getSimpleStatusIndicator } from '@/utils/status';
import { getNodeExternalUrl } from '@/utils/nodes';
import { asTrimmedString } from '@/utils/stringUtils';
@@ -52,6 +51,7 @@ import {
getPlatformResourceDetailRowInteractionProps,
PlatformResourceDetailToggleButton,
} from '@/features/platformPage/PlatformResourceDetailTableRow';
+import { PlatformHostScopeNameButton } from '@/features/platformPage/PlatformHostScope';
import { type ProxmoxEstateTopology } from '@/features/platformPage/platformEstateOverviewModel';
import { type WorkloadsMetricDisplayMode } from '@/components/Workloads/workloadsFilterModel';
import { type WorkloadTableMetricHistoryRange } from '@/components/Workloads/workloadMetricHistoryModel';
@@ -566,24 +566,15 @@ export const ProxmoxNodesTable: Component<{
: `Open ${name()} web interface`
}
>
- <button
- type="button"
- class={`block max-w-full truncate rounded-xs text-left ${SUMMARY_ROW_ACTION_BUTTON_FOCUS_CLASS}`}
- aria-label={`Show guests on ${name()}`}
- aria-controls="proxmox-guests-section"
- aria-pressed={isGuestFilterSelected()}
- title={
- isGuestFilterSelected()
- ? `Clear guest filter for ${name()}`
- : `Show guests on ${name()}`
- }
- onClick={(event) => {
- event.stopPropagation();
- showGuests();
- }}
+ <PlatformHostScopeNameButton
+ name={name()}
+ workloadNoun="guests"
+ controlsId="proxmox-guests-section"
+ selected={isGuestFilterSelected()}
+ onSelect={showGuests}
>
{visibleNodeLabel()}
- </button>
+ </PlatformHostScopeNameButton>
</ResourceNameWithWebInterfaceLink>
</div>
<Show when={!isOnline()}>
diff --git a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
index e050b1a868..d6d4219ef6 100644
--- a/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
+++ b/frontend-modern/src/features/proxmox/ProxmoxPageSurface.tsx
@@ -5,9 +5,11 @@ import { WorkloadsFilter } from '@/components/Workloads/WorkloadsFilter';
import { WorkloadsSurface } from '@/components/Workloads/WorkloadsSurface';
import { useWorkloadsState } from '@/components/Workloads/useWorkloadsState';
import { workloadNodeScopeId } from '@/components/Workloads/workloadTopology';
-import { revealElementInViewport } from '@/components/shared/contextualFocus';
import { nodeFromResource } from '@/utils/resourceStateAdapters';
-import { TABLE_CARD_HEADER_CLEAR_BUTTON_CLASS } from '@/components/shared/TableCardHeader';
+import {
+ PlatformHostScopedTableTitle,
+ createPlatformHostScopeFocus,
+} from '@/features/platformPage/PlatformHostScope';
import {
DEFAULT_WORKLOADS_METRIC_DISPLAY_MODE,
getWorkloadsMetricFilterProps,
@@ -534,13 +536,7 @@ function ProxmoxOverview(props: ProxmoxOverviewProps) {
scope
);
});
- let guestsHeading: HTMLHeadingElement | undefined;
- const focusGuests = () => {
- guestsHeading?.focus({ preventScroll: true });
- if (guestsHeading) {
- revealElementInViewport({ element: guestsHeading, bottomPadding: 96 });
- }
- };
+ const guestsFocus = createPlatformHostScopeFocus();
const showNodeGuests = (node: Resource) => {
const scope = nodeScopes().get(node.id);
if (!scope) return;
@@ -548,13 +544,13 @@ function ProxmoxOverview(props: ProxmoxOverviewProps) {
workloadsState.handleNodeSelect(nextScope, nextScope ? 'pve' : null);
if (nextScope) {
requestAnimationFrame(() => {
- if (selectedScope() === nextScope) focusGuests();
+ if (selectedScope() === nextScope) guestsFocus.reveal();
});
}
};
const clearNodeFilter = () => {
workloadsState.handleNodeSelect(null, null);
- guestsHeading?.focus({ preventScroll: true });
+ guestsFocus.focus();
};
return (
@@ -624,30 +620,15 @@ function ProxmoxOverview(props: ProxmoxOverviewProps) {
emptyStateTitle="No Proxmox workloads"
emptyStateDescription="Proxmox VMs and LXCs appear here when inventory is available."
tableTitle={
- <div class="flex flex-wrap items-center gap-x-3 gap-y-1">
- <h2
- ref={guestsHeading}
- id="proxmox-guests-heading"
- tabIndex={-1}
- class="inline-flex flex-wrap items-center gap-1.5 rounded-xs focus:outline-hidden focus-visible:ring-2 focus-visible:ring-primary/40"
- >
- {selectedNodeLabel() ? `Guests on ${selectedNodeLabel()}` : 'Guests'}
- <Show when={showSharedFilterToolbar()}>
- <span class="font-semibold tabular-nums text-base-content">
- {workloadsState.filteredGuests().length}
- </span>
- </Show>
- </h2>
- <Show when={selectedNodeLabel()}>
- <button
- type="button"
- class={`${TABLE_CARD_HEADER_CLEAR_BUTTON_CLASS} min-h-6`}
- onClick={clearNodeFilter}
- >
- Show all nodes
- </button>
- </Show>
- </div>
+ <PlatformHostScopedTableTitle
+ noun="Guests"
+ hostLabel={selectedNodeLabel()}
+ count={showSharedFilterToolbar() ? workloadsState.filteredGuests().length : null}
+ clearLabel="Show all nodes"
+ onClear={clearNodeFilter}
+ headingId="proxmox-guests-heading"
+ headingRef={guestsFocus.setHeading}
+ />
}
/>
</section>
diff --git a/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx b/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
index 762d1ad082..4f44771c35 100644
--- a/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
+++ b/frontend-modern/src/features/proxmox/__tests__/ProxmoxPageSurface.contract.test.tsx
@@ -676,7 +676,7 @@ describe('ProxmoxPageSurface contract', () => {
expect(proxmoxPageSurfaceSource).not.toContain('order-1 space-y-3');
expect(proxmoxPageSurfaceSource).toContain('id="proxmox-guests-section"');
expect(proxmoxPageSurfaceSource).toContain('tableTitle={');
- expect(proxmoxPageSurfaceSource).toContain('id="proxmox-guests-heading"');
+ expect(proxmoxPageSurfaceSource).toContain('headingId="proxmox-guests-heading"');
expect(proxmoxPageSurfaceSource).not.toContain('class="flex items-center gap-2 px-1"');
});
diff --git a/frontend-modern/src/features/vmware/VmwarePageSurface.tsx b/frontend-modern/src/features/vmware/VmwarePageSurface.tsx
index b948c83fcd..988ff4781a 100644
--- a/frontend-modern/src/features/vmware/VmwarePageSurface.tsx
+++ b/frontend-modern/src/features/vmware/VmwarePageSurface.tsx
@@ -36,6 +36,7 @@ import {
useWorkloadsState,
type WorkloadsInventorySourcesQuery,
} from '@/components/Workloads/useWorkloadsState';
+import { workloadNodeScopeId } from '@/components/Workloads/workloadTopology';
import {
DEFAULT_WORKLOADS_METRIC_DISPLAY_MODE,
getWorkloadsMetricFilterProps,
@@ -51,11 +52,16 @@ import { usePersistentSignal } from '@/hooks/usePersistentSignal';
import { STORAGE_KEYS } from '@/utils/localStorage';
import type { Resource } from '@/types/resource';
import { VsphereHostsTable } from './VsphereHostsTable';
+import {
+ PlatformHostScopedTableTitle,
+ createPlatformHostScopeFocus,
+} from '@/features/platformPage/PlatformHostScope';
import {
VMWARE_TAB_SPECS,
buildVmwareIncidentRows,
buildVmwarePageModel,
getVmwarePageTabSpecs,
+ getVsphereHostWorkloadScope,
type VmwarePageModel,
type VmwarePageTabId,
isSingleVmwareVcenter,
@@ -449,6 +455,8 @@ export function VmwarePageSurface() {
);
}
+const VSPHERE_VMS_SECTION_ID = 'vsphere-vms-section';
+
interface VmwareOverviewProps {
model: Accessor<VmwarePageModel>;
metricDisplayMode: Accessor<WorkloadsMetricDisplayMode>;
@@ -482,6 +490,52 @@ function VmwareOverview(props: VmwareOverviewProps) {
workloadsState.surfaceInitialDataReceived() &&
workloadsState.allGuests().length > 0,
);
+ // A host row narrows the VM table to that host, as a Proxmox node row does
+ // for its guests; the scope is the one the table gave the host's own VMs.
+ const workloadScopes = createMemo(
+ () =>
+ new Map(workloadsState.allGuests().map((guest) => [guest.id, workloadNodeScopeId(guest)])),
+ );
+ const hostScopes = createMemo(
+ () =>
+ new Map(
+ props
+ .model()
+ .hosts.map((host) => [
+ host.id,
+ getVsphereHostWorkloadScope(host, props.model().resources, workloadScopes()),
+ ]),
+ ),
+ );
+ const selectedScope = () => workloadsState.selectedNode() || workloadsState.selectedHostHint();
+ const selectedHost = createMemo(() =>
+ props.model().hosts.find((host) => hostScopes().get(host.id) === selectedScope()),
+ );
+ const selectedHostLabel = createMemo(() => {
+ const scope = selectedScope();
+ if (!scope) return null;
+ return (
+ selectedHost()?.name ||
+ workloadsState.hostFilterConfig()?.options.find((option) => option.value === scope)?.label ||
+ scope
+ );
+ });
+ const vmsFocus = createPlatformHostScopeFocus();
+ const showHostVms = (host: Resource) => {
+ const scope = hostScopes().get(host.id);
+ if (!scope) return;
+ const nextScope = selectedScope() === scope ? null : scope;
+ workloadsState.handleNodeSelect(nextScope, nextScope ? 'pve' : null);
+ if (nextScope) {
+ requestAnimationFrame(() => {
+ if (selectedScope() === nextScope) vmsFocus.reveal();
+ });
+ }
+ };
+ const clearHostFilter = () => {
+ workloadsState.handleNodeSelect(null, null);
+ vmsFocus.focus();
+ };
return (
<div class="space-y-4">
@@ -492,58 +546,71 @@ function VmwareOverview(props: VmwareOverviewProps) {
emptyTitle="No vSphere hosts"
emptyDescription="Hosts appear here once the vCenter connection enumerates them."
showToolbar={false}
+ vmScope={{
+ sectionId: VSPHERE_VMS_SECTION_ID,
+ selectedHostId: () => selectedHost()?.id ?? null,
+ onShow: showHostVms,
+ }}
/>
- <Show when={showSharedFilterToolbar()}>
- <div data-summary-clear-ignore>
- <WorkloadsFilter
- search={workloadsState.search}
- setSearch={workloadsState.setSearch}
- viewMode={workloadsState.viewMode}
- setViewMode={workloadsState.setViewMode}
- statusMode={workloadsState.statusMode}
- setStatusMode={workloadsState.setStatusMode}
- groupingMode={workloadsState.groupingMode}
- setGroupingMode={workloadsState.setGroupingMode}
- setSortKey={workloadsState.setSortKey}
- setSortDirection={workloadsState.setSortDirection}
- onBeforeAutoFocus={workloadsState.handleBeforeAutoFocus}
- ariaLabel="vSphere workload filters"
- searchPlaceholder="Search vSphere VMs by name, host, cluster, or status"
- searchEmptyMessage="Recent vSphere workload searches appear here."
- searchSuggestionWorkloads={workloadsState.allGuests}
- statusOptions={VMWARE_WORKLOAD_STATUS_OPTIONS}
- inventoryStats={workloadsState.inventoryStats}
- suppressTypeFilter
- columnVisibility={workloadsState.workloadsFilterColumnVisibility()}
- containerRuntimeFilter={workloadsState.containerRuntimeFilterConfig()}
- hostFilter={workloadsState.hostFilterConfig()}
- namespaceFilter={undefined}
- clusterFilter={workloadsState.clusterFilterConfig()}
- platformFilter={undefined}
- {...getWorkloadsMetricFilterProps(workloadsState)}
- forcedPlatform={VMWARE_PLATFORM_FILTER}
- pinnedSelectionActive={() => Boolean(workloadsState.selectedGuestId())}
- onClearPinnedSelection={workloadsState.clearPinnedSummaryScope}
- />
- </div>
- </Show>
- <WorkloadsSurface
- state={workloadsState}
- forcedPlatform={VMWARE_PLATFORM_FILTER}
- forcedViewMode="vm"
- tableTitle={
- <h2 class="text-[11px] font-semibold text-muted sm:text-xs">
- VMs
- <Show when={showSharedFilterToolbar()}>
- <span class="ml-1.5 font-normal tabular-nums">
- {workloadsState.filteredGuests().length}
- </span>
- </Show>
- </h2>
- }
- emptyStateTitle="No vSphere VMs"
- emptyStateDescription="Virtual machines appear here once the vCenter connection enumerates them."
- />
+ <section
+ id={VSPHERE_VMS_SECTION_ID}
+ aria-label="VMs"
+ class="space-y-4 scroll-mt-4"
+ data-testid="vsphere-vms-section"
+ >
+ <Show when={showSharedFilterToolbar()}>
+ <div data-summary-clear-ignore>
+ <WorkloadsFilter
+ search={workloadsState.search}
+ setSearch={workloadsState.setSearch}
+ viewMode={workloadsState.viewMode}
+ setViewMode={workloadsState.setViewMode}
+ statusMode={workloadsState.statusMode}
+ setStatusMode={workloadsState.setStatusMode}
+ groupingMode={workloadsState.groupingMode}
+ setGroupingMode={workloadsState.setGroupingMode}
+ setSortKey={workloadsState.setSortKey}
+ setSortDirection={workloadsState.setSortDirection}
+ onBeforeAutoFocus={workloadsState.handleBeforeAutoFocus}
+ ariaLabel="vSphere workload filters"
+ searchPlaceholder="Search vSphere VMs by name, host, cluster, or status"
+ searchEmptyMessage="Recent vSphere workload searches appear here."
+ searchSuggestionWorkloads={workloadsState.allGuests}
+ statusOptions={VMWARE_WORKLOAD_STATUS_OPTIONS}
+ inventoryStats={workloadsState.inventoryStats}
+ suppressTypeFilter
+ columnVisibility={workloadsState.workloadsFilterColumnVisibility()}
+ containerRuntimeFilter={workloadsState.containerRuntimeFilterConfig()}
+ hostFilter={workloadsState.hostFilterConfig()}
+ namespaceFilter={undefined}
+ clusterFilter={workloadsState.clusterFilterConfig()}
+ platformFilter={undefined}
+ {...getWorkloadsMetricFilterProps(workloadsState)}
+ forcedPlatform={VMWARE_PLATFORM_FILTER}
+ pinnedSelectionActive={() => Boolean(workloadsState.selectedGuestId())}
+ onClearPinnedSelection={workloadsState.clearPinnedSummaryScope}
+ />
+ </div>
+ </Show>
+ <WorkloadsSurface
+ state={workloadsState}
+ forcedPlatform={VMWARE_PLATFORM_FILTER}
+ forcedViewMode="vm"
+ tableTitle={
+ <PlatformHostScopedTableTitle
+ noun="VMs"
+ hostLabel={selectedHostLabel()}
+ count={showSharedFilterToolbar() ? workloadsState.filteredGuests().length : null}
+ clearLabel="Show all hosts"
+ onClear={clearHostFilter}
+ headingId="vsphere-vms-heading"
+ headingRef={vmsFocus.setHeading}
+ />
+ }
+ emptyStateTitle="No vSphere VMs"
+ emptyStateDescription="Virtual machines appear here once the vCenter connection enumerates them."
+ />
+ </section>
</div>
);
}
diff --git a/frontend-modern/src/features/vmware/VsphereHostsTable.tsx b/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
index af18b0b49d..656d9ef7fa 100644
--- a/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
+++ b/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
@@ -45,7 +45,9 @@ import {
createPlatformResourceDetailState,
createPlatformResourceLabelResolver,
getPlatformResourceDetailRowClass,
+ getPlatformResourceDetailRowInteractionProps,
} from '@/features/platformPage/PlatformResourceDetailTableRow';
+import { PlatformHostScopeNameButton } from '@/features/platformPage/PlatformHostScope';
import type { Resource } from '@/types/resource';
// vSphere ESXi hosts are virtualization hypervisors managed by vCenter,
@@ -147,6 +149,15 @@ export const VsphereHostsTable: Component<{
emptyDescription: string;
title?: string;
showToolbar?: boolean;
+ /**
+ * When set, a row click narrows the page's VM table to that host (as on the
+ * Proxmox overview) and the chevron alone opens the host's drawer.
+ */
+ vmScope?: {
+ sectionId: string;
+ selectedHostId: () => string | null;
+ onShow: (host: Resource) => void;
+ };
}> = (props) => {
const { activeAlerts } = useWebSocket();
const alertsActivation = useAlertsActivation();
@@ -160,6 +171,12 @@ export const VsphereHostsTable: Component<{
const drawer = createPlatformResourceDetailState({ idPrefix: 'vsphere-host-drawer' });
const resolveResourceLabel = createPlatformResourceLabelResolver(() => props.scope);
const singleVcenter = createMemo(() => isSingleVmwareVcenter(props.scope));
+ // A scoping table keeps the details chevron on phones, so the host column
+ // takes the width Uptime does not need.
+ const phoneWidths = () =>
+ props.vmScope
+ ? { host: 'platform-table-mobile-w-38', uptime: 'platform-table-mobile-w-10' }
+ : { host: 'platform-table-mobile-w-30', uptime: 'platform-table-mobile-w-20' };
const vmCountByHost = createMemo(() => {
const map = new Map<string, number>();
@@ -240,7 +257,7 @@ export const VsphereHostsTable: Component<{
kind="name"
sort={sort}
sortKey="host"
- class="platform-table-mobile-w-30 md:w-[15%]"
+ class={`${phoneWidths().host} md:w-[15%]`}
>
Host
</PlatformSortableTableHead>
@@ -312,7 +329,7 @@ export const VsphereHostsTable: Component<{
kind="text"
sort={sort}
sortKey="uptime"
- class="platform-table-mobile-w-20 w-[16%] md:w-[6%]"
+ class={`${phoneWidths().uptime} w-[16%] md:w-[6%]`}
>
<PlatformResponsiveTableLabel compact="Up" full="Uptime" />
</PlatformSortableTableHead>
@@ -376,6 +393,12 @@ export const VsphereHostsTable: Component<{
const canRenderMetrics = () => indicator().variant !== 'muted';
const detailRowId = () => drawer.detailRowId(host);
const isExpanded = () => drawer.isExpanded(host);
+ const isVmScopeSelected = () => props.vmScope?.selectedHostId() === host.id;
+ const rowInteraction = getPlatformResourceDetailRowInteractionProps({
+ expanded: false,
+ onToggle: () =>
+ props.vmScope ? props.vmScope.onShow(host) : drawer.toggle(host),
+ });
const hostAlertStyles = createMemo(() =>
getAlertStyles(host.id, activeAlerts, alertsEnabled(), name()),
);
@@ -391,14 +414,18 @@ export const VsphereHostsTable: Component<{
<TableRow
class={`${getPlatformResourceDetailRowClass(isExpanded())} text-[11px] sm:text-xs ${hostAlertBg()}`}
data-vsphere-host-row={host.id}
- onClick={() => drawer.toggle(host)}
+ data-summary-row-active={isVmScopeSelected() ? 'true' : undefined}
+ onClick={rowInteraction.onClick}
>
<TableCell class={getPlatformTableCellClassForKind('name')}>
- <div class="flex min-w-0 items-center gap-2">
+ <div
+ class={`flex min-w-0 items-center ${props.vmScope ? 'gap-1 sm:gap-2' : 'gap-2'}`}
+ >
<PlatformResourceDetailToggleButton
expanded={isExpanded()}
resourceLabel={name()}
controlsId={detailRowId()}
+ hideWhenRowTappableOnMobile={!props.vmScope}
onToggle={() => drawer.toggle(host)}
/>
<StatusDot
@@ -411,7 +438,17 @@ export const VsphereHostsTable: Component<{
class="min-w-0 truncate font-semibold text-base-content"
title={name()}
>
- {name()}
+ <Show when={props.vmScope} fallback={name()}>
+ {(scope) => (
+ <PlatformHostScopeNameButton
+ name={name()}
+ workloadNoun="VMs"
+ controlsId={scope().sectionId}
+ selected={isVmScopeSelected()}
+ onSelect={() => scope().onShow(host)}
+ />
+ )}
+ </Show>
</span>
<Show when={mobilePowerException()}>
{(power) => (
diff --git a/frontend-modern/src/features/vmware/__tests__/VmwarePageSurface.contract.test.tsx b/frontend-modern/src/features/vmware/__tests__/VmwarePageSurface.contract.test.tsx
index 2e02ae8211..e065d06118 100644
--- a/frontend-modern/src/features/vmware/__tests__/VmwarePageSurface.contract.test.tsx
+++ b/frontend-modern/src/features/vmware/__tests__/VmwarePageSurface.contract.test.tsx
@@ -1,7 +1,8 @@
import { createSignal, type JSX } from 'solid-js';
-import { cleanup, render, screen, within } from '@solidjs/testing-library';
+import { cleanup, fireEvent, render, screen, within } from '@solidjs/testing-library';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { Resource } from '@/types/resource';
+import { workloadNodeScopeId } from '@/components/Workloads/workloadTopology';
import { VmwarePageSurface } from '../VmwarePageSurface';
import vmwarePageSurfaceSource from '../VmwarePageSurface.tsx?raw';
@@ -83,7 +84,14 @@ vi.mock('@/components/Workloads/WorkloadsSurface', () => ({
}));
vi.mock('@/components/Workloads/useWorkloadsState', () => ({
- useWorkloadsState: (...args: unknown[]) => mockUseWorkloadsState(...args),
+ // No host is picked unless a test says so.
+ useWorkloadsState: (...args: unknown[]) => ({
+ selectedNode: () => null,
+ selectedHostHint: () => null,
+ handleNodeSelect: vi.fn(),
+ hostFilterConfig: () => undefined,
+ ...mockUseWorkloadsState(...args),
+ }),
}));
vi.mock('@/features/platformPage/sharedPlatformPage', () => ({
@@ -115,8 +123,26 @@ vi.mock('../VsphereDatastoresTable', () => ({
}));
vi.mock('../VsphereHostsTable', () => ({
- VsphereHostsTable: (props: { hosts: Resource[] }) => (
- <div data-testid="hosts-table" data-rows={props.hosts.length} />
+ VsphereHostsTable: (props: {
+ hosts: Resource[];
+ vmScope?: {
+ sectionId: string;
+ selectedHostId: () => string | null;
+ onShow: (host: Resource) => void;
+ };
+ }) => (
+ <div data-testid="hosts-table" data-rows={props.hosts.length}>
+ {props.hosts.map((host) => (
+ <button
+ type="button"
+ data-scope-section={props.vmScope?.sectionId}
+ aria-pressed={props.vmScope?.selectedHostId() === host.id}
+ onClick={() => props.vmScope?.onShow(host)}
+ >
+ {`host ${host.id}`}
+ </button>
+ ))}
+ </div>
),
}));
@@ -178,6 +204,73 @@ describe('VmwarePageSurface contract', () => {
).toBeTruthy();
});
+ it('narrows the VM table to a host picked in the hosts table, as Proxmox does', () => {
+ setResources([
+ makeResource({
+ id: 'esxi-01',
+ type: 'agent',
+ vmware: {
+ entityType: 'host',
+ managedObjectId: 'host-1',
+ connectionId: 'vc-1',
+ clusterName: 'Production',
+ },
+ }),
+ makeResource({
+ id: 'vm-app-01',
+ type: 'vm',
+ vmware: {
+ runtimeHostId: 'host-1',
+ runtimeHostName: 'esxi-01',
+ connectionId: 'vc-1',
+ clusterName: 'Production',
+ },
+ }),
+ ]);
+ const [selected, setSelected] = createSignal<string | null>(null);
+ const handleNodeSelect = vi.fn((scope: string | null) => setSelected(scope));
+ mockUseWorkloadsState.mockReturnValue({
+ surfaceConnected: () => true,
+ surfaceInitialDataReceived: () => true,
+ // The workload table's own placement for the host's VM.
+ allGuests: () => [
+ { id: 'vm-app-01', node: 'esxi-01.lab', instance: 'Production Cluster' },
+ { id: 'vm-app-02', node: 'esxi-02.lab', instance: 'Production Cluster' },
+ ],
+ filteredGuests: () => [{ id: 'vm-app-01' }],
+ search: () => '',
+ setSearch: vi.fn(),
+ selectedNode: selected,
+ handleNodeSelect,
+ });
+
+ render(() => <VmwarePageSurface />);
+ const hostButton = () => screen.getByRole('button', { name: 'host esxi-01' });
+ const heading = () =>
+ within(screen.getByTestId('workloads-surface')).getByRole('heading', { level: 2 });
+ expect(hostButton()).toHaveAttribute('data-scope-section', 'vsphere-vms-section');
+ expect(screen.getByTestId('vsphere-vms-section')).toContainElement(
+ screen.getByTestId('workloads-surface'),
+ );
+
+ // The scope is the one the table gave the host's own VM.
+ fireEvent.click(hostButton());
+ expect(handleNodeSelect).toHaveBeenLastCalledWith(
+ workloadNodeScopeId({ instance: 'Production Cluster', node: 'esxi-01.lab' }),
+ 'pve',
+ );
+ expect(hostButton()).toHaveAttribute('aria-pressed', 'true');
+ expect(heading()).toHaveTextContent(/^VMs on esxi-01\s*1$/);
+
+ // A second click on the host, or Show all hosts, clears it.
+ fireEvent.click(hostButton());
+ expect(handleNodeSelect).toHaveBeenLastCalledWith(null, null);
+ fireEvent.click(hostButton());
+ fireEvent.click(screen.getByRole('button', { name: 'Show all hosts' }));
+ expect(handleNodeSelect).toHaveBeenLastCalledWith(null, null);
+ expect(heading()).toHaveTextContent(/^VMs\s*1$/);
+ });
+
it('titles the VM table through the tableTitle slot and counts the filtered rows', () => {
setResources([makeResource({ id: 'vm-app-01', type: 'vm' })]);
const [ready, setReady] = createSignal(false);
diff --git a/frontend-modern/src/features/vmware/__tests__/VsphereHostsTable.test.tsx b/frontend-modern/src/features/vmware/__tests__/VsphereHostsTable.test.tsx
index 2cee99416f..9b7b01a901 100644
--- a/frontend-modern/src/features/vmware/__tests__/VsphereHostsTable.test.tsx
+++ b/frontend-modern/src/features/vmware/__tests__/VsphereHostsTable.test.tsx
@@ -1,5 +1,6 @@
import { cleanup, fireEvent, render, screen, within } from '@solidjs/testing-library';
import { afterEach, describe, expect, it, vi } from 'vitest';
+import { createSignal } from 'solid-js';
vi.mock('@/components/Workloads/StackedMemoryBar', () => ({
StackedMemoryBar: () => <div data-testid="stacked-memory-bar" />,
@@ -199,4 +200,61 @@ describe('VsphereHostsTable', () => {
expect(screen.getByText('Edge vCenter')).toHaveAttribute('title', 'vcsa-edge.lab.local');
expect(screen.getByText('Lab vCenter')).toBeInTheDocument();
});
+
+ it('narrows the VMs from a row click and keeps the drawer on the chevron', () => {
+ const host = makeHost({ id: 'esxi-01' });
+ const onShow = vi.fn();
+ const [selectedId, setSelectedId] = createSignal<string | null>(null);
+ const { container } = render(() => (
+ <VsphereHostsTable
+ hosts={[host]}
+ scope={[host]}
+ emptyIcon={<span />}
+ emptyTitle="No hosts"
+ emptyDescription="No hosts"
+ showToolbar={false}
+ vmScope={{ sectionId: 'vsphere-vms-section', selectedHostId: selectedId, onShow }}
+ />
+ ));
+
+ const row = container.querySelector('[data-vsphere-host-row="esxi-01"]')!;
+ const chevron = row.querySelector('[data-row-action="true"]')!;
+ expect(chevron).not.toHaveClass('sr-only');
+
+ fireEvent.click(row);
+ expect(onShow).toHaveBeenCalledWith(host);
+ expect(chevron).toHaveAttribute('aria-expanded', 'false');
+
+ const nameButton = screen.getByRole('button', { name: 'Show VMs on esxi-01' });
+ expect(nameButton).toHaveAttribute('aria-controls', 'vsphere-vms-section');
+ fireEvent.click(nameButton);
+ expect(onShow).toHaveBeenCalledTimes(2);
+
+ setSelectedId('esxi-01');
+ expect(row).toHaveAttribute('data-summary-row-active', 'true');
+ expect(nameButton).toHaveAttribute('aria-pressed', 'true');
+
+ fireEvent.click(chevron);
+ expect(chevron).toHaveAttribute('aria-expanded', 'true');
+ expect(onShow).toHaveBeenCalledTimes(2);
+ });
+
+ it('opens the drawer from a row click where nothing is scoped', () => {
+ const host = makeHost({ id: 'esxi-02' });
+ const { container } = render(() => (
+ <VsphereHostsTable
+ hosts={[host]}
+ scope={[host]}
+ emptyIcon={<span />}
+ emptyTitle="No hosts"
+ emptyDescription="No hosts"
+ showToolbar={false}
+ />
+ ));
+
+ expect(screen.queryByRole('button', { name: /^Show VMs on/ })).toBeNull();
+ const row = container.querySelector('[data-vsphere-host-row="esxi-02"]')!;
+ fireEvent.click(row);
+ expect(row.querySelector('[data-row-action="true"]')).toHaveAttribute('aria-expanded', 'true');
+ });
});
diff --git a/frontend-modern/src/features/vmware/__tests__/vmwarePageModel.test.ts b/frontend-modern/src/features/vmware/__tests__/vmwarePageModel.test.ts
index d24251b948..feac7d091d 100644
--- a/frontend-modern/src/features/vmware/__tests__/vmwarePageModel.test.ts
+++ b/frontend-modern/src/features/vmware/__tests__/vmwarePageModel.test.ts
@@ -1,5 +1,6 @@
import { describe, expect, it } from 'vitest';
import type { Resource } from '@/types/resource';
+import { workloadNodeScopeId } from '@/components/Workloads/workloadTopology';
import {
VMWARE_TAB_SPECS,
buildVmwareHealthPosture,
@@ -11,6 +12,7 @@ import {
filterVmwareVirtualMachines,
getVmwarePageTabSpecs,
getVmwareResourceDisplayStatus,
+ getVsphereHostWorkloadScope,
isSingleVmwareVcenter,
mapVmwareActivityStateBucket,
mapVmwareDatastoreStatus,
@@ -574,4 +576,40 @@ describe('vmwarePageModel', () => {
]),
).toBe(false);
});
+
+ it('scopes a host row to the scope the workload table gave its own VMs, per vCenter', () => {
+ // Two vCenters can both call a host `host-12`.
+ const labHost = makeResource({
+ id: 'lab-host',
+ type: 'agent',
+ name: 'esxi-a.lab.local',
+ vmware: { managedObjectId: 'host-12', connectionId: 'vc-1', clusterName: 'Production' },
+ });
+ const edgeHost = makeResource({
+ id: 'edge-host',
+ type: 'agent',
+ name: 'esxi-b.edge.local',
+ vmware: { managedObjectId: 'host-12', connectionId: 'vc-2', clusterName: 'Edge' },
+ });
+ const edgeVm = makeResource({
+ id: 'edge-vm',
+ type: 'vm',
+ vmware: {
+ runtimeHostId: 'host-12',
+ runtimeHostName: 'esxi-b',
+ connectionId: 'vc-2',
+ clusterName: 'Edge Services',
+ },
+ });
+ const resources = [labHost, edgeHost, edgeVm];
+ // The VM's row scope as the workload table built it.
+ const vmScope = workloadNodeScopeId({ instance: 'Edge Services', node: 'esxi-b' });
+ const workloadScopes = new Map([['edge-vm', vmScope]]);
+
+ expect(getVsphereHostWorkloadScope(edgeHost, resources, workloadScopes)).toBe(vmScope);
+ // The other vCenter's host-12 has no VMs: a scope that names it and matches none.
+ expect(getVsphereHostWorkloadScope(labHost, resources, workloadScopes)).toBe(
+ workloadNodeScopeId({ instance: 'Production', node: 'esxi-a.lab.local' }),
+ );
+ });
});
diff --git a/frontend-modern/src/features/vmware/vmwarePageModel.ts b/frontend-modern/src/features/vmware/vmwarePageModel.ts
index 1656e710e9..3c2dc8a973 100644
--- a/frontend-modern/src/features/vmware/vmwarePageModel.ts
+++ b/frontend-modern/src/features/vmware/vmwarePageModel.ts
@@ -4,6 +4,7 @@ import { formatVmwareClusterServices } from '@/utils/vmwareDisplay';
import type { Resource, ResourceChange, ResourceIncident, ResourceType } from '@/types/resource';
import type { PlatformIssue } from '@/features/platformPage/PlatformIssueReason';
import { getSimpleStatusIndicator, type StatusIndicator } from '@/utils/status';
+import { workloadNodeScopeId } from '@/components/Workloads/workloadTopology';
export type VmwarePageTabId = 'overview' | 'storage' | 'networks' | 'health' | 'activity';
export type VmwareDatastoreStatusFilter =
@@ -198,6 +199,39 @@ export const isSingleVmwareVcenter = (resources: readonly Resource[]): boolean =
export const vmwareVcenterLabel = (resource: Resource): string =>
resource.vmware?.connectionName?.trim() || resource.vmware?.vcenterHost?.trim() || '';
+/**
+ * The VM-table scope a vSphere host row narrows to: the scope the workload
+ * table already gave one of the host's own VMs (`workloadScopeById`, keyed by
+ * VM resource ID), so host and VM rows never disagree. A VM names its host by
+ * the host's managed object ID, which only one vCenter connection gives that
+ * host. A host with no listed VMs gets a scope that names it and matches
+ * nothing, so the table reads "VMs on <host>" and is empty.
+ */
+export const getVsphereHostWorkloadScope = (
+ host: Resource,
+ resources: readonly Resource[],
+ workloadScopeById: ReadonlyMap<string, string>,
+): string => {
+ const hostObjectId = host.vmware?.managedObjectId?.trim() || '';
+ const connectionId = host.vmware?.connectionId?.trim() || '';
+ for (const resource of resources) {
+ if (
+ hostObjectId &&
+ resource.type === 'vm' &&
+ resource.vmware?.runtimeHostId?.trim() === hostObjectId &&
+ (resource.vmware?.connectionId?.trim() || '') === connectionId
+ ) {
+ const scope = workloadScopeById.get(resource.id);
+ if (scope) return scope;
+ }
+ }
+ return workloadNodeScopeId({
+ node: host.name,
+ instance:
+ host.vmware?.clusterName ?? host.vmware?.datacenterName ?? host.vmware?.connectionName ?? '',
+ });
+};
+
export const getVmwareResourceDisplayStatus = (resource: Resource): string =>
hasImpairedResourceSource(resource, 'vmware-vsphere') ? 'degraded' : resource.status;
diff --git a/frontend-modern/src/index.css b/frontend-modern/src/index.css
index cb90db1f64..5885b23da2 100644
--- a/frontend-modern/src/index.css
+++ b/frontend-modern/src/index.css
@@ -1491,6 +1491,17 @@
width: 30%;
}
+ /*
+ * A host table whose rows scope the workloads below keeps the details
+ * chevron on phones, so its identity cell carries the toggle and status
+ * dot before the name; like the Proxmox node column
+ * (PROXMOX_HOST_PHONE_IDENTITY_WIDTH_PERCENT) it needs more than the 30%
+ * anchor to show a typical host name.
+ */
+ .table-scroll-shell > .table-fixed.platform-table th.platform-table-mobile-w-38 {
+ width: 38%;
+ }
+
.table-scroll-shell > .table-fixed.platform-table th.platform-table-mobile-w-25 {
width: 25%;
}