From e8d63da1eb11759259b777d225b1f490ea629a66 Mon Sep 17 00:00:00 2001 From: Yiya Chen Date: Tue, 12 Aug 2025 13:53:09 +0800 Subject: [PATCH] fix: fallback default value (#454) Signed-off-by: Yi-Ya Chen --- .../edit/harvesterhci.io.storage/CDISettings.vue | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/pkg/harvester/edit/harvesterhci.io.storage/CDISettings.vue b/pkg/harvester/edit/harvesterhci.io.storage/CDISettings.vue index a28f7ee5..86de61c2 100644 --- a/pkg/harvester/edit/harvesterhci.io.storage/CDISettings.vue +++ b/pkg/harvester/edit/harvesterhci.io.storage/CDISettings.vue @@ -44,6 +44,12 @@ export default { }; await allHash(hash); + + if (this.mode === _CREATE ) { + this.setDefaultVolumeSnapshotClass(); + } else { + this.initCDISettingsFromAnnotations(); + } }, data() { @@ -59,14 +65,6 @@ export default { }; }, - created() { - if (this.mode === _CREATE ) { - this.setDefaultVolumeSnapshotClass(); - } else { - this.initCDISettingsFromAnnotations(); - } - }, - computed: { inStore() { return this.$store.getters['currentProduct'].inStore; @@ -148,7 +146,7 @@ export default { setDefaultVolumeSnapshotClass() { try { const setting = this.$store.getters[`${ this.inStore }/byId`](HCI.SETTING, HCI_SETTING.CSI_DRIVER_CONFIG); - const config = JSON.parse(setting?.value || '{}'); + const config = JSON.parse(setting?.value || setting?.default || '{}'); const defaultClass = config?.[this.provisioner]?.volumeSnapshotClassName || null; const allClasses = this.$store.getters[`${ this.inStore }/all`](VOLUME_SNAPSHOT_CLASS) || [];