diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index b70a954ccf..e099793d0a 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -821,12 +821,11 @@ function updateHostInfo(request,host){ //Prepares the host creation dialog function setupCreateHostDialog(){ dialogs_context.append('
'); - $create_host_dialog = $('div#create_host_dialog'); - var dialog = $create_host_dialog; - - dialog.html(create_host_tmpl); + $('div#create_host_dialog').html(create_host_tmpl); + var dialog = $('div#create_host_dialog'); dialog.addClass("reveal-modal medium").attr("data-reveal", ""); + dialog.foundation() // Show custom driver input only when custom is selected in selects $('input[name="custom_vmm_mad"],'+ @@ -885,23 +884,16 @@ function setupCreateHostDialog(){ //Create the OpenNebula.Host. //If it is successfull we refresh the list. Sunstone.runAction("Host.create",host_json); - $create_host_dialog.foundation('reveal', 'close') + $('div#create_host_dialog').foundation('reveal', 'close') return false; }); - - $('#wizard_host_reset_button').click(function(){ - $create_host_dialog.html(""); - setupCreateHostDialog(); - - popUpCreateHostDialog(); - }); } //Open creation dialogs function popUpCreateHostDialog(){ - $('#host_cluster_id',$create_host_dialog).html(clusters_sel()); - $create_host_dialog.foundation().foundation('reveal', 'open'); - $("input#name",$create_host_dialog).focus(); + $('#host_cluster_id',$('div#create_host_dialog')).html(clusters_sel()); + $('div#create_host_dialog').foundation('reveal', 'open'); + $("input#name",$('div#create_host_dialog')).focus(); return false; } diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index 41f34e36bc..28185dd1c7 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -839,9 +839,12 @@ function enable_all_datastores() } // Prepare the image creation dialog -function setupCreateImageDialog(dialog){ - dialogs_context.append('
'); - $create_image_dialog = $('#create_image_dialog',dialogs_context); +function setupCreateImageDialog(dialog) { + if ($('#create_image_dialog').length == 0) { + dialogs_context.append('
'); + } + + $create_image_dialog = $('#create_image_dialog'); var dialog = $create_image_dialog; dialog.html(create_image_tmpl); @@ -1126,15 +1129,15 @@ function initialize_create_image_dialog(dialog) { return false; }); - $('#wizard_image_reset_button').click(function(){ - dialog.html(""); + $('#wizard_image_reset_button', dialog).click(function(){ + $('#create_image_dialog').html(""); setupCreateImageDialog(); popUpCreateImageDialog(); }); - $('#advanced_image_reset_button').click(function(){ - dialog.html(""); + $('#advanced_image_reset_button', dialog).click(function(){ + $('#create_image_dialog').html(""); setupCreateImageDialog(); popUpCreateImageDialog(); @@ -1174,7 +1177,7 @@ function initialize_datastore_info_create_image_dialog(dialog) { } function popUpCreateImageDialog(){ - $create_image_dialog = $('#create_image_dialog',dialogs_context); + $create_image_dialog = $('#create_image_dialog'); initialize_datastore_info_create_image_dialog($create_image_dialog); $create_image_dialog.foundation().foundation('reveal', 'open'); $("input#img_name",$create_image_dialog).focus(); diff --git a/src/sunstone/public/js/plugins/vnets-tab.js b/src/sunstone/public/js/plugins/vnets-tab.js index 1864082566..dbc39443f9 100644 --- a/src/sunstone/public/js/plugins/vnets-tab.js +++ b/src/sunstone/public/js/plugins/vnets-tab.js @@ -927,15 +927,6 @@ function setupCreateVNetDialog() { var dialog = $create_vn_dialog; dialog.html(create_vn_tmpl); - var height = Math.floor($(window).height()*0.8); //set height to a percentage of the window - - //Prepare the jquery-ui dialog. Set style options here. - //dialog.dialog({ - // autoOpen: false, - // modal: true, - // width: 475, - // height: height - //}); dialog.addClass("reveal-modal medium max-height").attr("data-reveal", ""); //Make the tabs look nice for the creation mode