fix: fallback default value (#454) (#455)

(cherry picked from commit e8d63da1eb11759259b777d225b1f490ea629a66)

Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
Co-authored-by: Yiya Chen <yiya.chen@suse.com>
This commit is contained in:
mergify[bot] 2025-08-12 13:55:37 +08:00 committed by GitHub
parent d1c676ee2c
commit f7fc001abd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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) || [];