diff --git a/share/scripts/context-packages/base_deb/etc/one-context.d/00-network b/share/scripts/context-packages/base_deb/etc/one-context.d/00-network index 7a7398ccba..f3034435ce 100755 --- a/share/scripts/context-packages/base_deb/etc/one-context.d/00-network +++ b/share/scripts/context-packages/base_deb/etc/one-context.d/00-network @@ -166,13 +166,25 @@ EOT configure_network() { gen_network_configuration > /etc/network/interfaces +} - service networking stop - sleep 1 - service networking start +activate_network() +{ + if [[ `lsb_release -c | awk '{print($2)}'` = precise ]]; then + IFACES=`get_interfaces` + + for i in $IFACES; do + DEV=`get_dev $i` + service network-interface restart INTERFACE=$DEV + done + else + service networking stop + sleep 1 + service networking start + fi sleep 2 } configure_network - +activate_network diff --git a/src/sunstone/public/js/plugins/groups-tab.js b/src/sunstone/public/js/plugins/groups-tab.js index 9bc1785a76..1838ca3821 100644 --- a/src/sunstone/public/js/plugins/groups-tab.js +++ b/src/sunstone/public/js/plugins/groups-tab.js @@ -1263,7 +1263,7 @@ function setupCreateGroupDialog(){ separator = "+"; }); - group_json['group']['admin_group_resources'] = resources; + group_json['group']['admin_resources'] = resources; if ( $('#group_admin_res_user', dialog).prop("checked") ){ group_json['group']['admin_manage_users'] = "YES"; diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index c2fff57c2b..782562f0cb 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -245,13 +245,15 @@ var image_actions = { type: "create", call: OpenNebula.Image.create, callback: function(request, response){ - // Reset the create wizard + addImageElement(request, response); + if ($appmarket_import_dialog || $marketplace_import_dialog) { + $create_image_dialog.trigger('close'); + } else { $create_image_dialog.foundation('reveal', 'close'); $create_image_dialog.empty(); setupCreateImageDialog(); - - addImageElement(request, response); - notifyCustom(tr("Image created"), " ID: " + response.IMAGE.ID, false); + } + notifyCustom(tr("Image created"), " ID: " + response.IMAGE.ID, false) }, error: onError }, @@ -987,6 +989,8 @@ function initialize_create_image_dialog(dialog) { }; $('#create_image_submit',dialog).click(function(){ + $create_image_dialog = dialog; + var exit = false; var upload = false; $('.img_man',this).each(function(){ diff --git a/src/sunstone/public/js/plugins/marketplace-tab.js b/src/sunstone/public/js/plugins/marketplace-tab.js index 54a23fa8d6..6e9ea6af5c 100644 --- a/src/sunstone/public/js/plugins/marketplace-tab.js +++ b/src/sunstone/public/js/plugins/marketplace-tab.js @@ -60,7 +60,6 @@ var market_actions = { dialogs_context.append(marketplace_import_dialog); $marketplace_import_dialog = $('#marketplace_import_dialog',dialogs_context); $marketplace_import_dialog.addClass("reveal-modal large max-height").attr("data-reveal", ""); - $marketplace_import_dialog.foundation().foundation('reveal', 'open'); var tab_id = 1; @@ -110,8 +109,8 @@ var market_actions = { }) image_dialog.on("close", function(){ - a_image_dialog.html(""); - image_dialog.html(""); + a_image_dialog.remove(); + image_dialog.remove(); if ($('a', $("dl#marketplace_import_dialog_tabs")).size > 0) { $('a', $("dl#marketplace_import_dialog_tabs")).first().click(); } else { @@ -125,7 +124,19 @@ var market_actions = { }) if (response['opennebula_template'] && response['opennebula_template'] !== "CPU=1") { - $create_template_dialog.html(""); + var opennebula_template; + + try { + opennebula_template = JSON.parse(response['opennebula_template']); + } catch (error) { + notifyError("Error parsing OpenNebula template: " + error.message); + return; + } + + if ($create_template_dialog) { + $create_template_dialog.html(""); + } + // Template // Append the new div containing the tab and add the tab to the list var template_dialog = $('
'+ @@ -137,17 +148,15 @@ var market_actions = { ").appendTo($("dl#marketplace_import_dialog_tabs")); initialize_create_template_dialog(template_dialog); - fillTemplatePopUp( - JSON.parse(response['opennebula_template']), - template_dialog); + fillTemplatePopUp(opennebula_template, template_dialog); a_template_dialog.on('click', function(){ $create_template_dialog = template_dialog; }) template_dialog.on("close", function(){ - a_template_dialog.html(""); - template_dialog.html(""); + a_template_dialog.remove(); + template_dialog.remove(); if ($('a', $("dl#marketplace_import_dialog_tabs")).size > 0) { $('a', $("dl#marketplace_import_dialog_tabs")).first().click(); } else { @@ -159,7 +168,13 @@ var market_actions = { $("a[href='#manual']", template_dialog).closest('dl').remove(); } + $marketplace_import_dialog.foundation().foundation('reveal', 'open'); $('a', $("dl#marketplace_import_dialog_tabs")).first().click(); + + $marketplace_import_dialog.on('closed', function(){ + $marketplace_import_dialog.remove(); + $marketplace_import_dialog = undefined; + }) }, error: onError }, @@ -325,10 +340,9 @@ function updateMarketInfo(request,app){ function infoListenerMarket(dataTable){ $('tbody tr',dataTable).live("click",function(e){ - - if ($(e.target).is('input') || - $(e.target).is('select') || - $(e.target).is('option')) return true; + if ($(e.target).is('input') || + $(e.target).is('select') || + $(e.target).is('option')) return true; var aData = dataTable.fnGetData(this); var id =aData["_id"]["$oid"]; diff --git a/src/sunstone/public/js/plugins/templates-tab.js b/src/sunstone/public/js/plugins/templates-tab.js index 80eb7cbb07..2a47969fb8 100644 --- a/src/sunstone/public/js/plugins/templates-tab.js +++ b/src/sunstone/public/js/plugins/templates-tab.js @@ -15,7 +15,7 @@ /* -------------------------------------------------------------------------- */ var create_template_tmpl = '\ -
'+ +
'+ '
'+ '

'+tr("Create VM Template")+'

'+tr("Update VM Template")+'

'+ '
'+ @@ -226,8 +226,11 @@ var template_actions = { type: "create", call: OpenNebula.Template.create, callback: function(request, response){ - $create_template_dialog.foundation('reveal', 'close') - $create_template_dialog.empty(); + if ($appmarket_import_dialog || $marketplace_import_dialog) { + $create_template_dialog.trigger('close'); + } else { + $create_template_dialog.foundation('reveal', 'close'); + } addTemplateElement(request, response); notifyCustom(tr("Template created"), " ID: " + response.VMTEMPLATE.ID, false) }, @@ -3230,16 +3233,16 @@ function setup_context_tab_content(context_section) { $("td", this).removeClass('markrowchecked'); $('div#selected_files_spans span#tag_file_'+file_id, context_section).remove(); } - + if ($.isEmptyObject(selected_files)) { $('#files_selected', context_section).hide(); $('#select_files', context_section).show(); } - + $('.alert-box', $('#contextTab')).hide(); - + generate_context_files(); - + return true; }); @@ -3752,6 +3755,7 @@ function initialize_create_template_dialog(dialog) { //Process form $('button#create_template_form_easy',dialog).click(function(){ + $create_template_dialog = dialog; //wrap it in the "vmtemplate" object var vm_json = build_template(); vm_json = {vmtemplate: vm_json}; diff --git a/src/sunstone/public/js/sunstone.js b/src/sunstone/public/js/sunstone.js index 6d6a456803..e437881fbc 100644 --- a/src/sunstone/public/js/sunstone.js +++ b/src/sunstone/public/js/sunstone.js @@ -1254,6 +1254,7 @@ function updateView(item_list,dataTable){ //replaces an element with id 'tag' in a dataTable with a new one function updateSingleElement(element,dataTable,tag){ + // fnGetData should be used instead, otherwise it depends on the visible columns var nodes = dataTable.fnGetNodes(); var tr = $(tag,nodes).parents('tr')[0]; var checked_val = $('input.check_item',tr).attr('checked');