Show vCenter MoRef in workload ID column for vSphere VMs

The workload table's ID column reads displayId, which the
mapping pipeline derived only from numeric vmid. vCenter
identifies VMs by managed object reference (e.g. vm-206), not
a Proxmox-shaped numeric vmid, so vSphere rows landed in the
table with a blank ID cell.

When workloadType is vm and there's no Proxmox-shaped numeric
vmid, fall back to resource.vmware.managedObjectId. The MoRef
is the identifier operators recognize from the vCenter UI, so
the column now shows what an operator would expect to see.
This commit is contained in:
rcourtman
2026-05-23 09:24:31 +01:00
parent 5fbbafc726
commit 9c7d3978e1
+10 -1
View File
@@ -378,11 +378,20 @@ const mapResourceToWorkload = (resource: APIResource): WorkloadGuest | null => {
? resource.proxmox.vmid
: 0;
const rawDisplayId = resource.id;
// vCenter identifies VMs by managed object reference (e.g. `vm-206`),
// not a numeric vmid. When the resource has no Proxmox-shaped numeric
// vmid, fall back to the vSphere MoRef so the workload table's ID
// column shows the identifier operators recognize from vCenter rather
// than rendering blank.
const vsphereDisplayId =
workloadType === 'vm' && vmid <= 0
? (resource.vmware?.managedObjectId ?? '').trim() || undefined
: undefined;
const displayId =
workloadType === 'vm' || workloadType === 'system-container'
? vmid > 0
? String(vmid)
: undefined
: vsphereDisplayId
: rawDisplayId
? rawDisplayId.length > 12
? rawDisplayId.slice(0, 12)