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.

Align vSphere page with Proxmox/Docker layout

rcourtman2f464146cb9a
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 58fb868a42..7c8ba186b5 100644
--- a/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts
+++ b/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts
@@ -13,7 +13,6 @@ import truenasDisksTableSource from '@/features/truenas/TrueNASDisksTable.tsx?ra
import truenasPageSurfaceSource from '@/features/truenas/TrueNASPageSurface.tsx?raw';
import truenasSystemsTableSource from '@/features/truenas/TrueNASSystemsTable.tsx?raw';
import vmwarePageSurfaceSource from '@/features/vmware/VmwarePageSurface.tsx?raw';
-import vsphereDatastoresTableSource from '@/features/vmware/VsphereDatastoresTable.tsx?raw';
import vsphereHostsTableSource from '@/features/vmware/VsphereHostsTable.tsx?raw';
const platformTableSources = [
@@ -26,7 +25,6 @@ const platformTableSources = [
truenasSystemsTableSource,
truenasDisksTableSource,
vsphereHostsTableSource,
- vsphereDatastoresTableSource,
];
const platformToolbarTableSources = [
@@ -38,7 +36,6 @@ const platformToolbarTableSources = [
truenasSystemsTableSource,
truenasDisksTableSource,
vsphereHostsTableSource,
- vsphereDatastoresTableSource,
];
const overviewSurfaceSources = [
@@ -102,7 +99,8 @@ describe('platform overview layout guardrails', () => {
expect(truenasPageSurfaceSource).toContain('<TrueNASDisksTable');
expect(vmwarePageSurfaceSource).toContain('<VsphereHostsTable');
expect(vmwarePageSurfaceSource).toContain('<WorkloadsSurface');
- expect(vmwarePageSurfaceSource).toContain('<VsphereDatastoresTable');
+ expect(vmwarePageSurfaceSource).toContain('<StorageSurface');
+ expect(vmwarePageSurfaceSource).toContain('forcedView="pools"');
});
it('keeps secondary overview tables from rendering duplicate standalone toolbars', () => {
diff --git a/frontend-modern/src/features/vmware/VmwarePageSurface.tsx b/frontend-modern/src/features/vmware/VmwarePageSurface.tsx
index 89ef903d51..17466bf98c 100644
--- a/frontend-modern/src/features/vmware/VmwarePageSurface.tsx
+++ b/frontend-modern/src/features/vmware/VmwarePageSurface.tsx
@@ -1,8 +1,8 @@
import { useLocation } from '@solidjs/router';
import CpuIcon from 'lucide-solid/icons/cpu';
import { Show, createMemo } from 'solid-js';
+import StorageSurface from '@/components/Storage/Storage';
import { WorkloadsSurface } from '@/components/Workloads/WorkloadsSurface';
-import { VsphereDatastoresTable } from './VsphereDatastoresTable';
import { useUnifiedResources } from '@/hooks/useUnifiedResources';
import {
PlatformErrorState,
@@ -94,36 +94,15 @@ export function VmwarePageSurface() {
forcedPlatform={VMWARE_PLATFORM_FILTER}
compactGroupHeaders
/>
- <Show when={model().datastores.length > 0}>
- <VsphereDatastoresTable
- resources={model().datastores}
- emptyIcon={vmwareIcon()}
- emptyTitle="No vSphere datastores"
- emptyDescription="Datastores appear here once a vCenter connection enumerates them."
- showToolbar={false}
- />
- </Show>
</div>
</Show>
- <Show when={activeTab() === 'vms'}>
- <WorkloadsSurface
- vms={[]}
- containers={[]}
- nodes={[]}
- useWorkloads
+ <Show when={activeTab() === 'storage'}>
+ <StorageSurface
embedded
tableOnly
showFilterToolbar
- suppressPlatformFilter
- forcedPlatform={VMWARE_PLATFORM_FILTER}
- />
- </Show>
- <Show when={activeTab() === 'storage'}>
- <VsphereDatastoresTable
- resources={model().datastores}
- emptyIcon={vmwareIcon()}
- emptyTitle="No vSphere datastores"
- emptyDescription="Datastores appear here once a vCenter connection enumerates them."
+ forcedSourceFilter={VMWARE_PLATFORM_FILTER}
+ forcedView="pools"
/>
</Show>
</Show>
diff --git a/frontend-modern/src/features/vmware/VsphereDatastoresTable.tsx b/frontend-modern/src/features/vmware/VsphereDatastoresTable.tsx
deleted file mode 100644
index 4cdf8472e7..0000000000
--- a/frontend-modern/src/features/vmware/VsphereDatastoresTable.tsx
+++ /dev/null
@@ -1,294 +0,0 @@
-import { For, Show, type Component, type JSX } from 'solid-js';
-import { StatusDot } from '@/components/shared/StatusDot';
-import { TableCard } from '@/components/shared/TableCard';
-import { TableCardHeader } from '@/components/shared/TableCardHeader';
-import type { StatusIndicatorVariant } from '@/utils/status';
-import {
- Table,
- TableBody,
- TableCell,
- TableHead,
- TableHeader,
- TableRow,
-} from '@/components/shared/Table';
-import { formatBytes } from '@/utils/format';
-import { asTrimmedString } from '@/utils/stringUtils';
-import {
- PLATFORM_TABLE_BODY_CLASS,
- PLATFORM_TABLE_CARD_CLASS,
- PLATFORM_TABLE_HEADER_ROW_CLASS,
- PLATFORM_HEALTH_FILTER_OPTIONS,
- PlatformTableToolbar,
- PlatformTableEmptyState,
- createPlatformTableFilterState,
- getPlatformTableCellClass,
- getPlatformTableHeadClass,
-} from '@/features/platformPage/sharedPlatformPage';
-import type { Resource } from '@/types/resource';
-
-// vSphere storage is just datastores — there are no "physical disks"
-// on the Pulse side (vSphere doesn't expose them through the canonical
-// SMART pipeline). The previous /vmware/storage tab mounted the
-// generic <StorageSurface> which ships its own internal
-// Pools/Physical-disks switcher, so users could click "Physical disks"
-// and land on a confusing "No disks match these filters" empty state.
-// This bespoke table renders one row per datastore with the
-// VMware-specific facts an operator looks at: type (vSAN/NFS/VMFS/etc),
-// datacenter, capacity utilisation, hosts mounting it, shared/multi-host
-// access, maintenance mode, vCenter.
-
-type DatastoreStatusFilter = 'all' | 'online' | 'degraded' | 'offline';
-
-function indicatorFor(resource: Resource): {
- variant: StatusIndicatorVariant;
- label: string;
-} {
- const accessible = resource.vmware?.datastoreAccessible;
- const overall = (resource.vmware?.overallStatus ?? '').toLowerCase();
- if (accessible === false) return { variant: 'danger', label: 'Offline' };
- if (overall === 'red') return { variant: 'danger', label: 'Critical' };
- if (overall === 'yellow') return { variant: 'warning', label: 'Warning' };
- if (resource.status === 'offline') return { variant: 'danger', label: 'Offline' };
- if (resource.status === 'unknown') return { variant: 'warning', label: 'Unknown' };
- return { variant: 'success', label: 'Online' };
-}
-
-function classify(resource: Resource): DatastoreStatusFilter {
- const ind = indicatorFor(resource);
- if (ind.variant === 'danger') return 'offline';
- if (ind.variant === 'warning') return 'degraded';
- return 'online';
-}
-
-function datastoreTypeLabel(resource: Resource): string {
- return (
- asTrimmedString(resource.vmware?.datastoreType) ||
- asTrimmedString(resource.storage?.type) ||
- asTrimmedString(resource.technology) ||
- '—'
- );
-}
-
-function capacityCell(resource: Resource): JSX.Element {
- const pct = resource.disk?.current;
- const total = resource.disk?.total;
- if (typeof pct !== 'number' && (typeof total !== 'number' || total <= 0)) {
- return <span class="text-muted">—</span>;
- }
- const pctLabel = typeof pct === 'number' ? `${pct.toFixed(1)}%` : '—';
- const sizeLabel = typeof total === 'number' && total > 0 ? formatBytes(total) : null;
- return (
- <span class="tabular-nums">
- {pctLabel}
- {sizeLabel ? <span class="text-muted text-[10px]"> of {sizeLabel}</span> : null}
- </span>
- );
-}
-
-function hostsCell(resource: Resource): JSX.Element {
- const nodes = resource.storage?.nodes ?? [];
- if (nodes.length === 0) return <span class="text-muted">—</span>;
- return (
- <span class="tabular-nums">
- {nodes.length}
- <span
- class="text-muted text-[10px] inline-block max-w-[14rem] truncate align-bottom"
- title={nodes.join(', ')}
- >
- {' · '}
- {nodes.join(', ')}
- </span>
- </span>
- );
-}
-
-function accessLabel(resource: Resource): JSX.Element {
- const multi = resource.vmware?.multipleHostAccess;
- const shared = resource.storage?.shared;
- if (multi === true || shared === true) {
- return (
- <span class="inline-flex items-center rounded-sm bg-blue-100 px-1.5 py-0.5 text-[10px] font-semibold text-blue-700 dark:bg-blue-900/40 dark:text-blue-200">
- Shared
- </span>
- );
- }
- if (multi === false || shared === false) {
- return <span class="text-muted">Local</span>;
- }
- return <span class="text-muted">—</span>;
-}
-
-function maintenanceLabel(resource: Resource): JSX.Element {
- const mode = (resource.vmware?.maintenanceMode ?? '').toLowerCase();
- if (!mode || mode === 'normal') return <span class="text-muted">—</span>;
- return (
- <span class="inline-flex items-center rounded-sm bg-amber-100 px-1.5 py-0.5 text-[10px] font-semibold text-amber-700 dark:bg-amber-900/40 dark:text-amber-200">
- {mode}
- </span>
- );
-}
-
-export const VsphereDatastoresTable: Component<{
- resources: Resource[];
- emptyIcon: JSX.Element;
- emptyTitle: string;
- emptyDescription: string;
- title?: string;
- showToolbar?: boolean;
-}> = (props) => {
- const tableState = createPlatformTableFilterState<DatastoreStatusFilter>({
- resources: () => props.resources,
- initialStatus: 'all',
- filter: (resources, search, status) => {
- const term = search.trim().toLowerCase();
- return resources.filter((row) => {
- if (status !== 'all' && classify(row) !== status) return false;
- if (!term) return true;
- const haystack = [
- row.name,
- row.displayName,
- row.vmware?.datacenterName,
- row.vmware?.datastoreType,
- row.vmware?.connectionName,
- row.vmware?.vcenterHost,
- ...(row.storage?.nodes ?? []),
- ]
- .filter(Boolean)
- .join(' ')
- .toLowerCase();
- return haystack.includes(term);
- });
- },
- });
-
- return (
- <Show
- when={tableState.total() > 0}
- fallback={
- <PlatformTableEmptyState
- icon={props.emptyIcon}
- title={props.emptyTitle}
- description={props.emptyDescription}
- />
- }
- >
- <div class="space-y-3">
- <Show when={props.showToolbar !== false}>
- <PlatformTableToolbar
- search={tableState.search}
- onSearchChange={tableState.setSearch}
- searchPlaceholder="Search datastores, datacenters, hosts"
- status={tableState.status()}
- onStatusChange={tableState.setStatus}
- statusOptions={PLATFORM_HEALTH_FILTER_OPTIONS}
- visible={tableState.visible()}
- total={tableState.total()}
- rowNoun="datastores"
- />
- </Show>
-
- <Show
- when={tableState.filtered().length > 0}
- fallback={
- <PlatformTableEmptyState
- icon={props.emptyIcon}
- title="No datastores match current filters"
- description="Adjust the search or status filter to see more datastores."
- />
- }
- >
- <TableCard class={PLATFORM_TABLE_CARD_CLASS}>
- <TableCardHeader title={props.title ?? 'Datastores'} />
- <Table class="min-w-full table-fixed text-xs md:min-w-[1050px]">
- <TableHeader>
- <TableRow class={PLATFORM_TABLE_HEADER_ROW_CLASS}>
- <TableHead class={getPlatformTableHeadClass()}>Datastore</TableHead>
- <TableHead class={getPlatformTableHeadClass()}>Type</TableHead>
- <TableHead class={`${getPlatformTableHeadClass()} hidden md:table-cell`}>
- Datacenter
- </TableHead>
- <TableHead class={getPlatformTableHeadClass()}>Capacity</TableHead>
- <TableHead class={getPlatformTableHeadClass()}>Hosts</TableHead>
- <TableHead class={`${getPlatformTableHeadClass()} hidden md:table-cell`}>
- Access
- </TableHead>
- <TableHead class={`${getPlatformTableHeadClass()} hidden md:table-cell`}>
- Maintenance
- </TableHead>
- <TableHead class={`${getPlatformTableHeadClass()} hidden md:table-cell`}>
- vCenter
- </TableHead>
- </TableRow>
- </TableHeader>
- <TableBody class={PLATFORM_TABLE_BODY_CLASS}>
- <For each={tableState.filtered()}>
- {(row) => {
- const ind = indicatorFor(row);
- const name = asTrimmedString(row.name) || row.id;
- const datacenter = asTrimmedString(row.vmware?.datacenterName) || '—';
- const vcenter =
- asTrimmedString(row.vmware?.connectionName) ||
- asTrimmedString(row.vmware?.vcenterHost) ||
- '—';
- return (
- <TableRow class="text-[11px] sm:text-xs">
- <TableCell class={getPlatformTableCellClass()}>
- <div class="flex min-w-0 items-center gap-2">
- <StatusDot
- size="sm"
- variant={ind.variant}
- title={ind.label}
- ariaHidden
- />
- <span class="truncate font-semibold text-base-content" title={name}>
- {name}
- </span>
- </div>
- </TableCell>
- <TableCell
- class={`${getPlatformTableCellClass()} text-[10px] font-medium uppercase text-base-content`}
- >
- {datastoreTypeLabel(row)}
- </TableCell>
- <TableCell
- class={`${getPlatformTableCellClass()} hidden text-base-content md:table-cell`}
- >
- {datacenter}
- </TableCell>
- <TableCell class={`${getPlatformTableCellClass()} text-base-content`}>
- {capacityCell(row)}
- </TableCell>
- <TableCell class={`${getPlatformTableCellClass()} text-base-content`}>
- {hostsCell(row)}
- </TableCell>
- <TableCell
- class={`${getPlatformTableCellClass()} hidden text-base-content md:table-cell`}
- >
- {accessLabel(row)}
- </TableCell>
- <TableCell
- class={`${getPlatformTableCellClass()} hidden text-base-content md:table-cell`}
- >
- {maintenanceLabel(row)}
- </TableCell>
- <TableCell
- class={`${getPlatformTableCellClass()} hidden font-mono text-[11px] text-base-content md:table-cell`}
- >
- <span class="inline-block max-w-[12rem] truncate" title={vcenter}>
- {vcenter}
- </span>
- </TableCell>
- </TableRow>
- );
- }}
- </For>
- </TableBody>
- </Table>
- </TableCard>
- </Show>
- </div>
- </Show>
- );
-};
-
-export default VsphereDatastoresTable;
diff --git a/frontend-modern/src/features/vmware/VsphereHostsTable.tsx b/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
index 9b226ba0e4..dedd2d92fd 100644
--- a/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
+++ b/frontend-modern/src/features/vmware/VsphereHostsTable.tsx
@@ -1,7 +1,9 @@
import { For, Show, createMemo, type Component, type JSX } from 'solid-js';
import { StatusDot } from '@/components/shared/StatusDot';
+import { ResponsiveMetricCell } from '@/components/shared/responsive';
import { TableCard } from '@/components/shared/TableCard';
import { TableCardHeader } from '@/components/shared/TableCardHeader';
+import { StackedMemoryBar } from '@/components/Workloads/StackedMemoryBar';
import {
Table,
TableBody,
@@ -12,6 +14,7 @@ import {
} from '@/components/shared/Table';
import { getSimpleStatusIndicator } from '@/utils/status';
import { asTrimmedString } from '@/utils/stringUtils';
+import { buildMetricKeyForUnifiedResource } from '@/utils/metricsKeys';
import {
PLATFORM_TABLE_BODY_CLASS,
PLATFORM_TABLE_CARD_CLASS,
@@ -34,14 +37,21 @@ import type { Resource } from '@/types/resource';
// 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).
+// those ESXi-native columns — matching the Docker / Proxmox bar
+// treatment so the Overview stack reads as one consistent surface.
+// Per-host VM count is computed from the page scope client-side (no
+// extra API calls).
-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 finiteMetric = (value: number | undefined): number | undefined =>
+ typeof value === 'number' && Number.isFinite(value) ? value : undefined;
+
+const metricFallback = () => (
+ <div class="flex justify-center">
+ <span class="text-xs text-muted" aria-hidden="true">
+ —
+ </span>
+ </div>
+);
const powerStateVariant = (
state: string | undefined,
@@ -165,6 +175,15 @@ export const VsphereHostsTable: Component<{
const vmCount = () =>
vmCountByHost().get(asTrimmedString(meta()?.managedObjectId) || '') ?? 0;
const indicator = () => getSimpleStatusIndicator(host.status);
+ const metricsKey = () => buildMetricKeyForUnifiedResource(host);
+ const cpuPercent = () => finiteMetric(host.cpu?.current);
+ const memoryTotal = () => finiteMetric(host.memory?.total) ?? 0;
+ const memoryUsed = () => finiteMetric(host.memory?.used) ?? 0;
+ const memoryPercentOnly = () =>
+ memoryTotal() > 0 ? undefined : finiteMetric(host.memory?.current);
+ const hasMemoryMetric = () =>
+ memoryTotal() > 0 || memoryPercentOnly() !== undefined;
+ const canRenderMetrics = () => indicator().variant !== 'muted';
return (
<TableRow class="text-[11px] sm:text-xs">
<TableCell class={getPlatformTableCellClass()}>
@@ -204,14 +223,30 @@ export const VsphereHostsTable: Component<{
</div>
</TableCell>
<TableCell
- class={`${getPlatformTableCellClass('right')} text-base-content`}
+ class={`${getPlatformTableCellClass('right')} w-[20%] md:w-auto`}
>
- {formatPercent(host.cpu?.current)}
+ <ResponsiveMetricCell
+ class="w-full"
+ value={cpuPercent() ?? 0}
+ type="cpu"
+ resourceId={metricsKey()}
+ isRunning={canRenderMetrics() && cpuPercent() !== undefined}
+ showMobile={false}
+ />
</TableCell>
<TableCell
- class={`${getPlatformTableCellClass('right')} text-base-content`}
+ class={`${getPlatformTableCellClass('right')} w-[20%] md:w-auto`}
>
- {formatPercent(host.memory?.current)}
+ <Show
+ when={canRenderMetrics() && hasMemoryMetric()}
+ fallback={metricFallback()}
+ >
+ <StackedMemoryBar
+ used={memoryUsed()}
+ total={memoryTotal()}
+ percentOnly={memoryPercentOnly()}
+ />
+ </Show>
</TableCell>
<TableCell
class={`${getPlatformTableCellClass('right')} hidden text-base-content tabular-nums md:table-cell`}
diff --git a/frontend-modern/src/features/vmware/__tests__/vmwarePageModel.test.ts b/frontend-modern/src/features/vmware/__tests__/vmwarePageModel.test.ts
index bc627d9a1f..10547761b0 100644
--- a/frontend-modern/src/features/vmware/__tests__/vmwarePageModel.test.ts
+++ b/frontend-modern/src/features/vmware/__tests__/vmwarePageModel.test.ts
@@ -15,7 +15,7 @@ const makeResource = (resource: Partial<Resource> & Pick<Resource, 'id' | 'type'
describe('vmwarePageModel', () => {
it('declares the vSphere section set', () => {
- expect(VMWARE_TAB_SPECS.map((tab) => tab.id)).toEqual(['overview', 'vms', 'storage']);
+ expect(VMWARE_TAB_SPECS.map((tab) => tab.id)).toEqual(['overview', 'storage']);
});
it('buckets vSphere hosts and VMs and ignores non-vSphere resources', () => {
diff --git a/frontend-modern/src/features/vmware/vmwarePageModel.ts b/frontend-modern/src/features/vmware/vmwarePageModel.ts
index 2394b3f29a..38275b44ed 100644
--- a/frontend-modern/src/features/vmware/vmwarePageModel.ts
+++ b/frontend-modern/src/features/vmware/vmwarePageModel.ts
@@ -1,7 +1,7 @@
import { resolveResourcePlatformType } from '@/utils/sourcePlatforms';
import type { Resource, ResourceType } from '@/types/resource';
-export type VmwarePageTabId = 'overview' | 'vms' | 'storage';
+export type VmwarePageTabId = 'overview' | 'storage';
export type VmwareTabSpec = {
id: VmwarePageTabId;
@@ -9,9 +9,12 @@ export type VmwareTabSpec = {
path: string;
};
+// The Overview tab mirrors Proxmox: hosts on top, embedded WorkloadsSurface
+// (VMs) underneath grouped by host. A dedicated `vms` tab would just remount
+// the same WorkloadsSurface, so it's intentionally absent — the Workloads
+// filter inside Overview owns search/grouping for VMs.
export const VMWARE_TAB_SPECS: readonly VmwareTabSpec[] = [
- { id: 'overview', label: 'Hosts', path: '/vmware/overview' },
- { id: 'vms', label: 'Virtual machines', path: '/vmware/vms' },
+ { id: 'overview', label: 'Overview', path: '/vmware/overview' },
{ id: 'storage', label: 'Storage', path: '/vmware/storage' },
] as const;
diff --git a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
index 3ac0c6369e..dc9e0d3eb8 100644
--- a/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
+++ b/frontend-modern/src/routing/__tests__/resourceLinks.test.ts
@@ -58,7 +58,7 @@ describe('resource link routing contract', () => {
expect(VMWARE_PATH).toBe('/vmware');
expect(buildVmwarePath()).toBe('/vmware/overview');
- expect(buildVmwarePath('vms')).toBe('/vmware/vms');
+ expect(buildVmwarePath('storage')).toBe('/vmware/storage');
});
it('builds and parses workloads query params', () => {