diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js index cc320856b0..c41fe40aee 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create-common.js @@ -165,14 +165,8 @@ define(function(require) { // part of an array, and it is filled in different tabs, the $.extend deep // merge can't work. We define an auxiliary attribute for it. - if (templateJSON["VCENTER_PUBLIC_CLOUD"]) { - if (templateJSON['PUBLIC_CLOUD'] == undefined) { - templateJSON['PUBLIC_CLOUD'] = []; - } - - templateJSON['PUBLIC_CLOUD'].push(templateJSON["VCENTER_PUBLIC_CLOUD"]); - - delete templateJSON["VCENTER_PUBLIC_CLOUD"]; + if (templateJSON['PUBLIC_CLOUD'] == undefined) { + templateJSON['PUBLIC_CLOUD'] = []; } // PCI with TYPE=NIC is not defined in the 'other' tab. Because it is diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js index 5376b7af0e..3c28a8ffe0 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/context.js @@ -190,8 +190,8 @@ define(function(require) { var customization = WizardFields.retrieveInput($('input.vcenter_customizations_value', context)); if (customization) { - templateJSON["VCENTER_PUBLIC_CLOUD"] = { - CUSTOMIZATION_SPEC : customization + templateJSON["USER_TEMPLATE"] = { + VCENTER_CUSTOMIZATION_SPEC : customization }; } } else { @@ -258,8 +258,8 @@ define(function(require) { if(this["TYPE"] == "vcenter"){ $("input#context_type_vcenter", context).click(); - if(this["CUSTOMIZATION_SPEC"]){ - WizardFields.fillInput($('input.vcenter_customizations_value', context), this["CUSTOMIZATION_SPEC"]); + if(this["VCENTER_CUSTOMIZATION_SPEC"]){ + WizardFields.fillInput($('input.vcenter_customizations_value', context), this["VCENTER_CUSTOMIZATION_SPEC"]); } else if(userInputsJSON || contextJSON) { $("input#context_type_opennebula", context).click(); } diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js index 4945e55170..1b014d8544 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general.js @@ -160,9 +160,9 @@ define(function(require) { $(".only_" + this.value).show(); if (this.value == "vcenter"){ - $("#vcenter_template_uuid", context).attr("required", ""); + $("#vcenter_template_ref", context).attr("required", ""); } else { - $("#vcenter_template_uuid", context).removeAttr("required"); + $("#vcenter_template_ref", context).removeAttr("required"); } // There is another listener in context.js setup }); @@ -187,10 +187,7 @@ define(function(require) { if(templateJSON["MEMORY_UNIT_COST"] == "GB") templateJSON["MEMORY_COST"] = templateJSON["MEMORY_COST"] * 1024; if (templateJSON["HYPERVISOR"] == 'vcenter') { - templateJSON["VCENTER_PUBLIC_CLOUD"] = { - 'TYPE': 'vcenter', - 'VM_TEMPLATE': WizardFields.retrieveInput($("#vcenter_template_uuid", context)) - }; + templateJSON["VCENTER_TEMPLATE_REF"] = WizardFields.retrieveInput($("#vcenter_template_ref", context)); if (Config.isFeatureEnabled("vcenter_deploy_folder")) { templateJSON["DEPLOY_FOLDER"] = WizardFields.retrieveInput($("#vcenter_deploy_folder", context)) @@ -304,7 +301,7 @@ define(function(require) { $.each(publicClouds, function(){ if(this["TYPE"] == "vcenter"){ - WizardFields.fillInput($("#vcenter_template_uuid", context), this["VM_TEMPLATE"]); + WizardFields.fillInput($("#vcenter_template_ref", context), this["VCENTER_TEMPLATE_REF"]); return false; } }); @@ -350,6 +347,11 @@ define(function(require) { delete templateJSON["RESOURCE_POOL"]; } + if(templateJSON["VCENTER_TEMPLATE_REF"]){ + WizardFields.fillInput($("#vcenter_template_ref", context), templateJSON["VCENTER_TEMPLATE_REF"]); + delete templateJSON["VCENTER_TEMPLATE_REF"]; + } + CapacityCreate.fill($("div.capacityCreate", context), templateJSON); WizardFields.fill(context, templateJSON); diff --git a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/html.hbs b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/html.hbs index 02414628ef..52cb042f1e 100644 --- a/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/html.hbs +++ b/src/sunstone/public/app/tabs/templates-tab/form-panels/create/wizard-tabs/general/html.hbs @@ -56,10 +56,10 @@ {{tr "vCenter"}}