From a207ec078b8c8beedbda67c5b7b4ed70cabcbc00 Mon Sep 17 00:00:00 2001 From: Yi-Ya Chen Date: Mon, 30 Dec 2024 15:39:51 +0800 Subject: [PATCH 1/2] fix: update template name value Signed-off-by: Yi-Ya Chen --- .../edit/harvesterhci.io.virtualmachinetemplateversion.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/harvester/edit/harvesterhci.io.virtualmachinetemplateversion.vue b/pkg/harvester/edit/harvesterhci.io.virtualmachinetemplateversion.vue index 48ace21b..3618545e 100644 --- a/pkg/harvester/edit/harvesterhci.io.virtualmachinetemplateversion.vue +++ b/pkg/harvester/edit/harvesterhci.io.virtualmachinetemplateversion.vue @@ -205,6 +205,11 @@ export default { if (tab.name === 'advanced') { this.$refs.yamlEditor?.refresh(); } + }, + + updateNameNsDescriptionValue(newValue) { + this.templateValue.metadata.name = newValue.metadata.name; + this.templateValue.metadata.namespace = newValue.metadata.namespace; } }, }; @@ -226,7 +231,7 @@ export default { :mode="realTemplateMode" name-label="harvester.vmTemplate.nameNsDescription.name" :namespaced="true" - @update:value="$emit('update:value', $event)" + @update:value="updateNameNsDescriptionValue" /> Date: Thu, 2 Jan 2025 11:10:01 +0800 Subject: [PATCH 2/2] refactor: rewrite with emit pattern Signed-off-by: Yi-Ya Chen --- .../harvesterhci.io.virtualmachinetemplateversion.vue | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/pkg/harvester/edit/harvesterhci.io.virtualmachinetemplateversion.vue b/pkg/harvester/edit/harvesterhci.io.virtualmachinetemplateversion.vue index 3618545e..794f8c8b 100644 --- a/pkg/harvester/edit/harvesterhci.io.virtualmachinetemplateversion.vue +++ b/pkg/harvester/edit/harvesterhci.io.virtualmachinetemplateversion.vue @@ -29,7 +29,7 @@ import SSHKey from './kubevirt.io.virtualmachine/VirtualMachineSSHKey'; export default { name: 'HarvesterEditVMTemplate', - emits: ['update:value'], + emits: ['update:templateValue'], components: { Tab, @@ -206,11 +206,6 @@ export default { this.$refs.yamlEditor?.refresh(); } }, - - updateNameNsDescriptionValue(newValue) { - this.templateValue.metadata.name = newValue.metadata.name; - this.templateValue.metadata.namespace = newValue.metadata.namespace; - } }, }; @@ -227,11 +222,11 @@ export default { @finish="saveVMT" >