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.

docker + vsphere: bespoke host tables; project uptime/temp on docker-host adapter

rcourtman0fcf9944b3a6
diff --git a/frontend-modern/src/features/docker/DockerHostsTable.tsx b/frontend-modern/src/features/docker/DockerHostsTable.tsx
new file mode 100644
index 0000000000..ba33235d74
--- /dev/null
+++ b/frontend-modern/src/features/docker/DockerHostsTable.tsx
@@ -0,0 +1,210 @@
+import { For, Show, createMemo, createSignal, type Component, type JSX } from 'solid-js';
+import { Card } from '@/components/shared/Card';
+import { EmptyState } from '@/components/shared/EmptyState';
+import { FilterButtonGroup, type FilterOption } from '@/components/shared/FilterButtonGroup';
+import { SearchInput } from '@/components/shared/SearchInput';
+import { StatusDot } from '@/components/shared/StatusDot';
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from '@/components/shared/Table';
+import { getSimpleStatusIndicator } from '@/utils/status';
+import { asTrimmedString } from '@/utils/stringUtils';
+import {
+ filterPlatformResources,
+ type PlatformResourceStatusFilter,
+} from '@/features/platformPage/sharedPlatformPage';
+import type { Resource } from '@/types/resource';
+
+// Docker / Podman hosts are container hosts, not generic Pulse Agents.
+// The operator columns that matter are runtime (Docker vs Podman),
+// runtime version, container count, and Swarm role, alongside the
+// usual CPU / Memory / Disk / Uptime / Temperature from the agent
+// telemetry. The generic infrastructure table renders the metrics fine
+// but omits the runtime context that distinguishes a Docker host from
+// any other agent. This bespoke table reuses canonical shared
+// primitives and surfaces the Docker-native columns.
+
+const STATUS_FILTER_OPTIONS: FilterOption<PlatformResourceStatusFilter>[] = [
+ { value: 'all', label: 'All' },
+ { value: 'online', label: 'Healthy' },
+ { value: 'degraded', label: 'Degraded' },
+ { value: 'offline', label: 'Offline' },
+];
+
+const formatPercent = (percent?: number): JSX.Element => {
+ if (typeof percent !== 'number' || Number.isNaN(percent)) return <span class="text-muted">—</span>;
+ return <span class="tabular-nums">{percent.toFixed(1)}%</span>;
+};
+
+const formatUptime = (seconds: number | undefined): string => {
+ if (!seconds || seconds <= 0) return '—';
+ const days = Math.floor(seconds / 86_400);
+ if (days > 0) return `${days}d`;
+ const hours = Math.floor(seconds / 3_600);
+ if (hours > 0) return `${hours}h`;
+ const mins = Math.floor(seconds / 60);
+ return `${mins}m`;
+};
+
+const formatTemperature = (celsius: number | undefined): JSX.Element => {
+ if (typeof celsius !== 'number' || celsius <= 0) return <span class="text-muted">—</span>;
+ return <span class="tabular-nums">{celsius.toFixed(1)}°C</span>;
+};
+
+const runtimeLabel = (runtime: string | undefined): string => {
+ const normalized = (runtime || '').trim().toLowerCase();
+ if (normalized === 'docker') return 'Docker';
+ if (normalized === 'podman') return 'Podman';
+ return runtime || '—';
+};
+
+export const DockerHostsTable: Component<{
+ resources: Resource[];
+ emptyIcon: JSX.Element;
+ emptyTitle: string;
+ emptyDescription: string;
+}> = (props) => {
+ const [search, setSearch] = createSignal('');
+ const [status, setStatus] = createSignal<PlatformResourceStatusFilter>('all');
+
+ const filtered = createMemo(() => filterPlatformResources(props.resources, search(), status()));
+ const visible = createMemo(() => filtered().length);
+ const total = createMemo(() => props.resources.length);
+
+ return (
+ <Show
+ when={props.resources.length > 0}
+ fallback={
+ <Card padding="lg">
+ <EmptyState
+ icon={props.emptyIcon}
+ title={props.emptyTitle}
+ description={props.emptyDescription}
+ />
+ </Card>
+ }
+ >
+ <div class="space-y-3">
+ <div class="flex flex-wrap items-center gap-2">
+ <div class="min-w-[200px] flex-1 sm:max-w-xs">
+ <SearchInput
+ value={search}
+ onChange={setSearch}
+ placeholder="Search Docker hosts"
+ />
+ </div>
+ <FilterButtonGroup
+ options={STATUS_FILTER_OPTIONS}
+ value={status()}
+ onChange={setStatus}
+ />
+ <span class="ml-auto whitespace-nowrap text-xs font-medium text-muted">
+ <Show when={visible() !== total()} fallback={<>{total()} hosts</>}>
+ {visible()} of {total()} hosts
+ </Show>
+ </span>
+ </div>
+
+ <Show
+ when={filtered().length > 0}
+ fallback={
+ <Card padding="lg">
+ <EmptyState
+ icon={props.emptyIcon}
+ title="No hosts match current filters"
+ description="Adjust the search or status filter to see more hosts."
+ />
+ </Card>
+ }
+ >
+ <Card padding="none" tone="card" class="overflow-hidden">
+ <Table class="w-full min-w-[940px] border-collapse text-xs">
+ <TableHeader class="bg-surface-alt text-muted border-b border-border">
+ <TableRow class="text-left text-[10px] uppercase tracking-wide">
+ <TableHead class="px-3 py-2 font-medium">Host</TableHead>
+ <TableHead class="px-3 py-2 font-medium">Runtime</TableHead>
+ <TableHead class="px-3 py-2 font-medium">Version</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">Containers</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">CPU</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">Memory</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">Uptime</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">Temp</TableHead>
+ <TableHead class="px-3 py-2 font-medium">Swarm role</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody class="divide-y divide-border-subtle">
+ <For each={filtered()}>
+ {(host) => {
+ const docker = () => host.docker as
+ | (NonNullable<Resource['docker']> & {
+ runtime?: string;
+ runtimeVersion?: string;
+ containerCount?: number;
+ uptimeSeconds?: number;
+ temperature?: number;
+ swarm?: { nodeRole?: string };
+ })
+ | undefined;
+ const name = () => asTrimmedString(host.name) || host.id;
+ const runtime = () => runtimeLabel(docker()?.runtime);
+ const version = () => asTrimmedString(docker()?.runtimeVersion) || '—';
+ const containerCount = () => docker()?.containerCount ?? 0;
+ const swarmRole = () => {
+ const role = asTrimmedString(docker()?.swarm?.nodeRole);
+ return role ? role.charAt(0).toUpperCase() + role.slice(1) : '—';
+ };
+ const indicator = () => getSimpleStatusIndicator(host.status);
+ return (
+ <TableRow class="hover:bg-surface-hover">
+ <TableCell class="px-3 py-2">
+ <div class="flex items-center gap-2 min-w-0">
+ <StatusDot
+ size="sm"
+ variant={indicator().variant}
+ title={host.status || 'unknown'}
+ ariaHidden
+ />
+ <span class="font-semibold text-base-content truncate" title={name()}>
+ {name()}
+ </span>
+ </div>
+ </TableCell>
+ <TableCell class="px-3 py-2 text-base-content">{runtime()}</TableCell>
+ <TableCell class="px-3 py-2 text-base-content font-mono text-[11px]">
+ {version()}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content tabular-nums">
+ {containerCount()}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content">
+ {formatPercent(host.cpu?.current)}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content">
+ {formatPercent(host.memory?.current)}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content">
+ {formatUptime(host.uptime ?? docker()?.uptimeSeconds)}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content">
+ {formatTemperature(host.temperature ?? docker()?.temperature)}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-base-content">{swarmRole()}</TableCell>
+ </TableRow>
+ );
+ }}
+ </For>
+ </TableBody>
+ </Table>
+ </Card>
+ </Show>
+ </div>
+ </Show>
+ );
+};
+
+export default DockerHostsTable;
diff --git a/frontend-modern/src/features/docker/DockerPageSurface.tsx b/frontend-modern/src/features/docker/DockerPageSurface.tsx
index 3ea3567f8f..fa51320a8c 100644
--- a/frontend-modern/src/features/docker/DockerPageSurface.tsx
+++ b/frontend-modern/src/features/docker/DockerPageSurface.tsx
@@ -5,10 +5,10 @@ import { WorkloadsSurface } from '@/components/Workloads/WorkloadsSurface';
import { useUnifiedResources } from '@/hooks/useUnifiedResources';
import {
PlatformErrorState,
- PlatformResourceTable,
PlatformSectionTabs,
PlatformTableEmptyState,
} from '@/features/platformPage/sharedPlatformPage';
+import { DockerHostsTable } from './DockerHostsTable';
import { DockerServicesTable } from './DockerServicesTable';
import {
DOCKER_TAB_SPECS,
@@ -74,7 +74,7 @@ export function DockerPageSurface() {
}
>
<Show when={activeTab() === 'overview'}>
- <PlatformResourceTable
+ <DockerHostsTable
resources={model().hosts}
emptyIcon={dockerIcon()}
emptyTitle="No Docker hosts"
diff --git a/frontend-modern/src/features/vmware/VmwarePageSurface.tsx b/frontend-modern/src/features/vmware/VmwarePageSurface.tsx
index b73d1e6246..b7dc6d9b71 100644
--- a/frontend-modern/src/features/vmware/VmwarePageSurface.tsx
+++ b/frontend-modern/src/features/vmware/VmwarePageSurface.tsx
@@ -6,10 +6,10 @@ import { WorkloadsSurface } from '@/components/Workloads/WorkloadsSurface';
import { useUnifiedResources } from '@/hooks/useUnifiedResources';
import {
PlatformErrorState,
- PlatformResourceTable,
PlatformSectionTabs,
PlatformTableEmptyState,
} from '@/features/platformPage/sharedPlatformPage';
+import { VsphereHostsTable } from './VsphereHostsTable';
import {
VMWARE_TAB_SPECS,
buildVmwarePageModel,
@@ -74,8 +74,9 @@ export function VmwarePageSurface() {
}
>
<Show when={activeTab() === 'overview'}>
- <PlatformResourceTable
- resources={model().hosts}
+ <VsphereHostsTable
+ hosts={model().hosts}
+ scope={model().resources}
emptyIcon={vmwareIcon()}
emptyTitle="No vSphere hosts"
emptyDescription="Hosts appear here once the vCenter connection enumerates them."
diff --git a/frontend-modern/src/features/vmware/VsphereHostsTable.tsx b/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
new file mode 100644
index 0000000000..178448fc9d
--- /dev/null
+++ b/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
@@ -0,0 +1,222 @@
+import { For, Show, createMemo, createSignal, type Component, type JSX } from 'solid-js';
+import { Card } from '@/components/shared/Card';
+import { EmptyState } from '@/components/shared/EmptyState';
+import { FilterButtonGroup, type FilterOption } from '@/components/shared/FilterButtonGroup';
+import { SearchInput } from '@/components/shared/SearchInput';
+import { StatusDot } from '@/components/shared/StatusDot';
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableHead,
+ TableHeader,
+ TableRow,
+} from '@/components/shared/Table';
+import { getSimpleStatusIndicator } from '@/utils/status';
+import { asTrimmedString } from '@/utils/stringUtils';
+import {
+ filterPlatformResources,
+ type PlatformResourceStatusFilter,
+} from '@/features/platformPage/sharedPlatformPage';
+import type { Resource } from '@/types/resource';
+
+// vSphere ESXi hosts are virtualization hypervisors managed by vCenter,
+// not generic Pulse Agents. The generic infrastructure table renders
+// dashes for Uptime / Temperature (vCenter inventory does not expose
+// host uptime today) and lacks the columns that matter for the cluster
+// operator: datacenter, cluster, power state, connection state,
+// datastore count, and VM count alongside CPU / Memory utilisation.
+// This bespoke table reuses canonical shared primitives and surfaces
+// those ESXi-native columns. Per-host VM count is computed from the
+// page scope client-side (no extra API calls).
+
+const STATUS_FILTER_OPTIONS: FilterOption<PlatformResourceStatusFilter>[] = [
+ { value: 'all', label: 'All' },
+ { value: 'online', label: 'Healthy' },
+ { value: 'degraded', label: 'Degraded' },
+ { value: 'offline', label: 'Offline' },
+];
+
+const formatPercent = (percent?: number): JSX.Element => {
+ if (typeof percent !== 'number' || Number.isNaN(percent)) return <span class="text-muted">—</span>;
+ return <span class="tabular-nums">{percent.toFixed(1)}%</span>;
+};
+
+const powerStateVariant = (
+ state: string | undefined,
+): 'success' | 'warning' | 'danger' | 'muted' => {
+ const normalized = (state || '').trim().toUpperCase();
+ if (normalized === 'POWERED_ON') return 'success';
+ if (normalized === 'POWERED_OFF') return 'muted';
+ if (normalized === 'SUSPENDED') return 'warning';
+ return 'muted';
+};
+
+const formatPowerState = (state: string | undefined): string => {
+ const normalized = (state || '').trim();
+ if (!normalized) return '—';
+ return normalized
+ .split('_')
+ .map((part) => part.charAt(0) + part.slice(1).toLowerCase())
+ .join(' ');
+};
+
+export const VsphereHostsTable: Component<{
+ hosts: Resource[];
+ // Full vSphere scope so we can count VMs per host without spawning
+ // additional fetches.
+ scope: Resource[];
+ emptyIcon: JSX.Element;
+ emptyTitle: string;
+ emptyDescription: string;
+}> = (props) => {
+ const [search, setSearch] = createSignal('');
+ const [status, setStatus] = createSignal<PlatformResourceStatusFilter>('all');
+
+ const filtered = createMemo(() => filterPlatformResources(props.hosts, search(), status()));
+ const visible = createMemo(() => filtered().length);
+ const total = createMemo(() => props.hosts.length);
+
+ const vmCountByHost = createMemo(() => {
+ const map = new Map<string, number>();
+ for (const resource of props.scope) {
+ if (resource.type !== 'vm') continue;
+ const runtimeHost = asTrimmedString(resource.vmware?.runtimeHostId);
+ if (!runtimeHost) continue;
+ map.set(runtimeHost, (map.get(runtimeHost) ?? 0) + 1);
+ }
+ return map;
+ });
+
+ return (
+ <Show
+ when={props.hosts.length > 0}
+ fallback={
+ <Card padding="lg">
+ <EmptyState
+ icon={props.emptyIcon}
+ title={props.emptyTitle}
+ description={props.emptyDescription}
+ />
+ </Card>
+ }
+ >
+ <div class="space-y-3">
+ <div class="flex flex-wrap items-center gap-2">
+ <div class="min-w-[200px] flex-1 sm:max-w-xs">
+ <SearchInput
+ value={search}
+ onChange={setSearch}
+ placeholder="Search ESXi hosts"
+ />
+ </div>
+ <FilterButtonGroup
+ options={STATUS_FILTER_OPTIONS}
+ value={status()}
+ onChange={setStatus}
+ />
+ <span class="ml-auto whitespace-nowrap text-xs font-medium text-muted">
+ <Show when={visible() !== total()} fallback={<>{total()} hosts</>}>
+ {visible()} of {total()} hosts
+ </Show>
+ </span>
+ </div>
+
+ <Show
+ when={filtered().length > 0}
+ fallback={
+ <Card padding="lg">
+ <EmptyState
+ icon={props.emptyIcon}
+ title="No hosts match current filters"
+ description="Adjust the search or status filter to see more hosts."
+ />
+ </Card>
+ }
+ >
+ <Card padding="none" tone="card" class="overflow-hidden">
+ <Table class="w-full min-w-[960px] border-collapse text-xs">
+ <TableHeader class="bg-surface-alt text-muted border-b border-border">
+ <TableRow class="text-left text-[10px] uppercase tracking-wide">
+ <TableHead class="px-3 py-2 font-medium">Host</TableHead>
+ <TableHead class="px-3 py-2 font-medium">Datacenter</TableHead>
+ <TableHead class="px-3 py-2 font-medium">Cluster</TableHead>
+ <TableHead class="px-3 py-2 font-medium">Power</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">CPU</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">Memory</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">Datastores</TableHead>
+ <TableHead class="px-3 py-2 font-medium text-right">VMs</TableHead>
+ <TableHead class="px-3 py-2 font-medium">vCenter</TableHead>
+ </TableRow>
+ </TableHeader>
+ <TableBody class="divide-y divide-border-subtle">
+ <For each={filtered()}>
+ {(host) => {
+ const meta = () => host.vmware;
+ const name = () => asTrimmedString(host.name) || host.id;
+ const datacenter = () => asTrimmedString(meta()?.datacenterName) || '—';
+ const cluster = () => asTrimmedString(meta()?.clusterName) || '—';
+ const vcenter = () => asTrimmedString(meta()?.vcenterHost) || '—';
+ const datastoreCount = () => meta()?.datastoreIds?.length ?? meta()?.datastoreNames?.length ?? 0;
+ const vmCount = () =>
+ vmCountByHost().get(asTrimmedString(meta()?.managedObjectId) || '') ?? 0;
+ const indicator = () => getSimpleStatusIndicator(host.status);
+ return (
+ <TableRow class="hover:bg-surface-hover">
+ <TableCell class="px-3 py-2">
+ <div class="flex items-center gap-2 min-w-0">
+ <StatusDot
+ size="sm"
+ variant={indicator().variant}
+ title={host.status || 'unknown'}
+ ariaHidden
+ />
+ <span class="font-semibold text-base-content truncate" title={name()}>
+ {name()}
+ </span>
+ </div>
+ </TableCell>
+ <TableCell class="px-3 py-2 text-base-content">{datacenter()}</TableCell>
+ <TableCell class="px-3 py-2 text-base-content">{cluster()}</TableCell>
+ <TableCell class="px-3 py-2">
+ <div class="flex items-center gap-2">
+ <StatusDot
+ size="sm"
+ variant={powerStateVariant(meta()?.powerState)}
+ title={meta()?.powerState || 'unknown'}
+ ariaHidden
+ />
+ <span class="text-base-content">{formatPowerState(meta()?.powerState)}</span>
+ </div>
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content">
+ {formatPercent(host.cpu?.current)}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content">
+ {formatPercent(host.memory?.current)}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content tabular-nums">
+ {datastoreCount()}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-right text-base-content tabular-nums">
+ {vmCount()}
+ </TableCell>
+ <TableCell class="px-3 py-2 text-base-content font-mono text-[11px]">
+ <span class="truncate inline-block max-w-[12rem]" title={vcenter()}>
+ {vcenter()}
+ </span>
+ </TableCell>
+ </TableRow>
+ );
+ }}
+ </For>
+ </TableBody>
+ </Table>
+ </Card>
+ </Show>
+ </div>
+ </Show>
+ );
+};
+
+export default VsphereHostsTable;
diff --git a/internal/unifiedresources/adapters.go b/internal/unifiedresources/adapters.go
index 6014075580..7d03c3b758 100644
--- a/internal/unifiedresources/adapters.go
+++ b/internal/unifiedresources/adapters.go
@@ -1171,15 +1171,17 @@ func resourceFromDockerHost(host models.DockerHost) (Resource, ResourceIdentity)
metrics := metricsFromDockerHost(host)
resource := Resource{
- Type: ResourceTypeAgent,
- Technology: strings.TrimSpace(host.Runtime),
- Name: name,
- Status: statusFromString(host.Status),
- LastSeen: host.LastSeen,
- UpdatedAt: time.Now().UTC(),
- Metrics: metrics,
- Docker: docker,
- Tags: nil,
+ Type: ResourceTypeAgent,
+ Technology: strings.TrimSpace(host.Runtime),
+ Name: name,
+ Status: statusFromString(host.Status),
+ LastSeen: host.LastSeen,
+ UpdatedAt: time.Now().UTC(),
+ Metrics: metrics,
+ Uptime: host.UptimeSeconds,
+ Temperature: host.Temperature,
+ Docker: docker,
+ Tags: nil,
}
return resource, identity