fix: dynamic get VM's machine type API endpoint (#349)

* fix: update API endpoint
* fix: remove redudant slash
---------

Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
This commit is contained in:
Yiya Chen 2025-06-26 09:19:09 +08:00 committed by GitHub
parent 717258defd
commit 3694b316ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -296,9 +296,20 @@ export default {
async created() { async created() {
await this.$store.dispatch(`${ this.inStore }/findAll`, { type: SECRET }); await this.$store.dispatch(`${ this.inStore }/findAll`, { type: SECRET });
const machineTypes = this.value.vmMachineTypesFeatureEnabled ? await this.$store.dispatch('harvester/request', { url: '/v1/harvester/clusters/local?link=machineTypes' }) : [''];
this.machineTypes = machineTypes; if (this.value.vmMachineTypesFeatureEnabled) {
try {
const url = this.$store.getters['harvester-common/getHarvesterClusterUrl']('v1/harvester/clusters/local?link=machineTypes');
const machineTypes = await this.$store.dispatch('harvester/request', { url });
this.machineTypes = machineTypes;
} catch (err) {
this.machineTypes = [''];
}
} else {
this.machineTypes = [''];
}
this.getInitConfig({ value: this.value, init: this.isCreate }); this.getInitConfig({ value: this.value, init: this.isCreate });
}, },