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
Make vSphere VM table API-native
rcourtman2ee40382d729
diff --git a/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts b/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.tsindex cb95ca93e0..4cb5eba157 100644--- a/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts+++ b/frontend-modern/src/features/platformPage/__tests__/platformOverviewLayout.guardrails.test.ts@@ -26,6 +26,7 @@ import truenasVirtualMachinesTableSource from '@/features/truenas/TrueNASVirtualimport vmwarePageSurfaceSource from '@/features/vmware/VmwarePageSurface.tsx?raw';import vsphereDatastoresTableSource from '@/features/vmware/VsphereDatastoresTable.tsx?raw';import vsphereHostsTableSource from '@/features/vmware/VsphereHostsTable.tsx?raw';+import vsphereVirtualMachinesTableSource from '@/features/vmware/VsphereVirtualMachinesTable.tsx?raw';const platformTableSources = [proxmoxNodesTableSource,@@ -43,6 +44,7 @@ const platformTableSources = [truenasVirtualMachinesTableSource,vsphereDatastoresTableSource,vsphereHostsTableSource,+ vsphereVirtualMachinesTableSource,];const platformToolbarTableSources = [@@ -192,7 +194,8 @@ describe('platform overview layout guardrails', () => {expect(truenasStorageTopologyTableSource).toContain('md:min-w-[960px]');expect(truenasVirtualMachinesTableSource).toContain('md:min-w-[960px]');expect(vmwarePageSurfaceSource).toContain('<VsphereHostsTable');- expect(vmwarePageSurfaceSource).toContain('<WorkloadsSurface');+ expect(vmwarePageSurfaceSource).toContain('<VsphereVirtualMachinesTable');+ expect(vmwarePageSurfaceSource).not.toContain('<WorkloadsSurface');expect(vmwarePageSurfaceSource).toContain('<VsphereDatastoresTable');expect(vmwarePageSurfaceSource).not.toContain('<StorageSurface');expect(vmwarePageSurfaceSource).not.toContain('forcedView="pools"');diff --git a/frontend-modern/src/features/vmware/VmwarePageSurface.tsx b/frontend-modern/src/features/vmware/VmwarePageSurface.tsxindex d1618cbd58..74a96107b4 100644--- a/frontend-modern/src/features/vmware/VmwarePageSurface.tsx+++ b/frontend-modern/src/features/vmware/VmwarePageSurface.tsx@@ -1,12 +1,7 @@import { useLocation } from '@solidjs/router';import CpuIcon from 'lucide-solid/icons/cpu';import { Show, createMemo, type Accessor } from 'solid-js';-import { WorkloadsFilter } from '@/components/Workloads/WorkloadsFilter';-import { WorkloadsSurface } from '@/components/Workloads/WorkloadsSurface';-import { useWorkloadsState } from '@/components/Workloads/useWorkloadsState';-import type { WorkloadsStatusOption } from '@/components/Workloads/workloadsFilterModel';import { useUnifiedResources } from '@/hooks/useUnifiedResources';-import { resourceMatchesSearch } from '@/utils/resourceSearchMatch';import {PlatformErrorState,PlatformSectionTabs,@@ -21,19 +16,13 @@ import {type VmwarePageTabId,} from './vmwarePageModel';import { VsphereDatastoresTable } from './VsphereDatastoresTable';+import { VsphereVirtualMachinesTable } from './VsphereVirtualMachinesTable';// vSphere phase 1 projects ESXi hosts as canonical `agent`, virtual machines// as canonical `vm`, and datastores as canonical `storage`; provider-native// topology stays in VMware metadata under those shared resources.const VMWARE_RESOURCE_QUERY = 'type=agent,vm,storage';-const VMWARE_PLATFORM_FILTER = 'vmware-vsphere';const VALID_TABS = new Set<VmwarePageTabId>(VMWARE_TAB_SPECS.map((tab) => tab.id));-const VMWARE_VM_STATUS_OPTIONS: readonly WorkloadsStatusOption[] = [- { value: 'all', label: 'All' },- { value: 'running', label: 'Powered on' },- { value: 'degraded', label: 'Attention' },- { value: 'stopped', label: 'Powered off' },-];const vmwareIcon = () => <CpuIcon class="h-6 w-6 text-slate-400" />;@@ -111,91 +100,22 @@ interface VmwareOverviewProps {}function VmwareOverview(props: VmwareOverviewProps) {- const workloadsState = useWorkloadsState({- vms: [],- containers: [],- nodes: [],- useWorkloads: true,- embedded: true,- tableOnly: true,- forcedPlatform: VMWARE_PLATFORM_FILTER,- forcedViewMode: 'vm',- showFilterToolbar: true,- suppressPlatformFilter: true,- allowEmbeddedScopeFilters: true,- compactGroupHeaders: true,- });- const showSharedFilterToolbar = createMemo(- () =>- workloadsState.surfaceConnected() &&- workloadsState.surfaceInitialDataReceived() &&- workloadsState.allGuests().length > 0,- );- const filteredHosts = createMemo(() => {- const term = workloadsState.search().trim();- if (!term) return props.model().hosts;- return props.model().hosts.filter((host) => resourceMatchesSearch(host, term));- });-return (<div class="space-y-4">- <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 VM filters"- searchPlaceholder="Search vSphere VMs by name, VM ID, host, or status"- searchEmptyMessage="Recent vSphere VM searches appear here."- statusOptions={VMWARE_VM_STATUS_OPTIONS}- columnVisibility={workloadsState.workloadsFilterColumnVisibility()}- containerRuntimeFilter={workloadsState.containerRuntimeFilterConfig()}- hostFilter={undefined}- namespaceFilter={undefined}- platformFilter={undefined}- suppressTypeFilter- metricDisplayMode={workloadsState.workloadMetricDisplayMode}- setMetricDisplayMode={workloadsState.setWorkloadMetricDisplayMode}- metricHistoryRange={workloadsState.workloadMetricHistoryRange}- setMetricHistoryRange={workloadsState.setWorkloadMetricHistoryRange}- forcedPlatform={VMWARE_PLATFORM_FILTER}- pinnedSelectionActive={() =>- Boolean(- workloadsState.selectedGuestId() || workloadsState.focusedSummaryWorkloadGroupId(),- )- }- onClearPinnedSelection={workloadsState.clearPinnedSummaryScope}- />- </div>- </Show><VsphereHostsTable- hosts={filteredHosts()}+ hosts={props.model().hosts}scope={props.model().resources}emptyIcon={vmwareIcon()}emptyTitle="No vSphere hosts"emptyDescription="Hosts appear here once the vCenter connection enumerates them."showToolbar={false}/>- <WorkloadsSurface- state={workloadsState}- vms={[]}- containers={[]}- nodes={[]}- useWorkloads- embedded- tableOnly- forcedPlatform={VMWARE_PLATFORM_FILTER}- forcedViewMode="vm"- compactGroupHeaders+ <VsphereVirtualMachinesTable+ vms={props.model().vms}+ scope={props.model().resources}+ emptyIcon={vmwareIcon()}+ emptyTitle="No vSphere VMs"+ emptyDescription="Virtual machines appear here once the vCenter connection enumerates them."/></div>);diff --git a/frontend-modern/src/features/vmware/VsphereVirtualMachinesTable.tsx b/frontend-modern/src/features/vmware/VsphereVirtualMachinesTable.tsxnew file mode 100644index 0000000000..930d9485f4--- /dev/null+++ b/frontend-modern/src/features/vmware/VsphereVirtualMachinesTable.tsx@@ -0,0 +1,493 @@+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,+ TableCell,+ TableHead,+ TableHeader,+ TableRow,+} from '@/components/shared/Table';+import { buildMetricKeyForUnifiedResource } from '@/utils/metricsKeys';+import { formatBytes } from '@/utils/format';+import { getSimpleStatusIndicator } from '@/utils/status';+import { asTrimmedString } from '@/utils/stringUtils';+import {+ PLATFORM_TABLE_BODY_CLASS,+ PLATFORM_TABLE_CARD_CLASS,+ PLATFORM_TABLE_HEADER_ROW_CLASS,+ PlatformTableEmptyState,+ PlatformTableToolbar,+ createPlatformTableFilterState,+ getPlatformTableCellClassForKind,+ getPlatformTableHeadClassForKind,+ type PlatformTableFilterOption,+} from '@/features/platformPage/sharedPlatformPage';+import {+ PlatformResourceDetailTableRow,+ createPlatformResourceDetailState,+ createPlatformResourceLabelResolver,+ getPlatformResourceDetailRowClass,+} from '@/features/platformPage/PlatformResourceDetailTableRow';+import type { Resource } from '@/types/resource';+import {+ filterVmwareVirtualMachines,+ mapVmwareVirtualMachineStatus,+ type VmwareVirtualMachineStatusFilter,+} from './vmwarePageModel';++const VSPHERE_VM_STATUS_OPTIONS: PlatformTableFilterOption<VmwareVirtualMachineStatusFilter>[] = [+ { value: 'all', label: 'All' },+ {+ value: 'powered-on',+ label: 'Powered on',+ tone: 'success',+ leading: statusDot('bg-emerald-500'),+ },+ { value: 'attention', label: 'Attention', tone: 'warning', leading: statusDot('bg-amber-500') },+ { value: 'powered-off', label: 'Powered off', tone: 'danger', leading: statusDot('bg-red-500') },+ { value: 'suspended', label: 'Suspended', tone: 'warning' },+ { value: 'unknown', label: 'Unknown' },+];++type VmwareVmGroup = {+ key: string;+ label: string;+ cluster: string;+ rows: Resource[];+};++const finiteMetric = (value: number | undefined): number | undefined =>+ typeof value === 'number' && Number.isFinite(value) ? value : undefined;++function statusDot(className: string): JSX.Element {+ return <span class={`h-2 w-2 rounded-full ${className}`} />;+}++const metricFallback = () => (+ <div class="flex justify-center">+ <span class="text-xs text-muted" aria-hidden="true">+ -+ </span>+ </div>+);++const normalizeToken = (value: string | undefined): string =>+ (value || '')+ .trim()+ .toLowerCase()+ .replace(/[\s_-]/g, '');++const vmName = (resource: Resource): string =>+ asTrimmedString(resource.displayName) || asTrimmedString(resource.name) || resource.id;++const formatVmwarePowerState = (value: string | undefined): string => {+ const normalized = normalizeToken(value);+ if (normalized === 'poweredon' || normalized === 'on') return 'On';+ if (normalized === 'poweredoff' || normalized === 'off') return 'Off';+ if (normalized === 'suspended') return 'Suspended';+ return asTrimmedString(value) || 'Unknown';+};++const powerStateVariant = (+ state: string | undefined,+): 'success' | 'warning' | 'danger' | 'muted' => {+ const normalized = normalizeToken(state);+ if (normalized === 'poweredon' || normalized === 'on') return 'success';+ if (normalized === 'poweredoff' || normalized === 'off') return 'danger';+ if (normalized === 'suspended') return 'warning';+ return 'muted';+};++const summarizeValues = (+ values: Array<string | undefined>,+ empty = '-',+ visibleCount = 2,+): { label: string; title: string } => {+ const compact = values+ .map((value) => asTrimmedString(value))+ .filter((value): value is string => Boolean(value));+ if (compact.length === 0) return { label: empty, title: '' };+ const visible = compact.slice(0, visibleCount);+ const suffix = compact.length > visible.length ? ` +${compact.length - visible.length}` : '';+ return { label: `${visible.join(', ')}${suffix}`, title: compact.join(', ') };+};++const formatGuest = (resource: Resource): { label: string; detail: string; title: string } => {+ const family = asTrimmedString(resource.vmware?.guestOsFamily);+ const host = asTrimmedString(resource.vmware?.guestHostname);+ const ips = summarizeValues(resource.vmware?.guestIpAddresses ?? [], '', 1);+ return {+ label: family || host || ips.label || '-',+ detail: host || ips.label,+ title: [family, host, ips.title].filter(Boolean).join(' | '),+ };+};++const healthLabel = (resource: Resource): string => {+ const alarms = resource.vmware?.activeAlarmCount ?? 0;+ if (alarms > 0) return `${alarms} alarm${alarms === 1 ? '' : 's'}`;+ const overall = asTrimmedString(resource.vmware?.overallStatus);+ if (!overall) return 'Unknown';+ if (overall.toLowerCase() === 'green') return 'Healthy';+ return overall.charAt(0).toUpperCase() + overall.slice(1).toLowerCase();+};++const healthPillClass = (resource: Resource): string => {+ const status = mapVmwareVirtualMachineStatus(resource);+ if (status === 'attention') {+ const overall = asTrimmedString(resource.vmware?.overallStatus)?.toLowerCase();+ if (overall === 'red') return 'border-red-300/50 bg-red-500/10 text-red-700 dark:text-red-300';+ return 'border-amber-300/50 bg-amber-500/10 text-amber-700 dark:text-amber-300';+ }+ if (status === 'powered-on') {+ return 'border-emerald-300/50 bg-emerald-500/10 text-emerald-700 dark:text-emerald-300';+ }+ if (status === 'powered-off') {+ return 'border-border bg-surface-alt text-muted';+ }+ return 'border-border bg-surface-alt text-muted';+};++const HealthPill: Component<{ resource: Resource }> = (props) => (+ <span+ class={`inline-flex items-center rounded border px-1.5 py-0.5 text-[10px] font-medium ${healthPillClass(+ props.resource,+ )}`}+ >+ {healthLabel(props.resource)}+ </span>+);++const vmGroupKey = (resource: Resource): string =>+ asTrimmedString(resource.vmware?.runtimeHostName) ||+ asTrimmedString(resource.parentName) ||+ 'Unassigned host';++const vmGroupCluster = (resource: Resource): string =>+ asTrimmedString(resource.vmware?.clusterName) ||+ asTrimmedString(resource.vmware?.computeResourceName) ||+ '';++const groupVirtualMachines = (vms: Resource[]): VmwareVmGroup[] => {+ const groups: VmwareVmGroup[] = [];+ const byKey = new Map<string, VmwareVmGroup>();+ for (const vm of vms) {+ const label = vmGroupKey(vm);+ const key = label.toLowerCase();+ let group = byKey.get(key);+ if (!group) {+ group = { key, label, cluster: vmGroupCluster(vm), rows: [] };+ byKey.set(key, group);+ groups.push(group);+ }+ if (!group.cluster) group.cluster = vmGroupCluster(vm);+ group.rows.push(vm);+ }+ return groups;+};++export const VsphereVirtualMachinesTable: Component<{+ vms: Resource[];+ scope: Resource[];+ emptyIcon: JSX.Element;+ emptyTitle: string;+ emptyDescription: string;+ showToolbar?: boolean;+}> = (props) => {+ const tableState = createPlatformTableFilterState({+ resources: () => props.vms,+ initialStatus: 'all' as VmwareVirtualMachineStatusFilter,+ filter: filterVmwareVirtualMachines,+ });+ const groups = createMemo(() => groupVirtualMachines(tableState.filtered()));+ const drawer = createPlatformResourceDetailState({ idPrefix: 'vsphere-vm-drawer' });+ const resolveResourceLabel = createPlatformResourceLabelResolver(() => props.scope);++ return (+ <Show+ when={props.vms.length > 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 vSphere VMs"+ status={tableState.status()}+ onStatusChange={tableState.setStatus}+ statusOptions={VSPHERE_VM_STATUS_OPTIONS}+ visible={tableState.visible()}+ total={tableState.total()}+ rowNoun="VMs"+ />+ </Show>++ <Show+ when={tableState.filtered().length > 0}+ fallback={+ <PlatformTableEmptyState+ icon={props.emptyIcon}+ title="No VMs match current filters"+ description="Adjust the search or power-state filter to see more vSphere VMs."+ />+ }+ >+ <TableCard class={PLATFORM_TABLE_CARD_CLASS}>+ <TableCardHeader title="Virtual Machines" />+ <Table class="min-w-full table-fixed text-xs md:min-w-[1440px]">+ <TableHeader>+ <TableRow class={PLATFORM_TABLE_HEADER_ROW_CLASS}>+ <TableHead class={`${getPlatformTableHeadClassForKind('name')} md:w-[18%]`}>+ VM+ </TableHead>+ <TableHead class={`${getPlatformTableHeadClassForKind('text')} md:w-[8%]`}>+ Power+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[12%]`}+ >+ Host+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('text')} hidden md:table-cell md:w-[10%]`}+ >+ Cluster+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('text')} hidden lg:table-cell md:w-[10%]`}+ >+ Pool+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('text')} hidden lg:table-cell md:w-[12%]`}+ >+ Guest+ </TableHead>+ <TableHead class={`${getPlatformTableHeadClassForKind('metric-bar')} md:w-[9%]`}>+ CPU+ </TableHead>+ <TableHead class={`${getPlatformTableHeadClassForKind('metric-bar')} md:w-[11%]`}>+ Memory+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('text')} hidden xl:table-cell md:w-[8%]`}+ >+ Datastores+ </TableHead>+ <TableHead+ class={`${getPlatformTableHeadClassForKind('numeric-value')} hidden md:table-cell md:w-[6%]`}+ >+ Snapshots+ </TableHead>+ <TableHead class={`${getPlatformTableHeadClassForKind('badge')} md:w-[8%]`}>+ Health+ </TableHead>+ </TableRow>+ </TableHeader>+ <TableBody class={PLATFORM_TABLE_BODY_CLASS}>+ <For each={groups()}>+ {(group) => (+ <>+ <TableRow class="bg-surface-alt/70 text-[11px] font-semibold text-base-content">+ <TableCell colSpan={11} class="px-2 py-1">+ <span>{group.label}</span>+ <Show when={group.cluster}>+ <span class="ml-2 rounded border border-border bg-surface px-1.5 py-0.5 text-[10px] font-medium text-muted">+ {group.cluster}+ </span>+ </Show>+ </TableCell>+ </TableRow>+ <For each={group.rows}>+ {(vm) => {+ const meta = () => vm.vmware;+ const name = () => vmName(vm);+ const indicator = () => getSimpleStatusIndicator(vm.status);+ const power = () => formatVmwarePowerState(meta()?.powerState);+ const host = () =>+ asTrimmedString(meta()?.runtimeHostName) ||+ asTrimmedString(vm.parentName) ||+ '-';+ const cluster = () =>+ asTrimmedString(meta()?.clusterName) ||+ asTrimmedString(meta()?.computeResourceName) ||+ '-';+ const pool = () => asTrimmedString(meta()?.resourcePoolName) || '-';+ const guest = createMemo(() => formatGuest(vm));+ const datastores = createMemo(() =>+ summarizeValues(meta()?.datastoreNames ?? [], '-', 1),+ );+ const snapshots = () => Math.max(0, meta()?.snapshotCount ?? 0);+ const metricsKey = () => buildMetricKeyForUnifiedResource(vm);+ const cpuPercent = () => finiteMetric(vm.cpu?.current);+ const memoryTotal = () => finiteMetric(vm.memory?.total) ?? 0;+ const memoryUsed = () => finiteMetric(vm.memory?.used) ?? 0;+ const memoryPercentOnly = () =>+ memoryTotal() > 0 ? undefined : finiteMetric(vm.memory?.current);+ const hasMemoryMetric = () =>+ memoryTotal() > 0 || memoryPercentOnly() !== undefined;+ const canRenderMetrics = () => indicator().variant !== 'muted';+ const memoryTitle = () =>+ memoryTotal() > 0+ ? `${formatBytes(memoryUsed())} / ${formatBytes(memoryTotal())}`+ : '';+ const detailRowId = () => drawer.detailRowId(vm);+ const isExpanded = () => drawer.isExpanded(vm);++ return (+ <>+ <TableRow+ class={`${getPlatformResourceDetailRowClass(isExpanded())} text-[11px] sm:text-xs`}+ aria-controls={isExpanded() ? detailRowId() : undefined}+ aria-expanded={isExpanded() ? 'true' : 'false'}+ data-vsphere-vm-row={vm.id}+ onClick={() => drawer.toggle(vm)}+ onKeyDown={drawer.handleActivationKey(vm)}+ tabIndex={0}+ >+ <TableCell class={getPlatformTableCellClassForKind('name')}>+ <div class="flex min-w-0 items-center gap-2">+ <StatusDot+ size="sm"+ variant={indicator().variant}+ title={indicator().label}+ />+ <div class="min-w-0">+ <div+ class="truncate font-medium text-base-content"+ title={name()}+ >+ {name()}+ </div>+ <div+ class="truncate text-[10px] text-muted"+ title={meta()?.managedObjectId}+ >+ {meta()?.managedObjectId ||+ meta()?.instanceUuid ||+ 'vSphere VM'}+ </div>+ </div>+ </div>+ </TableCell>+ <TableCell class={getPlatformTableCellClassForKind('text')}>+ <div class="flex items-center gap-2">+ <StatusDot+ size="sm"+ variant={powerStateVariant(meta()?.powerState)}+ title={meta()?.powerState || 'unknown'}+ ariaHidden+ />+ <span class="truncate text-base-content" title={power()}>+ {power()}+ </span>+ </div>+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content md:table-cell`}+ title={host()}+ >+ <span class="block truncate">{host()}</span>+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content md:table-cell`}+ title={cluster()}+ >+ <span class="block truncate">{cluster()}</span>+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content lg:table-cell`}+ title={pool()}+ >+ <span class="block truncate">{pool()}</span>+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content lg:table-cell`}+ title={guest().title}+ >+ <span class="block truncate">{guest().label}</span>+ <Show when={guest().detail && guest().detail !== guest().label}>+ <span class="block truncate text-[10px] text-muted">+ {guest().detail}+ </span>+ </Show>+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('metric-bar')} w-[20%] md:w-auto`}+ >+ <ResponsiveMetricCell+ class="w-full"+ value={cpuPercent() ?? 0}+ type="cpu"+ resourceId={metricsKey()}+ isRunning={canRenderMetrics() && cpuPercent() !== undefined}+ showMobile={false}+ />+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('metric-bar')} w-[20%] md:w-auto`}+ title={memoryTitle()}+ >+ <Show+ when={canRenderMetrics() && hasMemoryMetric()}+ fallback={metricFallback()}+ >+ <StackedMemoryBar+ used={memoryUsed()}+ total={memoryTotal()}+ percentOnly={memoryPercentOnly()}+ />+ </Show>+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('text')} hidden text-base-content xl:table-cell`}+ title={datastores().title}+ >+ <span class="block truncate">{datastores().label}</span>+ </TableCell>+ <TableCell+ class={`${getPlatformTableCellClassForKind('numeric-value')} hidden text-base-content tabular-nums md:table-cell`}+ >+ {snapshots()}+ </TableCell>+ <TableCell class={getPlatformTableCellClassForKind('badge')}>+ <HealthPill resource={vm} />+ </TableCell>+ </TableRow>+ <PlatformResourceDetailTableRow+ resource={vm}+ open={isExpanded()}+ detailRowId={detailRowId()}+ colSpan={11}+ resolveResourceLabel={resolveResourceLabel}+ onClose={() => drawer.close(vm)}+ />+ </>+ );+ }}+ </For>+ </>+ )}+ </For>+ </TableBody>+ </Table>+ </TableCard>+ </Show>+ </div>+ </Show>+ );+};++export default VsphereVirtualMachinesTable;diff --git a/frontend-modern/src/features/vmware/__tests__/VsphereVirtualMachinesTable.test.tsx b/frontend-modern/src/features/vmware/__tests__/VsphereVirtualMachinesTable.test.tsxnew file mode 100644index 0000000000..c8eed20fca--- /dev/null+++ b/frontend-modern/src/features/vmware/__tests__/VsphereVirtualMachinesTable.test.tsx@@ -0,0 +1,102 @@+import { cleanup, fireEvent, render, screen, within } from '@solidjs/testing-library';+import { afterEach, describe, expect, it, vi } from 'vitest';++import { VsphereVirtualMachinesTable } from '@/features/vmware/VsphereVirtualMachinesTable';+import type { Resource } from '@/types/resource';++vi.mock('@/components/shared/responsive', () => ({+ ResponsiveMetricCell: () => <div data-testid="metric-cell">metric</div>,+}));++vi.mock('@/components/Workloads/StackedMemoryBar', () => ({+ StackedMemoryBar: () => <div data-testid="memory-cell">memory</div>,+}));++const makeVM = (overrides: Partial<Resource> & Pick<Resource, 'id'>): Resource =>+ ({+ type: 'vm',+ name: overrides.id,+ displayName: overrides.id,+ status: 'online',+ platformType: 'vmware-vsphere',+ platformScopes: ['vmware-vsphere'],+ sourceType: 'api',+ cpu: { current: 28 },+ memory: { current: 55, used: 4_400_000_000, total: 8_000_000_000 },+ vmware: {+ entityType: 'vm',+ managedObjectId: 'vm-201',+ powerState: 'POWERED_ON',+ overallStatus: 'green',+ runtimeHostName: 'esxi-01.lab.local',+ clusterName: 'Production Cluster',+ resourcePoolName: 'Tier 1',+ guestOsFamily: 'LINUX',+ guestHostname: 'warehouse-api-01.internal',+ guestIpAddresses: ['10.42.10.21'],+ datastoreNames: ['nvme-primary', 'backup-nfs'],+ snapshotCount: 2,+ },+ ...overrides,+ }) as Resource;++afterEach(() => {+ cleanup();+});++describe('VsphereVirtualMachinesTable', () => {+ it('renders vCenter VM inventory fields instead of generic workload columns', async () => {+ const warehouse = makeVM({ id: 'warehouse-api-01', name: 'warehouse-api-01' });+ const archive = makeVM({+ id: 'cold-archive-01',+ name: 'cold-archive-01',+ status: 'stopped',+ vmware: {+ entityType: 'vm',+ managedObjectId: 'vm-301',+ powerState: 'poweredOff',+ runtimeHostName: 'esxi-03.lab.local',+ clusterName: 'Archive Cluster',+ resourcePoolName: 'Cold',+ guestOsFamily: 'LINUX',+ datastoreNames: ['archive-tier'],+ snapshotCount: 0,+ },+ });++ render(() => (+ <VsphereVirtualMachinesTable+ vms={[warehouse, archive]}+ scope={[warehouse, archive]}+ emptyIcon={<span />}+ emptyTitle="No VMs"+ emptyDescription="No VMs"+ showToolbar={false}+ />+ ));++ const table = screen.getByRole('table');+ expect(within(table).getByText('VM')).toBeInTheDocument();+ expect(within(table).getByText('Power')).toBeInTheDocument();+ expect(within(table).getByText('Host')).toBeInTheDocument();+ expect(within(table).getByText('Pool')).toBeInTheDocument();+ expect(within(table).getByText('Guest')).toBeInTheDocument();+ expect(within(table).getByText('Snapshots')).toBeInTheDocument();+ expect(within(table).getByText('Health')).toBeInTheDocument();+ expect(within(table).queryByRole('columnheader', { name: 'ID' })).not.toBeInTheDocument();+ expect(within(table).queryByRole('columnheader', { name: 'Uptime' })).not.toBeInTheDocument();+ expect(within(table).queryByRole('columnheader', { name: 'Backup' })).not.toBeInTheDocument();+ expect(screen.getAllByText('esxi-01.lab.local')).toHaveLength(2);+ expect(screen.getByText('Tier 1')).toBeInTheDocument();+ expect(screen.getByText('warehouse-api-01.internal')).toBeInTheDocument();+ expect(screen.getByText('nvme-primary +1')).toBeInTheDocument();+ expect(screen.getByText('Healthy')).toBeInTheDocument();++ const row = screen.getByText('warehouse-api-01').closest('tr');+ expect(row).toHaveAttribute('aria-expanded', 'false');++ await fireEvent.click(row!);++ expect(row).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.tsindex 3145906175..4cad1cdd98 100644--- a/frontend-modern/src/features/vmware/__tests__/vmwarePageModel.test.ts+++ b/frontend-modern/src/features/vmware/__tests__/vmwarePageModel.test.ts@@ -4,7 +4,9 @@ import {VMWARE_TAB_SPECS,buildVmwarePageModel,filterVmwareDatastores,+ filterVmwareVirtualMachines,mapVmwareDatastoreStatus,+ mapVmwareVirtualMachineStatus,} from '../vmwarePageModel';const makeResource = (resource: Partial<Resource> & Pick<Resource, 'id' | 'type'>): Resource => ({@@ -108,4 +110,66 @@ describe('vmwarePageModel', () => {),).toEqual(['ds-inaccessible']);});++ it('filters vSphere VMs using vCenter VM metadata', () => {+ const poweredOn = makeResource({+ id: 'vm-powered-on',+ type: 'vm',+ name: 'warehouse-api-01',+ vmware: {+ entityType: 'vm',+ powerState: 'POWERED_ON',+ runtimeHostName: 'esxi-01.lab.local',+ clusterName: 'Production Cluster',+ resourcePoolName: 'Tier 1',+ guestHostname: 'warehouse-api-01.internal',+ guestIpAddresses: ['10.42.10.21'],+ datastoreNames: ['nvme-primary'],+ },+ });+ const attention = makeResource({+ id: 'vm-attention',+ type: 'vm',+ name: 'warehouse-db-01',+ status: 'degraded',+ vmware: {+ entityType: 'vm',+ powerState: 'POWERED_ON',+ overallStatus: 'yellow',+ activeAlarmCount: 1,+ activeAlarmSummary: 'Snapshot age warning',+ runtimeHostName: 'esxi-02.lab.local',+ },+ });+ const poweredOff = makeResource({+ id: 'vm-powered-off',+ type: 'vm',+ name: 'cold-archive-01',+ status: 'stopped',+ vmware: {+ entityType: 'vm',+ powerState: 'poweredOff',+ runtimeHostName: 'esxi-03.lab.local',+ },+ });++ expect(mapVmwareVirtualMachineStatus(poweredOn)).toBe('powered-on');+ expect(mapVmwareVirtualMachineStatus(attention)).toBe('attention');+ expect(mapVmwareVirtualMachineStatus(poweredOff)).toBe('powered-off');+ expect(+ filterVmwareVirtualMachines([poweredOn, attention, poweredOff], 'tier 1', 'powered-on').map(+ (resource) => resource.id,+ ),+ ).toEqual(['vm-powered-on']);+ expect(+ filterVmwareVirtualMachines([poweredOn, attention, poweredOff], 'snapshot', 'attention').map(+ (resource) => resource.id,+ ),+ ).toEqual(['vm-attention']);+ expect(+ filterVmwareVirtualMachines([poweredOn, attention, poweredOff], 'esxi-03', 'all').map(+ (resource) => resource.id,+ ),+ ).toEqual(['vm-powered-off']);+ });});diff --git a/frontend-modern/src/features/vmware/vmwarePageModel.ts b/frontend-modern/src/features/vmware/vmwarePageModel.tsindex 241f21e7ba..e2d4d30d9a 100644--- a/frontend-modern/src/features/vmware/vmwarePageModel.ts+++ b/frontend-modern/src/features/vmware/vmwarePageModel.ts@@ -9,6 +9,13 @@ export type VmwareDatastoreStatusFilter =| 'inaccessible'| 'maintenance'| 'unknown';+export type VmwareVirtualMachineStatusFilter =+ | 'all'+ | 'powered-on'+ | 'attention'+ | 'powered-off'+ | 'suspended'+ | 'unknown';export type VmwareTabSpec = {id: VmwarePageTabId;@@ -16,10 +23,10 @@ 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.+// The Overview tab mirrors the vCenter inventory shape: ESXi hosts on top,+// vSphere VMs underneath grouped by runtime host. A dedicated `vms` tab would+// repeat the same inventory slice, so VM search and power filtering live inside+// the Overview table.export const VMWARE_TAB_SPECS: readonly VmwareTabSpec[] = [{ id: 'overview', label: 'Overview', path: '/vmware/overview' },{ id: 'storage', label: 'Datastores', path: '/vmware/storage' },@@ -42,7 +49,9 @@ export function buildVmwarePageModel(resources: Resource[]): VmwarePageModel {(resource) => isVmwarePlatform(resource) && VMWARE_RESOURCE_TYPES.has(resource.type),);const hosts = vmwareResources.filter((resource) => resource.type === 'agent');- const vms = vmwareResources.filter((resource) => resource.type === 'vm');+ const vms = vmwareResources+ .filter((resource) => resource.type === 'vm')+ .sort(compareVmwareVirtualMachines);const datastores = vmwareResources.filter((resource) =>@@ -62,9 +71,14 @@ export function buildVmwarePageModel(resources: Resource[]): VmwarePageModel {const normalize = (value: unknown): string =>typeof value === 'string' ? value.trim().toLowerCase() : '';+const normalizeToken = (value: unknown): string => normalize(value).replace(/[\s_-]/g, '');+const vmwareDatastoreDisplayName = (resource: Resource): string =>resource.displayName?.trim() || resource.name?.trim() || resource.id;+const vmwareVirtualMachineDisplayName = (resource: Resource): string =>+ resource.displayName?.trim() || resource.name?.trim() || resource.id;+const vmwareDatastoreStatusRank = (resource: Resource): number => {switch (mapVmwareDatastoreStatus(resource)) {case 'inaccessible':@@ -86,6 +100,65 @@ const compareVmwareDatastores = (left: Resource, right: Resource): number => {return vmwareDatastoreDisplayName(left).localeCompare(vmwareDatastoreDisplayName(right));};+const vmwareVirtualMachineHostKey = (resource: Resource): string =>+ normalize(resource.vmware?.runtimeHostName || resource.parentName || 'unknown');++const vmwareVirtualMachineStatusRank = (resource: Resource): number => {+ switch (mapVmwareVirtualMachineStatus(resource)) {+ case 'attention':+ return 0;+ case 'suspended':+ return 1;+ case 'powered-off':+ return 2;+ case 'unknown':+ return 3;+ case 'powered-on':+ return 4;+ }+};++const compareVmwareVirtualMachines = (left: Resource, right: Resource): number => {+ const hostDelta = vmwareVirtualMachineHostKey(left).localeCompare(+ vmwareVirtualMachineHostKey(right),+ );+ if (hostDelta !== 0) return hostDelta;+ const rankDelta = vmwareVirtualMachineStatusRank(left) - vmwareVirtualMachineStatusRank(right);+ if (rankDelta !== 0) return rankDelta;+ return vmwareVirtualMachineDisplayName(left).localeCompare(+ vmwareVirtualMachineDisplayName(right),+ );+};++export function mapVmwareVirtualMachineStatus(+ resource: Resource,+): Exclude<VmwareVirtualMachineStatusFilter, 'all'> {+ const powerState = normalizeToken(resource.vmware?.powerState);+ const status = normalize(resource.status);+ const overall = normalize(resource.vmware?.overallStatus);+ const activeAlarms = resource.vmware?.activeAlarmCount ?? 0;++ if (+ activeAlarms > 0 ||+ ['red', 'yellow', 'degraded', 'warning', 'critical', 'paused'].includes(overall) ||+ ['degraded', 'warning', 'critical', 'paused'].includes(status)+ ) {+ return 'attention';+ }+ if (['poweredoff', 'off'].includes(powerState) || status === 'offline' || status === 'stopped') {+ return 'powered-off';+ }+ if (['suspended', 'suspend'].includes(powerState) || status === 'paused') return 'suspended';+ if (+ ['poweredon', 'on', 'running'].includes(powerState) ||+ status === 'online' ||+ status === 'running'+ ) {+ return 'powered-on';+ }+ return 'unknown';+}+export function mapVmwareDatastoreStatus(resource: Resource,): Exclude<VmwareDatastoreStatusFilter, 'all'> {@@ -154,3 +227,48 @@ export function filterVmwareDatastores(return vmwareDatastoreSearchHaystack(datastore).includes(needle);});}++const vmwareVirtualMachineSearchHaystack = (resource: Resource): string =>+ [+ resource.id,+ resource.name,+ resource.displayName,+ resource.parentName,+ resource.status,+ resource.vmware?.connectionName,+ resource.vmware?.vcenterHost,+ resource.vmware?.managedObjectId,+ resource.vmware?.datacenterName,+ resource.vmware?.clusterName,+ resource.vmware?.computeResourceName,+ resource.vmware?.folderName,+ resource.vmware?.resourcePoolName,+ resource.vmware?.runtimeHostName,+ resource.vmware?.powerState,+ resource.vmware?.overallStatus,+ resource.vmware?.instanceUuid,+ resource.vmware?.biosUuid,+ resource.vmware?.guestOsFamily,+ resource.vmware?.guestHostname,+ resource.vmware?.guestIpAddresses?.join(' '),+ resource.vmware?.datastoreNames?.join(' '),+ resource.vmware?.activeAlarmSummary,+ resource.vmware?.recentTaskSummary,+ ...(resource.tags ?? []),+ ]+ .filter((value): value is string => typeof value === 'string' && value.trim().length > 0)+ .join(' ')+ .toLowerCase();++export function filterVmwareVirtualMachines(+ vms: Resource[],+ search: string,+ status: VmwareVirtualMachineStatusFilter,+): Resource[] {+ const needle = normalize(search);+ return vms.filter((vm) => {+ if (status !== 'all' && mapVmwareVirtualMachineStatus(vm) !== status) return false;+ if (!needle) return true;+ return vmwareVirtualMachineSearchHaystack(vm).includes(needle);+ });+}