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
Add Docker host detail drawer mirroring Proxmox node pattern
rcourtman2c5b3670480b
diff --git a/frontend-modern/src/features/docker/DockerHostDrawer.tsx b/frontend-modern/src/features/docker/DockerHostDrawer.tsxnew file mode 100644index 0000000000..c4de0cb534--- /dev/null+++ b/frontend-modern/src/features/docker/DockerHostDrawer.tsx@@ -0,0 +1,91 @@+import { Show, createMemo, createSignal, type Component } from 'solid-js';++import type { HistoryTimeRange } from '@/api/charts';+import { GuestDrawerHistory, GuestDrawerHistoryRangeSelect } from '@/components/Workloads/GuestDrawerHistory';+import { GUEST_DRAWER_HISTORY_DEFAULT_RANGE } from '@/components/Workloads/guestDrawerModel';+import type { Resource } from '@/types/resource';+import { asTrimmedString } from '@/utils/stringUtils';++import { DockerHostDrawerOverview } from './DockerHostDrawerOverview';+import {+ DOCKER_HOST_DRAWER_HISTORY_GROUPS,+ getDockerHostDrawerHistoryFallbackMetrics,+ getDockerHostDrawerHistoryTarget,+} from './dockerHostDrawerModel';++interface DockerHostDrawerProps {+ host: Resource;+}++type DockerHostDrawerTab = 'overview' | 'history';++export const DockerHostDrawer: Component<DockerHostDrawerProps> = (props) => {+ const [activeTab, setActiveTab] = createSignal<DockerHostDrawerTab>('overview');+ const [historyRange, setHistoryRange] = createSignal<HistoryTimeRange>(+ GUEST_DRAWER_HISTORY_DEFAULT_RANGE,+ );++ const headingId = () => `docker-host-drawer-heading-${props.host.id}`;+ const displayName = createMemo(() => asTrimmedString(props.host.name) || props.host.id);+ const historyTarget = createMemo(() => getDockerHostDrawerHistoryTarget(props.host));+ const fallbackMetrics = createMemo(() => getDockerHostDrawerHistoryFallbackMetrics(props.host));++ return (+ <section+ class="space-y-3"+ aria-labelledby={headingId()}+ data-testid="docker-host-drawer"+ >+ <h2 id={headingId()} class="sr-only">+ {displayName()} details+ </h2>++ <div class="mb-1 flex items-center justify-between gap-3 border-b border-border px-1">+ <div class="flex items-center gap-6">+ <button+ onClick={() => setActiveTab('overview')}+ class={`pb-2 text-sm font-medium transition-colors relative ${+ activeTab() === 'overview' ? 'text-blue-600 dark:text-blue-400' : ' hover:text-muted'+ }`}+ >+ Overview+ {activeTab() === 'overview' && (+ <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />+ )}+ </button>+ <button+ onClick={() => setActiveTab('history')}+ class={`pb-2 text-sm font-medium transition-colors relative ${+ activeTab() === 'history' ? 'text-blue-600 dark:text-blue-400' : ' hover:text-muted'+ }`}+ >+ History+ {activeTab() === 'history' && (+ <div class="absolute bottom-0 left-0 right-0 h-0.5 bg-blue-600 dark:bg-blue-400 rounded-t-full" />+ )}+ </button>+ </div>+ <Show when={activeTab() === 'history'}>+ <div class="pb-1">+ <GuestDrawerHistoryRangeSelect range={historyRange()} onRangeChange={setHistoryRange} />+ </div>+ </Show>+ </div>++ <Show when={activeTab() === 'overview'}>+ <DockerHostDrawerOverview host={props.host} />+ </Show>++ <Show when={activeTab() === 'history'}>+ <GuestDrawerHistory+ fallbackMetrics={fallbackMetrics()}+ groups={DOCKER_HOST_DRAWER_HISTORY_GROUPS}+ range={historyRange()}+ target={historyTarget()}+ />+ </Show>+ </section>+ );+};++export default DockerHostDrawer;diff --git a/frontend-modern/src/features/docker/DockerHostDrawerOverview.tsx b/frontend-modern/src/features/docker/DockerHostDrawerOverview.tsxnew file mode 100644index 0000000000..0ecfa67969--- /dev/null+++ b/frontend-modern/src/features/docker/DockerHostDrawerOverview.tsx@@ -0,0 +1,280 @@+import { For, Show } from 'solid-js';++import type { Resource } from '@/types/resource';+import { formatBytes, formatRelativeTime, formatSpeed, formatUptime } from '@/utils/format';+import { formatTemperature, getTemperatureTextClass } from '@/utils/temperature';++import { hasDockerSwarmEvidence } from './dockerPageModel';++interface DockerHostDrawerOverviewProps {+ host: Resource;+}++interface DockerOverviewRow {+ label: string;+ value: string;+ valueClass?: string;+ title?: string;+}++const DOCKER_OVERVIEW_CARD_CLASS = 'rounded border border-border bg-surface p-3 shadow-sm';++const cleanText = (value: string | null | undefined): string => {+ const trimmed = (value || '').trim();+ return trimmed && trimmed.toLowerCase() !== 'unknown' ? trimmed : '';+};++const stripAgentPrefix = (value: string): string =>+ value.startsWith('agent:') ? value.slice('agent:'.length) : value;++const formatStatus = (value: string | null | undefined): string => {+ const status = cleanText(value);+ if (!status) return '-';+ return status.charAt(0).toUpperCase() + status.slice(1);+};++const formatPercent = (value: number | null | undefined): string => {+ if (typeof value !== 'number' || !Number.isFinite(value)) return '-';+ const normalized = value <= 1 ? value * 100 : value;+ return `${Math.round(Math.max(0, normalized))}%`;+};++const getUsedPercent = (used?: number | null, total?: number | null): string => {+ if (typeof used !== 'number' || typeof total !== 'number' || total <= 0) return '-';+ return formatPercent((used / total) * 100);+};++const formatLastSeenRow = (+ value: string | number | null | undefined,+): DockerOverviewRow | null => {+ if (value == null) return null;+ const parsed = typeof value === 'number' ? new Date(value) : new Date(String(value));+ if (Number.isNaN(parsed.getTime())) return null;+ const iso = parsed.toISOString();+ return {+ label: 'Last seen',+ value: formatRelativeTime(iso, { compact: true }) || '-',+ title: parsed.toLocaleString(),+ };+};++const titleCase = (value: string): string =>+ value.length === 0 ? value : value.charAt(0).toUpperCase() + value.slice(1);++const DetailCard = (props: { title: string; rows: DockerOverviewRow[] }) => (+ <Show when={props.rows.length > 0}>+ <div class={DOCKER_OVERVIEW_CARD_CLASS}>+ <h3 class="mb-2 text-[11px] font-medium uppercase tracking-wide text-base-content">+ {props.title}+ </h3>+ <div class="space-y-1.5 text-[11px]">+ <For each={props.rows}>+ {(row) => (+ <div class="flex items-center justify-between gap-2 min-w-0">+ <span class="shrink-0 text-muted">{row.label}</span>+ <span+ class={`truncate text-right font-medium ${row.valueClass ?? 'text-base-content'}`}+ title={row.title ?? row.value}+ >+ {row.value}+ </span>+ </div>+ )}+ </For>+ </div>+ </div>+ </Show>+);++export function DockerHostDrawerOverview(props: DockerHostDrawerOverviewProps) {+ const docker = () => props.host.docker;+ const agent = () => props.host.agent;+ const linkedAgentId = () => cleanText(agent()?.agentId);++ const runtimeLabel = (): string => {+ const runtime = cleanText(docker()?.runtime) || 'Docker';+ const version =+ cleanText(docker()?.runtimeVersion) || cleanText(docker()?.dockerVersion);+ if (!version) return titleCase(runtime);+ return `${titleCase(runtime)} ${version}`;+ };++ const osLabel = (): string => {+ const dockerOs = cleanText(docker()?.os);+ const agentOs =+ cleanText(agent()?.osName) && cleanText(agent()?.osVersion)+ ? `${cleanText(agent()?.osName)} ${cleanText(agent()?.osVersion)}`+ : cleanText(agent()?.osName) || cleanText(agent()?.osVersion);+ return dockerOs || agentOs || '';+ };++ const uptimeSeconds = (): number => {+ if (typeof props.host.uptime === 'number' && props.host.uptime > 0) return props.host.uptime;+ if (typeof docker()?.uptimeSeconds === 'number' && (docker()?.uptimeSeconds ?? 0) > 0) {+ return docker()!.uptimeSeconds!;+ }+ return 0;+ };++ const memorySource = () => props.host.memory ?? agent()?.memory;+ const diskSource = () => props.host.disk;++ const systemRows = (): DockerOverviewRow[] => [+ {+ label: 'Name',+ value: cleanText(props.host.name) || props.host.id,+ title: props.host.name,+ },+ ...(cleanText(docker()?.hostname)+ ? [+ {+ label: 'Hostname',+ value: cleanText(docker()?.hostname),+ title: docker()?.hostname,+ } satisfies DockerOverviewRow,+ ]+ : []),+ { label: 'Status', value: formatStatus(props.host.status) },+ ...(uptimeSeconds() > 0+ ? [{ label: 'Uptime', value: formatUptime(uptimeSeconds()) } satisfies DockerOverviewRow]+ : []),+ ...(formatLastSeenRow(props.host.lastSeen) ? [formatLastSeenRow(props.host.lastSeen)!] : []),+ ];++ const runtimeRows = (): DockerOverviewRow[] => [+ { label: 'Engine', value: runtimeLabel(), title: docker()?.runtimeVersion },+ ...(osLabel()+ ? [{ label: 'OS', value: osLabel(), title: osLabel() } satisfies DockerOverviewRow]+ : []),+ ...(cleanText(docker()?.kernelVersion) || cleanText(agent()?.kernelVersion)+ ? [+ {+ label: 'Kernel',+ value: cleanText(docker()?.kernelVersion) || cleanText(agent()?.kernelVersion),+ title: docker()?.kernelVersion || agent()?.kernelVersion,+ } satisfies DockerOverviewRow,+ ]+ : []),+ ...(cleanText(docker()?.architecture)+ ? [+ {+ label: 'Arch',+ value: cleanText(docker()?.architecture),+ } satisfies DockerOverviewRow,+ ]+ : []),+ ...(cleanText(docker()?.agentVersion)+ ? [+ {+ label: 'Agent',+ value: cleanText(docker()?.agentVersion),+ } satisfies DockerOverviewRow,+ ]+ : []),+ ];++ const containerRows = (): DockerOverviewRow[] => {+ const count = docker()?.containerCount;+ const rows: DockerOverviewRow[] = [];+ if (typeof count === 'number') {+ rows.push({ label: 'Containers', value: `${count}` });+ }+ if (typeof docker()?.updatesAvailableCount === 'number') {+ rows.push({ label: 'Updates', value: `${docker()!.updatesAvailableCount}` });+ }+ if (hasDockerSwarmEvidence(props.host)) {+ const role = cleanText(docker()?.swarm?.nodeRole);+ if (role) rows.push({ label: 'Swarm role', value: titleCase(role) });+ const state = cleanText(docker()?.swarm?.localState);+ if (state) rows.push({ label: 'Swarm state', value: titleCase(state) });+ const cluster = cleanText(docker()?.swarm?.clusterName);+ if (cluster) rows.push({ label: 'Swarm cluster', value: cluster });+ }+ return rows;+ };++ const memoryRows = (): DockerOverviewRow[] => {+ const memory = memorySource();+ if (!memory) return [];+ const rows: DockerOverviewRow[] = [];+ if (typeof memory.total === 'number' && memory.total > 0) {+ rows.push({+ label: 'Usage',+ value: `${getUsedPercent(memory.used, memory.total)} · ${formatBytes(memory.used || 0)}`,+ });+ rows.push({ label: 'Total', value: formatBytes(memory.total) });+ if (typeof memory.free === 'number') {+ rows.push({ label: 'Free', value: formatBytes(memory.free) });+ }+ } else if (typeof memory.current === 'number') {+ rows.push({ label: 'Usage', value: formatPercent(memory.current) });+ } else if (typeof (memory as { usage?: number }).usage === 'number') {+ rows.push({ label: 'Usage', value: formatPercent((memory as { usage?: number }).usage) });+ }+ return rows;+ };++ const storageRows = (): DockerOverviewRow[] => {+ const disk = diskSource();+ if (!disk) return [];+ const rows: DockerOverviewRow[] = [];+ if (typeof disk.total === 'number' && disk.total > 0) {+ rows.push({+ label: 'Usage',+ value: `${formatPercent(disk.current)} · ${formatBytes(disk.used || 0)}`,+ });+ rows.push({ label: 'Total', value: formatBytes(disk.total) });+ if (typeof disk.free === 'number') {+ rows.push({ label: 'Free', value: formatBytes(disk.free) });+ }+ } else if (typeof disk.current === 'number') {+ rows.push({ label: 'Usage', value: formatPercent(disk.current) });+ }+ return rows;+ };++ const telemetryRows = (): DockerOverviewRow[] => {+ const rows: DockerOverviewRow[] = [];+ rows.push({+ label: 'Connection',+ value: formatStatus(agent()?.connectionState || props.host.status),+ });+ rows.push({+ label: 'Agent ID',+ value: linkedAgentId() ? stripAgentPrefix(linkedAgentId()) : 'Direct API',+ title: linkedAgentId() || undefined,+ });+ const temperature = props.host.temperature ?? docker()?.temperature;+ if (typeof temperature === 'number' && temperature > 0) {+ rows.push({+ label: 'CPU temp',+ value: formatTemperature(temperature),+ valueClass: getTemperatureTextClass(temperature),+ });+ }+ if (typeof props.host.network?.rxBytes === 'number' || typeof props.host.network?.txBytes === 'number') {+ rows.push({+ label: 'Network I/O',+ value: `${formatSpeed(props.host.network?.rxBytes ?? 0)} / ${formatSpeed(props.host.network?.txBytes ?? 0)}`,+ });+ }+ if (typeof props.host.diskIO?.readRate === 'number' || typeof props.host.diskIO?.writeRate === 'number') {+ rows.push({+ label: 'Disk I/O',+ value: `${formatSpeed(props.host.diskIO?.readRate ?? 0)} / ${formatSpeed(props.host.diskIO?.writeRate ?? 0)}`,+ });+ }+ return rows;+ };++ return (+ <div class="flex flex-wrap gap-3 [&>*]:flex-1 [&>*]:basis-[calc(25%-0.75rem)] [&>*]:min-w-[200px] [&>*]:max-w-full [&>*]:overflow-hidden">+ <DetailCard title="System" rows={systemRows()} />+ <DetailCard title="Runtime" rows={runtimeRows()} />+ <DetailCard title="Containers" rows={containerRows()} />+ <DetailCard title="Memory" rows={memoryRows()} />+ <DetailCard title="Storage" rows={storageRows()} />+ <DetailCard title="Telemetry" rows={telemetryRows()} />+ </div>+ );+}diff --git a/frontend-modern/src/features/docker/DockerHostsTable.tsx b/frontend-modern/src/features/docker/DockerHostsTable.tsxindex 371effa65c..45702affce 100644--- a/frontend-modern/src/features/docker/DockerHostsTable.tsx+++ b/frontend-modern/src/features/docker/DockerHostsTable.tsx@@ -1,5 +1,6 @@-import { For, Show, createMemo, type Component, type JSX } from 'solid-js';+import { For, Show, createMemo, createSignal, type Component, type JSX } from 'solid-js';import { StatusDot } from '@/components/shared/StatusDot';+import { DockerHostDrawer } from './DockerHostDrawer';import { ResponsiveMetricCell } from '@/components/shared/responsive';import { TableCard } from '@/components/shared/TableCard';import { TableCardHeader } from '@/components/shared/TableCardHeader';@@ -119,6 +120,8 @@ export const DockerHostsTable: Component<{filter: filterPlatformResources,});const showSwarmColumn = createMemo(() => props.resources.some(hasDockerSwarmEvidence));+ const [selectedHostId, setSelectedHostId] = createSignal<string | null>(null);+ const drawerColspan = createMemo(() => (showSwarmColumn() ? 10 : 9));return (<Show@@ -232,8 +235,31 @@ export const DockerHostsTable: Component<{const disks = () => normalizeDiskArray(host.agent?.disks);const hasDiskMetric = () =>aggregateDisk() !== undefined || (disks()?.length ?? 0) > 0;+ const detailRowId = () => `docker-host-drawer-${host.id}`;+ const isSelected = () => selectedHostId() === host.id;+ const toggleDrawer = () =>+ setSelectedHostId((current) => (current === host.id ? null : host.id));+ const handleActivationKey: JSX.EventHandler<+ HTMLTableRowElement,+ KeyboardEvent+ > = (event) => {+ if (event.key !== 'Enter' && event.key !== ' ') return;+ event.preventDefault();+ toggleDrawer();+ };return (- <TableRow class="text-[11px] sm:text-xs">+ <>+ <TableRow+ class={`cursor-pointer text-[11px] outline-none sm:text-xs ${+ isSelected() ? 'bg-surface-hover' : ''+ } focus-visible:ring-2 focus-visible:ring-blue-500/60 focus-visible:ring-offset-1 focus-visible:ring-offset-surface`}+ aria-controls={isSelected() ? detailRowId() : undefined}+ aria-expanded={isSelected() ? 'true' : 'false'}+ data-docker-host-row={host.id}+ onClick={toggleDrawer}+ onKeyDown={handleActivationKey}+ tabIndex={0}+ ><TableCell class={`${getPlatformTableCellClass()} w-[40%] md:w-auto`}><div class="flex min-w-0 items-center gap-2"><StatusDot@@ -342,6 +368,23 @@ export const DockerHostsTable: Component<{</TableCell></Show></TableRow>+ <Show when={isSelected()}>+ <TableRow data-inline-docker-host-detail-for={host.id}>+ <TableCell+ id={detailRowId()}+ colspan={drawerColspan()}+ class="p-0 border-b border-border bg-surface-alt"+ >+ <div+ class="px-2 py-3 sm:px-4 sm:py-4"+ onClick={(event) => event.stopPropagation()}+ >+ <DockerHostDrawer host={host} />+ </div>+ </TableCell>+ </TableRow>+ </Show>+ </>);}}</For>diff --git a/frontend-modern/src/features/docker/dockerHostDrawerModel.ts b/frontend-modern/src/features/docker/dockerHostDrawerModel.tsnew file mode 100644index 0000000000..571fd3ef91--- /dev/null+++ b/frontend-modern/src/features/docker/dockerHostDrawerModel.ts@@ -0,0 +1,72 @@+import type { ResourceType as HistoryResourceType } from '@/api/charts';+import type { Resource } from '@/types/resource';++import type {+ GuestDrawerHistoryGroupConfig,+ GuestDrawerHistoryTarget,+} from '@/components/Workloads/guestDrawerModel';++export interface DockerHostDrawerHistoryTarget extends GuestDrawerHistoryTarget {+ resourceType: Extract<HistoryResourceType, 'agent'>;+}++const stripAgentPrefix = (value: string): string =>+ value.startsWith('agent:') ? value.slice('agent:'.length) : value;++// Docker hosts report the same agent telemetry shape as PVE nodes, so the+// drawer history backend is the same and the chart groups mirror+// NODE_DRAWER_HISTORY_GROUPS.+export const DOCKER_HOST_DRAWER_HISTORY_GROUPS: GuestDrawerHistoryGroupConfig[] = [+ {+ id: 'utilization',+ label: 'Utilization',+ unit: '%',+ series: [+ { metric: 'cpu', label: 'CPU', unit: '%', color: '#8b5cf6' },+ { metric: 'memory', label: 'Memory', unit: '%', color: '#f59e0b' },+ { metric: 'disk', label: 'Disk', unit: '%', color: '#10b981' },+ ],+ },+ {+ id: 'network',+ label: 'Network I/O',+ unit: 'B/s',+ series: [+ { metric: 'netin', label: 'In', unit: 'B/s', color: '#10b981' },+ { metric: 'netout', label: 'Out', unit: 'B/s', color: '#fb923c' },+ ],+ },+ {+ id: 'disk-io',+ label: 'Disk I/O',+ unit: 'B/s',+ series: [+ { metric: 'diskread', label: 'Read', unit: 'B/s', color: '#3b82f6' },+ { metric: 'diskwrite', label: 'Write', unit: 'B/s', color: '#f59e0b' },+ ],+ },+ {+ id: 'thermals',+ label: 'Thermals',+ unit: 'C',+ series: [{ metric: 'temperature', label: 'CPU', unit: 'C', color: '#ef4444' }],+ },+];++export const getDockerHostDrawerHistoryTarget = (+ host: Resource,+): DockerHostDrawerHistoryTarget | null => {+ const candidate = host.agent?.agentId || host.id || host.name || '';+ const resourceId = stripAgentPrefix(candidate.trim());+ if (!resourceId) return null;+ return { resourceType: 'agent', resourceId };+};++export const getDockerHostDrawerHistoryFallbackMetrics = (+ host: Resource,+): Record<string, number | undefined> => {+ const finite = (value: number | undefined): number | undefined =>+ typeof value === 'number' && Number.isFinite(value) ? value : undefined;+ const temperature = finite(host.temperature) ?? finite(host.docker?.temperature);+ return { temperature };+};