diff --git a/src/sunstone/models/sunstone_guac.rb b/src/sunstone/models/sunstone_guac.rb index 2758bbd047..2ad045671a 100644 --- a/src/sunstone/models/sunstone_guac.rb +++ b/src/sunstone/models/sunstone_guac.rb @@ -126,7 +126,7 @@ class SunstoneGuac < SunstoneRemoteConnections 'hostname' => hostname, 'port' => vm_resource['TEMPLATE/GRAPHICS/PORT'], 'password' => vm_resource['TEMPLATE/GRAPHICS/PASSWD'] - }.compact + } ) end @@ -153,7 +153,7 @@ class SunstoneGuac < SunstoneRemoteConnections 'port' => vm_resource['TEMPLATE/CONTEXT/RDP_PORT'], 'username' => vm_resource['TEMPLATE/CONTEXT/USERNAME'], 'password' => vm_resource['TEMPLATE/CONTEXT/PASSWORD'] - }.compact + } ) end @@ -180,7 +180,7 @@ class SunstoneGuac < SunstoneRemoteConnections 'port' => vm_resource['TEMPLATE/CONTEXT/SSH_PORT'], 'username' => vm_resource['TEMPLATE/CONTEXT/USERNAME'], 'password' => vm_resource['TEMPLATE/CONTEXT/PASSWORD'] - }.compact + } ) end diff --git a/src/sunstone/public/app/sunstone.js b/src/sunstone/public/app/sunstone.js index ec6b9308c5..3176128e88 100644 --- a/src/sunstone/public/app/sunstone.js +++ b/src/sunstone/public/app/sunstone.js @@ -549,7 +549,10 @@ define(function(require) { //Listen for .action_buttons //An action buttons runs a predefined action. If it has type //"multiple" it runs that action on the elements of a datatable. - $(document).on("click", ".action_button", function() { + $(document).on("click", ".action_button", function(event) { + event.preventDefault(); + event.stopPropagation(); + var error = 0; var value = $(this).val(); var data = ($(this).attr("data") == "")? undefined: $(this).attr("data"); @@ -578,7 +581,10 @@ define(function(require) { //Listen .confirm_buttons. These buttons show a confirmation dialog //before running the action. - $(document).on("click", ".confirm_button", function() { + $(document).on("click", ".confirm_button", function(event) { + event.preventDefault(); + event.stopPropagation(); + var dialogInstance = _getDialogInstance(CONFIRM_DIALOG_ID); dialogInstance.reset(); $("#" + CONFIRM_DIALOG_ID).data("buttonAction", $(this).attr("href")); @@ -589,7 +595,10 @@ define(function(require) { //Listen .confirm_buttons. These buttons show a confirmation dialog //with a select box before running the action. - $(document).on("click", ".confirm_with_select_button", function() { + $(document).on("click", ".confirm_with_select_button", function(event) { + event.preventDefault(); + event.stopPropagation(); + var dialogInstance = _getDialogInstance(CONFIRM_WITH_SELECT_DIALOG_ID); dialogInstance.setParams({ @@ -606,16 +615,21 @@ define(function(require) { //$(document).foundation('dropdown', 'reflow'); // Button to return to the list view from the detailed view - $(document).on("click", "button[href='back']", function(e) { + $(document).on("click", "button[href='back']", function(event) { + event.preventDefault(); + event.stopPropagation(); + if(window.sunstoneNoMultipleRedirects){ window.history.back(); window.sunstoneNoMultipleRedirects = false; } - e.preventDefault(); }); // Reload foundation ips dropdown when change page on datatables - $(document).on("click", ".paginate_button", function() { + $(document).on("click", ".paginate_button", function(event) { + event.preventDefault(); + event.stopPropagation(); + UtilsFoundation.update(null); }); }; diff --git a/src/sunstone/public/app/tabs/vms-tab/actions.js b/src/sunstone/public/app/tabs/vms-tab/actions.js index 1d4a2bad51..37411c1e30 100644 --- a/src/sunstone/public/app/tabs/vms-tab/actions.js +++ b/src/sunstone/public/app/tabs/vms-tab/actions.js @@ -136,9 +136,9 @@ define(function(require) { "VM.deploy" : { type: "custom", call: function() { - Sunstone.getDialog(DEPLOY_DIALOG_ID) - .reset() - .show(); + var dialog = Sunstone.getDialog(DEPLOY_DIALOG_ID); + dialog.reset(); + dialog.show(); } }, "VM.silent_deploy_action" : { @@ -149,42 +149,42 @@ define(function(require) { "VM.migrate" : { type: "custom", call: function() { - Sunstone.getDialog(MIGRATE_DIALOG_ID) - .reset() - .setLive(false) - .setType(0) - .show(); - } + var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID); + dialog.reset(); + dialog.setLive(false); + dialog.setType(0); + dialog.show(); + } }, "VM.migrate_poff" : { type: "custom", call: function() { - Sunstone.getDialog(MIGRATE_DIALOG_ID) - .reset() - .setLive(false) - .setType(1) - .show(); - } + var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID); + dialog.reset(); + dialog.setLive(false); + dialog.setType(1); + dialog.show(); + } }, "VM.migrate_poff_hard" : { type: "custom", call: function() { - Sunstone.getDialog(MIGRATE_DIALOG_ID) - .reset() - .setLive(false) - .setType(2) - .show(); - } + var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID); + dialog.reset(); + dialog.setLive(false); + dialog.setType(2); + dialog.show(); + } }, "VM.migrate_live" : { type: "custom", call: function() { - Sunstone.getDialog(MIGRATE_DIALOG_ID) - .reset() - .setLive(true) - .setType(0) - .show(); - } + var dialog = Sunstone.getDialog(MIGRATE_DIALOG_ID); + dialog.reset(); + dialog.setLive(true); + dialog.setType(0); + dialog.show(); + } }, "VM.save_rdp" : { type: "custom", @@ -431,11 +431,12 @@ define(function(require) { id: resourceId }, success: function(_, vmTemplate){ - if (vmTemplate && - vmTemplate.VM && - vmTemplate.VM.USER_TEMPLATE && - vmTemplate.VM.USER_TEMPLATE.HYPERVISOR && - vmTemplate.VM.USER_TEMPLATE.HYPERVISOR !== "vcenter"){ + if ( + vmTemplate && + vmTemplate.VM && + vmTemplate.VM.USER_TEMPLATE && + vmTemplate.VM.USER_TEMPLATE.HYPERVISOR !== "vcenter" + ){ Sunstone.showTab(MARKETPLACEAPPS_TAB_ID); Sunstone.showFormPanel( MARKETPLACEAPPS_TAB_ID,