From d32f272f0545f60da2e3e40ceaaaba1d0dedfaea Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 26 Apr 2013 12:58:52 +0200 Subject: [PATCH] bug #1959: Fixed reset button for datastore, host, image and vent tabs --- .../public/js/plugins/datastores-tab.js | 21 +++++- src/sunstone/public/js/plugins/hosts-tab.js | 26 ++++--- src/sunstone/public/js/plugins/images-tab.js | 69 ++++++++++++------- src/sunstone/public/js/plugins/vnets-tab.js | 23 ++++++- 4 files changed, 99 insertions(+), 40 deletions(-) diff --git a/src/sunstone/public/js/plugins/datastores-tab.js b/src/sunstone/public/js/plugins/datastores-tab.js index 7681fb4468..c2310eb09d 100644 --- a/src/sunstone/public/js/plugins/datastores-tab.js +++ b/src/sunstone/public/js/plugins/datastores-tab.js @@ -283,7 +283,7 @@ var create_datastore_tmpl =
\
\ \ - \ + \ \
\ \ @@ -300,7 +300,7 @@ var create_datastore_tmpl =
\
\ \ - \ + \ \
\ \ @@ -961,6 +961,23 @@ function setupCreateDatastoreDialog(){ $create_datastore_dialog.trigger("reveal:close") return false; }); + + $('#wizard_ds_reset_button').click(function(){ + $create_datastore_dialog.trigger('reveal:close'); + $create_datastore_dialog.remove(); + setupCreateDatastoreDialog(); + + popUpCreateDatastoreDialog(); + }); + + $('#advanced_ds_reset_button').click(function(){ + $create_datastore_dialog.trigger('reveal:close'); + $create_datastore_dialog.remove(); + setupCreateDatastoreDialog(); + + popUpCreateDatastoreDialog(); + $("a[href='#datastore_manual']").click(); + }); } function select_filesystem(){ diff --git a/src/sunstone/public/js/plugins/hosts-tab.js b/src/sunstone/public/js/plugins/hosts-tab.js index fcb3cab176..ac1405f3b2 100644 --- a/src/sunstone/public/js/plugins/hosts-tab.js +++ b/src/sunstone/public/js/plugins/hosts-tab.js @@ -81,8 +81,8 @@ var create_host_tmpl = '+tr("Create Host")+'\ \ \ -
\
\ +
\
\
\ \ @@ -178,17 +178,17 @@ var create_host_tmpl =
\
\
\ - '; +'; var hosts_select=""; var dataTable_hosts; @@ -924,6 +924,14 @@ function setupCreateHostDialog(){ $create_host_dialog.trigger("reveal:close") return false; }); + + $('#wizard_host_reset_button').click(function(){ + $create_host_dialog.trigger('reveal:close'); + $create_host_dialog.remove(); + setupCreateHostDialog(); + + popUpCreateHostDialog(); + }); } //Open creation dialogs diff --git a/src/sunstone/public/js/plugins/images-tab.js b/src/sunstone/public/js/plugins/images-tab.js index b9c30db692..a62e2d03f1 100644 --- a/src/sunstone/public/js/plugins/images-tab.js +++ b/src/sunstone/public/js/plugins/images-tab.js @@ -131,18 +131,29 @@ var create_image_tmpl =
'+tr("Persistence of the image")+'
\
\
\ +
\ +
\ + \ +
\ +
\ + \ +
\ +
\ +
'+tr("Select the datastore for this image")+'
\ +
\ +
\ \ \
\
\ '+tr("Image location")+':\ -
\ -
\ +
\ '+ tr("Provide a path")+'  \ '+tr("Upload")+'  \ '+tr("Empty datablock")+'  \ -
\
\ +
\
\
\
\ @@ -201,10 +212,10 @@ var create_image_tmpl =
\
\
\ -
\ +
\ \
\ -
\ +
\ \
\
\ @@ -212,10 +223,10 @@ var create_image_tmpl =
\
\
\ -
\ +
\ \
\ -
\ +
\ \
\
\ @@ -225,28 +236,16 @@ var create_image_tmpl =
\
\
\ -
\ +
\ \
\ -
\ +
\ \
\
\
'+tr("Target on which the image will be mounted at. For example: hda, sdb...")+'
\
\
\ -
\ -
\ - \ -
\ -
\ - \ -
\ -
\ -
'+tr("Select the datastore for this image")+'
\ -
\ -
\
\
\
\ @@ -254,7 +253,7 @@ var create_image_tmpl =
\
\ \ - \ + \ \
\
\ @@ -273,7 +272,7 @@ var create_image_tmpl =
\
\ \ - \ + \ \
\
\ @@ -814,12 +813,14 @@ function enable_all_datastores() // Prepare the image creation dialog function setupCreateImageDialog(){ - dialogs_context.append('
'); + dialogs_context.append('
'); $create_image_dialog = $('#create_image_dialog',dialogs_context); var dialog = $create_image_dialog; dialog.html(create_image_tmpl); + setupTips($create_image_dialog); + var height = Math.floor($(window).height()*0.8); //set height to a percentage of the window //Prepare jquery dialog @@ -1128,6 +1129,23 @@ function setupCreateImageDialog(){ $create_image_dialog.trigger("reveal:close") return false; }); + + $('#wizard_image_reset_button').click(function(){ + $create_image_dialog.trigger('reveal:close'); + $create_image_dialog.remove(); + setupCreateImageDialog(); + + popUpCreateImageDialog(); + }); + + $('#advanced_image_reset_button').click(function(){ + $create_image_dialog.trigger('reveal:close'); + $create_image_dialog.remove(); + setupCreateImageDialog(); + + popUpCreateImageDialog(); + $("a[href='#img_manual']").click(); + }); } function popUpCreateImageDialog(){ @@ -1173,7 +1191,7 @@ function is_persistent_image(id){ function setupImageCloneDialog(){ //Append to DOM - dialogs_context.append('
'); + dialogs_context.append('
'); var dialog = $('#image_clone_dialog',dialogs_context); //Put HTML in place @@ -1286,7 +1304,6 @@ $(document).ready(function(){ Sunstone.runAction("Image.list"); setupCreateImageDialog(); - setupTips($create_image_dialog); setupImageCloneDialog(); setImageAutorefresh(); diff --git a/src/sunstone/public/js/plugins/vnets-tab.js b/src/sunstone/public/js/plugins/vnets-tab.js index d8cda48b91..e65eb13192 100644 --- a/src/sunstone/public/js/plugins/vnets-tab.js +++ b/src/sunstone/public/js/plugins/vnets-tab.js @@ -398,7 +398,7 @@ var create_vn_tmpl = \ - \ + \ \
\
\ @@ -414,7 +414,7 @@ var create_vn_tmpl = \ - \ + \ \
\
\ @@ -1101,7 +1101,7 @@ function setupCreateVNetDialog() { // width: 475, // height: height //}); - dialog.addClass("reveal-modal large max-height"); + dialog.addClass("reveal-modal xlarge max-height"); //Make the tabs look nice for the creation mode //$('#vn_tabs',dialog).tabs(); @@ -1456,6 +1456,23 @@ function setupCreateVNetDialog() { $create_vn_dialog.trigger("reveal:close") return false; }); + + $('#wizard_vnet_reset_button').click(function(){ + $create_vn_dialog.trigger('reveal:close'); + $create_vn_dialog.remove(); + setupCreateVNetDialog(); + + popUpCreateVnetDialog(); + }); + + $('#advanced_vnet_reset_button').click(function(){ + $create_vn_dialog.trigger('reveal:close'); + $create_vn_dialog.remove(); + setupCreateVNetDialog(); + + popUpCreateVnetDialog(); + $("a[href='#vnet_advanced']").click(); + }); } function popUpCreateVnetDialog() {