Andy Lee b18aebbbd4
fix: snapshot/backup/volume attach VM name (#918)
Signed-off-by: Andy Lee <andy.lee@suse.com>
2026-06-08 16:49:09 +08:00

54 lines
831 B
Vue

<script>
import { HCI } from '../types';
export default {
props: {
value: {
type: String,
default: ''
},
row: {
type: Object,
default: () => {
return {};
}
}
},
data() {
const vmList = this.$store.getters['harvester/all'](HCI.VM) || [];
return { vmList };
},
computed: {
vm() {
const vm = this.vmList.find( (V) => V.id === `${ this.row.metadata.namespace }/${ this.value }`);
return vm;
},
to() {
return this.vm?.detailLocation;
},
attachVMName() {
return this.vm?.nameDisplay || this.vm?.metadata?.name || this.value;
}
}
};
</script>
<template>
<router-link
v-if="to"
:to="to"
>
{{ attachVMName }}
</router-link>
<span v-else>
{{ attachVMName }}
</span>
</template>