diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue index 18f48cc655f..18f90a44034 100644 --- a/ui/src/views/compute/DeployVM.vue +++ b/ui/src/views/compute/DeployVM.vue @@ -332,61 +332,64 @@ + v-if="vm.templateid && templateProperties && Object.keys(templateProperties).length > 0"> @@ -643,7 +646,7 @@ export default { templateConfigurations: [], templateNics: [], templateLicenses: [], - templateProperties: [], + templateProperties: {}, selectedTemplateConfiguration: {}, iso: {}, hypervisor: '', @@ -1133,7 +1136,7 @@ export default { this.selectedTemplateConfiguration = {} this.templateNics = [] this.templateLicenses = [] - this.templateProperties = [] + this.templateProperties = {} this.updateTemplateParameters() if (t.deployasis === true && !t.details && (!this.template || t.id !== this.template.id)) { // Deploy as-is template without details detected, need to retrieve the template details @@ -1152,7 +1155,7 @@ export default { this.selectedTemplateConfiguration = {} this.templateNics = [] this.templateLicenses = [] - this.templateProperties = [] + this.templateProperties = {} this.tabKey = 'isoid' this.form.setFieldsValue({ isoid: value, @@ -1629,6 +1632,16 @@ export default { } return nics }, + groupBy (array, key) { + const result = {} + array.forEach(item => { + if (!result[item[key]]) { + result[item[key]] = [] + } + result[item[key]].push(item) + }) + return result + }, fetchTemplateProperties (template) { var properties = [] if (template && template.details && Object.keys(template.details).length > 0) { @@ -1639,10 +1652,10 @@ export default { properties.push(propertyMap) } properties.sort(function (a, b) { - return a.label.localeCompare(b.label) + return a.index - b.index }) } - return properties + return this.groupBy(properties, 'category') }, fetchTemplateConfigurations (template) { var configurations = []