diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js index dc450699468..955aaa9b82f 100644 --- a/ui/scripts/cloudStack.js +++ b/ui/scripts/cloudStack.js @@ -34,6 +34,15 @@ }); $(function() { + /** + * Generic error handling + */ + $.ajaxSetup({ + error: function(data) { + cloudStack.dialog.notice({ message: parseXMLHttpResponse(data) }); + } + }); + var $container = $('#cloudStack3-container'); var loginArgs = { diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js index c47522f830a..858e47950a3 100644 --- a/ui/scripts/sharedFunctions.js +++ b/ui/scripts/sharedFunctions.js @@ -58,6 +58,7 @@ var pollAsyncJobResult = function(args) { else if (result.jobstatus == 2) { // Failed var msg = (result.jobresult.errortext == null)? "": result.jobresult.errortext; args.error({message: msg}); + cloudStack.dialog.notice({ message: msg }); } } }, diff --git a/ui/scripts/ui-custom/instanceWizard.js b/ui/scripts/ui-custom/instanceWizard.js index a7e1e672acf..8a01777bf29 100644 --- a/ui/scripts/ui-custom/instanceWizard.js +++ b/ui/scripts/ui-custom/instanceWizard.js @@ -54,7 +54,7 @@ $('div.overlay').remove(); if (args.message) { - cloudStack.dialog.notice({ message: args.message }); + //cloudStack.dialog.notice({ message: args.message }); } } } diff --git a/ui/scripts/ui-custom/login.js b/ui/scripts/ui-custom/login.js index 0eb0a5b9f87..f874a35a450 100644 --- a/ui/scripts/ui-custom/login.js +++ b/ui/scripts/ui-custom/login.js @@ -61,7 +61,7 @@ }); }, error: function(args) { - cloudStack.dialog.notice({ message: 'Invalid username and/or password.' }); + //cloudStack.dialog.notice({ message: 'Invalid username and/or password.' }); } } }); diff --git a/ui/scripts/ui-custom/zoneWizard.js b/ui/scripts/ui-custom/zoneWizard.js index a6638dec4d4..9dba4551d09 100644 --- a/ui/scripts/ui-custom/zoneWizard.js +++ b/ui/scripts/ui-custom/zoneWizard.js @@ -42,7 +42,7 @@ $('div.overlay').remove(); if (args.message) { - cloudStack.dialog.notice({ message: args.message }); + //cloudStack.dialog.notice({ message: args.message }); } } } diff --git a/ui/scripts/ui/dialog.js b/ui/scripts/ui/dialog.js index 686fa3ad583..660520e8008 100644 --- a/ui/scripts/ui/dialog.js +++ b/ui/scripts/ui/dialog.js @@ -372,6 +372,7 @@ 'class': 'close', click: function() { $(this).dialog('destroy'); + if (args.clickAction) args.clickAction(); } } ] diff --git a/ui/scripts/ui/widgets/detailView.js b/ui/scripts/ui/widgets/detailView.js index 5d717523e70..9b5170ac9da 100644 --- a/ui/scripts/ui/widgets/detailView.js +++ b/ui/scripts/ui/widgets/detailView.js @@ -199,8 +199,8 @@ ); }, error: function(args) { - if (args.message) - cloudStack.dialog.notice({ message: args.message }); + // if (args.message) + // cloudStack.dialog.notice({ message: args.message }); } } }); @@ -372,7 +372,7 @@ $value.html(originalValue); }); - if (args.message) cloudStack.dialog.notice({ message: args.message }); + // if (args.message) cloudStack.dialog.notice({ message: args.message }); } } }); diff --git a/ui/scripts/ui/widgets/listView.js b/ui/scripts/ui/widgets/listView.js index 70c936b3cc2..ddc3c73b0d8 100644 --- a/ui/scripts/ui/widgets/listView.js +++ b/ui/scripts/ui/widgets/listView.js @@ -221,8 +221,8 @@ ); }, error: function(data){ - if (data.message) - cloudStack.dialog.notice({ message: data.message }); + // if (data.message) + // cloudStack.dialog.notice({ message: data.message }); } } }; @@ -343,7 +343,7 @@ }, error: function(args) { if (args.message) { - cloudStack.dialog.notice({ message: args.message }); + //cloudStack.dialog.notice({ message: args.message }); $edit.hide(), $label.html(oldVal).fadeIn(); $instanceRow.closest('div.data-table').dataTable('refresh'); @@ -898,7 +898,7 @@ }, error: function(args) { if (args.message) { - cloudStack.dialog.notice({ message: args.message }); + //cloudStack.dialog.notice({ message: args.message }); } } } diff --git a/ui/scripts/ui/widgets/notifications.js b/ui/scripts/ui/widgets/notifications.js index 27e9ffde174..9e3510a8457 100644 --- a/ui/scripts/ui/widgets/notifications.js +++ b/ui/scripts/ui/widgets/notifications.js @@ -89,7 +89,7 @@ incomplete: function(args) {}, error: function(args) { if (args.message) { - cloudStack.dialog.notice({ message: args.message }); + //cloudStack.dialog.notice({ message: args.message }); } clearInterval(pollTimer);