diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/os.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/os.js index f948ef71d24..22743d85a38 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/os.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/os.js @@ -322,9 +322,15 @@ define(function(require) { function _retrieve(context) { var templateJSON = {}; var osJSON = {}; - $.extend(osJSON, WizardFields.retrieve(".bootTab", context)); - $.extend(osJSON, WizardFields.retrieve(".kernelTab", context)); - $.extend(osJSON, WizardFields.retrieve(".ramdiskTab", context)); + $.extend(osJSON, WizardFields.retrieve( + $(".bootTab", context) + )); + $.extend(osJSON, WizardFields.retrieve( + $(".kernelTab", context) + )); + $.extend(osJSON, WizardFields.retrieve( + $(".ramdiskTab", context) + )); var boot = _retrieveBootValue(context); @@ -334,13 +340,24 @@ define(function(require) { osJSON["BOOT"] = ""; } - if (!$.isEmptyObject(osJSON)) { templateJSON["OS"] = osJSON; }; + if (!$.isEmptyObject(osJSON)) { + templateJSON["OS"] = osJSON; + } + + var featuresJSON = WizardFields.retrieve( + $(".featuresTab", context) + ); + if (!$.isEmptyObject(featuresJSON)) { + templateJSON["FEATURES"] = featuresJSON; + } - var featuresJSON = WizardFields.retrieve(".featuresTab", context); - if (!$.isEmptyObject(featuresJSON)) { templateJSON["FEATURES"] = featuresJSON; }; + var cpuModelJSON = WizardFields.retrieve( + $(".cpuTab", context) + ); - var cpuModelJSON = WizardFields.retrieve(".cpuTab", context); - if (!$.isEmptyObject(cpuModelJSON)) { templateJSON["CPU_MODEL"] = cpuModelJSON; }; + if (!$.isEmptyObject(cpuModelJSON)) { + templateJSON["CPU_MODEL"] = cpuModelJSON; + } return templateJSON; } diff --git a/src/sunstone/public/app/tabs/vms-tab/form-panels/updateconf.js b/src/sunstone/public/app/tabs/vms-tab/form-panels/updateconf.js index 3d196c4f096..706fe3675d9 100644 --- a/src/sunstone/public/app/tabs/vms-tab/form-panels/updateconf.js +++ b/src/sunstone/public/app/tabs/vms-tab/form-panels/updateconf.js @@ -127,12 +127,18 @@ define(function(require) { }); } - function _submitWizard(context) { - var templateJSON = {} + function _submitWizard() { + var context = ".sunstone-content > #vms-tab #vms-tab-wizardForms.is-active"; + var templateJSON = {}; $.each(this.wizardTabs, function(index, wizardTab) { - $.extend(true, templateJSON, wizardTab.retrieve($('#' + wizardTab.wizardTabId, context))); + $.extend( + true, + templateJSON, + wizardTab.retrieve( + $('#' + wizardTab.wizardTabId, context) + ) + ); }); - Sunstone.runAction("VM.updateconf", this.resourceId, TemplateUtils.templateToString(templateJSON)); return false; diff --git a/src/sunstone/public/app/utils/wizard-fields.js b/src/sunstone/public/app/utils/wizard-fields.js index c85652ae929..4b5fa9ffb4c 100644 --- a/src/sunstone/public/app/utils/wizard-fields.js +++ b/src/sunstone/public/app/utils/wizard-fields.js @@ -35,13 +35,13 @@ define(function(require) { fields.each(function() { var field = $(this); - - if (field.prop('wizard_field_disabled') != true && - field.val() != null && field.val().length && - (field.attr("type") != "checkbox" || field.prop("checked")) && - (field.attr("type") != "radio" || field.prop("checked"))) { + if( + field.prop('wizard_field_disabled') != true && + field.val() != null && field.val().length && + (field.attr("type") != "checkbox" || field.prop("checked")) && + (field.attr("type") != "radio" || field.prop("checked")) + ) { var field_name = field.attr('wizard_field'); - if (field.attr('wizard_field_64') == "true"){ templateJSON[field_name] = btoa(field.val()); } else { @@ -49,7 +49,6 @@ define(function(require) { } } }); - return templateJSON; }