From b18aebbbd4c9807153978687e22aa5d212ad3b55 Mon Sep 17 00:00:00 2001 From: Andy Lee Date: Mon, 8 Jun 2026 16:49:09 +0800 Subject: [PATCH] fix: snapshot/backup/volume attach VM name (#918) Signed-off-by: Andy Lee --- pkg/harvester/formatters/AttachVMWithName.vue | 8 ++++++-- pkg/harvester/list/harvesterhci.io.volume.vue | 12 ++++++------ .../models/harvester/persistentvolumeclaim.js | 4 ++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/pkg/harvester/formatters/AttachVMWithName.vue b/pkg/harvester/formatters/AttachVMWithName.vue index 716c9fff..ab13f5e3 100644 --- a/pkg/harvester/formatters/AttachVMWithName.vue +++ b/pkg/harvester/formatters/AttachVMWithName.vue @@ -31,6 +31,10 @@ export default { to() { return this.vm?.detailLocation; }, + + attachVMName() { + return this.vm?.nameDisplay || this.vm?.metadata?.name || this.value; + } } }; @@ -40,10 +44,10 @@ export default { v-if="to" :to="to" > - {{ value }} + {{ attachVMName }} - {{ value }} + {{ attachVMName }} diff --git a/pkg/harvester/list/harvesterhci.io.volume.vue b/pkg/harvester/list/harvesterhci.io.volume.vue index ff0aa7ff..30539d68 100644 --- a/pkg/harvester/list/harvesterhci.io.volume.vue +++ b/pkg/harvester/list/harvesterhci.io.volume.vue @@ -106,8 +106,8 @@ export default { name: 'AttachedVM', labelKey: 'tableHeaders.attachedVM', type: 'attached', - value: 'spec.claimRef', - sort: 'name', + value: 'attachVMName', + sort: 'attachVMName', }, { name: 'VolumeSnapshotCounts', @@ -134,8 +134,8 @@ export default { return row?.attachVM?.detailLocation; }, - getVMName(row) { - return row.attachVM?.metadata?.name || ''; + getAttachedVMName(row) { + return row.attachVMName || ''; }, isInternalStorageClass(storageClassName) { @@ -173,10 +173,10 @@ export default { diff --git a/pkg/harvester/models/harvester/persistentvolumeclaim.js b/pkg/harvester/models/harvester/persistentvolumeclaim.js index 2e0ee11b..dd8de0df 100644 --- a/pkg/harvester/models/harvester/persistentvolumeclaim.js +++ b/pkg/harvester/models/harvester/persistentvolumeclaim.js @@ -235,6 +235,10 @@ export default class HciPv extends HarvesterResource { return allVMs.find(findAttachVM); } + get attachVMName() { + return this.attachVM?.nameDisplay || this.attachVM?.metadata?.name || ''; + } + get isAvailable() { const unAvailable = ['Resizing', 'Not Ready'];