1
0
mirror of https://github.com/OpenNebula/one.git synced 2024-12-23 17:33:56 +03:00

feature #2812: Add hybrid section to the template content

This commit is contained in:
Daniel Molina 2014-08-27 18:17:09 +02:00 committed by Ruben S. Montero
parent df4e3a04b8
commit 527115caa0

View File

@ -759,8 +759,8 @@ function updateTemplatesView(request, templates_list){
function generate_capacity_tab_content() { function generate_capacity_tab_content() {
var html = var html =
'<div class="row vm_param">'+ '<div class="row">'+
'<div id="template_name_form" class="large-6 columns">'+ '<div id="template_name_form" class="large-6 columns vm_param">'+
'<label for="NAME">'+tr("Name")+'\ '<label for="NAME">'+tr("Name")+'\
<span class="tip">'+tr("Name that the VM will get for description purposes.")+'</span>\ <span class="tip">'+tr("Name that the VM will get for description purposes.")+'</span>\
</label>'+ </label>'+
@ -3803,12 +3803,12 @@ function add_provider_tab(provider_id, dialog) {
'<div class="row">'+ '<div class="row">'+
'<div class="large-12 columns">'+ '<div class="large-12 columns">'+
'<label>'+tr("Hybrid Cloud")+'</label>'+ '<label>'+tr("Hybrid Cloud")+'</label>'+
'<input type="radio" name="hybrid" value="ec2" id="amazonRadio'+str_provider_tab_id+'"><label for="amazonRadio'+str_provider_tab_id+'">'+tr("Amazon EC2")+'</label>'+ '<input type="radio" class="hybridRadio" name="hybrid'+str_provider_tab_id+'" value="ec2" id="amazonRadio'+str_provider_tab_id+'"><label for="amazonRadio'+str_provider_tab_id+'">'+tr("Amazon EC2")+'</label>'+
'<input type="radio" name="hybrid" value="softlayer" id="softlayerRadio'+str_provider_tab_id+'"><label for="softlayerRadio'+str_provider_tab_id+'">'+tr("IBM Softlayer")+'</label>'+ '<input type="radio" class="hybridRadio" name="hybrid'+str_provider_tab_id+'" value="softlayer" id="softlayerRadio'+str_provider_tab_id+'"><label for="softlayerRadio'+str_provider_tab_id+'">'+tr("IBM Softlayer")+'</label>'+
'<input type="radio" name="hybrid" value="azure" id="azureRadio'+str_provider_tab_id+'"><label for="azureRadio'+str_provider_tab_id+'">'+tr("Microsoft Azure")+'</label>'+ '<input type="radio" class="hybridRadio" name="hybrid'+str_provider_tab_id+'" value="azure" id="azureRadio'+str_provider_tab_id+'"><label for="azureRadio'+str_provider_tab_id+'">'+tr("Microsoft Azure")+'</label>'+
'</div>'+ '</div>'+
'</div>'+ '</div>'+
'<div class="row hybrid_inputs">'+ '<div class="row hybrid_inputs vm_param">'+
'</div>'+ '</div>'+
'</div>' '</div>'
$(html_tab_content).appendTo($("#template_create_hybrid_tabs_content", 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); 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(""); $(".hybrid_inputs", provider_section).html("");
$.each(hybrid_inputs[this.value], function(index, obj){ $.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 // GRAPHICS
// //