From 527115caa0c9069999b44127fa9305b6cff663ba Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Wed, 27 Aug 2014 18:17:09 +0200 Subject: [PATCH] feature #2812: Add hybrid section to the template content --- .../public/js/plugins/templates-tab.js | 40 +++++++++++++++---- 1 file changed, 33 insertions(+), 7 deletions(-) diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index df3e97e4d6..74a6cedf70 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -759,8 +759,8 @@ function updateTemplatesView(request, templates_list){ function generate_capacity_tab_content() { var html = - '
'+ - '
'+ + '
'+ + '
'+ ''+ @@ -3803,12 +3803,12 @@ function add_provider_tab(provider_id, dialog) { '
'+ '
'+ ''+ - ''+ - ''+ - ''+ + ''+ + ''+ + ''+ '
'+ '
'+ - '
'+ + '
'+ '
'+ '
' $(html_tab_content).appendTo($("#template_create_hybrid_tabs_content", dialog)); @@ -3821,7 +3821,7 @@ function add_provider_tab(provider_id, dialog) { var provider_section = $('#' +str_provider_tab_id+'Tab', dialog); - provider_section.on("change", "input[name='hybrid']", function(){ + provider_section.on("change", "input.hybridRadio", function(){ $(".hybrid_inputs", provider_section).html(""); $.each(hybrid_inputs[this.value], function(index, obj){ @@ -4093,6 +4093,32 @@ function build_template(dialog){ }; } + // HYBRID + + vm_json["PUBLIC_CLOUD"] = []; + vm_json["EC2"] = []; + + $('.provider',dialog).each(function(){ + var hash = {}; + addSectionJSON(hash, this); + if (!$.isEmptyObject(hash)) { + var hybrid = $("input.hybridRadio:checked", this).val(); + switch(hybrid) { + case 'ec2': + vm_json["EC2"].push(hash); + break; + case 'softlayer': + hash["TYPE"] = hybrid.toUpperCase(); + vm_json["PUBLIC_CLOUD"].push(hash); + break; + case 'azure': + hash["TYPE"] = hybrid.toUpperCase(); + vm_json["PUBLIC_CLOUD"].push(hash); + break; + } + }; + }); + // // GRAPHICS //