fix: fallback default value (#454)

Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
This commit is contained in:
Yiya Chen 2025-08-12 13:53:09 +08:00 committed by GitHub
parent 4a456ac07d
commit e8d63da1eb
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) || [];