mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2025-12-13 13:11:43 +00:00
fix: VM's machine type options is not support (#307)
* feat: get options from API Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com> * feat: add feature flag Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com> * refactor: remove default value Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com> * refactor: fallback to none Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com> --------- Signed-off-by: Yi-Ya Chen <yiya.chen@suse.com>
This commit is contained in:
parent
d6da4898b4
commit
7ecc9c320d
@ -37,7 +37,9 @@ const FEATURE_FLAGS = {
|
|||||||
'liveMigrationProgress'
|
'liveMigrationProgress'
|
||||||
],
|
],
|
||||||
'v1.5.1': [],
|
'v1.5.1': [],
|
||||||
'v1.6.0': []
|
'v1.6.0': [
|
||||||
|
'vmMachineTypes'
|
||||||
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
const generateFeatureFlags = () => {
|
const generateFeatureFlags = () => {
|
||||||
|
|||||||
@ -114,13 +114,11 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
machineTypeOptions() {
|
machineTypeOptions() {
|
||||||
return [{
|
return this.machineTypes.map((type) => {
|
||||||
label: 'None',
|
if (!type) return { label: 'None', value: '' };
|
||||||
value: ''
|
|
||||||
}, {
|
return { label: type, value: type };
|
||||||
label: 'q35',
|
});
|
||||||
value: 'q35'
|
|
||||||
}];
|
|
||||||
},
|
},
|
||||||
|
|
||||||
templateOptions() {
|
templateOptions() {
|
||||||
|
|||||||
@ -157,6 +157,7 @@ export default {
|
|||||||
diskRows: [],
|
diskRows: [],
|
||||||
networkRows: [],
|
networkRows: [],
|
||||||
machineType: '',
|
machineType: '',
|
||||||
|
machineTypes: [],
|
||||||
secretName: '',
|
secretName: '',
|
||||||
secretRef: null,
|
secretRef: null,
|
||||||
showAdvanced: false,
|
showAdvanced: false,
|
||||||
@ -295,6 +296,9 @@ 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;
|
||||||
this.getInitConfig({ value: this.value, init: this.isCreate });
|
this.getInitConfig({ value: this.value, init: this.isCreate });
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -331,7 +335,8 @@ export default {
|
|||||||
const maintenanceStrategy = vm.metadata.labels?.[HCI_ANNOTATIONS.VM_MAINTENANCE_MODE_STRATEGY] || 'Migrate';
|
const maintenanceStrategy = vm.metadata.labels?.[HCI_ANNOTATIONS.VM_MAINTENANCE_MODE_STRATEGY] || 'Migrate';
|
||||||
|
|
||||||
const runStrategy = spec.runStrategy || 'RerunOnFailure';
|
const runStrategy = spec.runStrategy || 'RerunOnFailure';
|
||||||
const machineType = value.machineType;
|
const machineType = spec.template.spec.domain?.machine?.type || this.machineTypes[0];
|
||||||
|
|
||||||
const cpu = spec.template.spec.domain?.cpu?.cores;
|
const cpu = spec.template.spec.domain?.cpu?.cores;
|
||||||
const memory = spec.template.spec.domain.resources.limits.memory;
|
const memory = spec.template.spec.domain.resources.limits.memory;
|
||||||
const reservedMemory = vm.metadata?.annotations?.[HCI_ANNOTATIONS.VM_RESERVED_MEMORY];
|
const reservedMemory = vm.metadata?.annotations?.[HCI_ANNOTATIONS.VM_RESERVED_MEMORY];
|
||||||
|
|||||||
@ -1205,6 +1205,10 @@ export default class VirtVm extends HarvesterResource {
|
|||||||
return this.$rootGetters['harvester-common/getFeatureEnabled']('thirdPartyStorage');
|
return this.$rootGetters['harvester-common/getFeatureEnabled']('thirdPartyStorage');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get vmMachineTypesFeatureEnabled() {
|
||||||
|
return this.$rootGetters['harvester-common/getFeatureEnabled']('vmMachineTypes');
|
||||||
|
}
|
||||||
|
|
||||||
setInstanceLabels(val) {
|
setInstanceLabels(val) {
|
||||||
if ( !this.spec?.template?.metadata?.labels ) {
|
if ( !this.spec?.template?.metadata?.labels ) {
|
||||||
set(this, 'spec.template.metadata.labels', {});
|
set(this, 'spec.template.metadata.labels', {});
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user