1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-26 06:50:09 +03:00

feature #2746: Fix host and image reset buttons

This commit is contained in:
Daniel Molina 2014-03-12 17:36:44 +01:00
parent 10c0b13576
commit 11b55f0920
3 changed files with 18 additions and 32 deletions

View File

@ -821,12 +821,11 @@ function updateHostInfo(request,host){
//Prepares the host creation dialog
function setupCreateHostDialog(){
dialogs_context.append('<div id="create_host_dialog"></div>');
$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;
}

View File

@ -839,9 +839,12 @@ function enable_all_datastores()
}
// Prepare the image creation dialog
function setupCreateImageDialog(dialog){
dialogs_context.append('<div id="create_image_dialog"></div>');
$create_image_dialog = $('#create_image_dialog',dialogs_context);
function setupCreateImageDialog(dialog) {
if ($('#create_image_dialog').length == 0) {
dialogs_context.append('<div id="create_image_dialog"></div>');
}
$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();

View File

@ -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