CS-15313: Error handling for account section This fixes an issue where an error is not displayed when entering an invalid account name.
Original patch by: Pranav Saxena <[email protected]> reviewed-by: Brian Federle <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/5fafb0e5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/5fafb0e5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/5fafb0e5 Branch: refs/heads/regions Commit: 5fafb0e5e59252bfc5f0cc1edcb21da5110938f5 Parents: b70bc92 Author: Brian Federle <[email protected]> Authored: Mon Jul 2 10:54:48 2012 -0700 Committer: Brian Federle <[email protected]> Committed: Mon Jul 2 11:01:38 2012 -0700 ---------------------------------------------------------------------- ui/scripts/accounts.js | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/5fafb0e5/ui/scripts/accounts.js ---------------------------------------------------------------------- diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index 6f30963..382510e 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -177,7 +177,7 @@ action: function(args) { var array1 = []; array1.push("&username=" + todb(args.data.username)); - + var errorMsg = ""; var password = args.data.password; if (md5Hashed) password = $.md5(password); @@ -266,6 +266,7 @@ edit: { label: 'message.edit.account', action: function(args) { + var errorMsg = ""; var accountObj = args.context.accounts[0]; var array1 = []; @@ -277,7 +278,12 @@ async: false, success: function(json) { accountObj = json.updateaccountresponse.account; + }, + error: function(json) { + errorMsg = parseXMLHttpResponse(json); + args.response.error(errorMsg); } + }); $.ajax({ @@ -325,6 +331,7 @@ } }); + if(errorMsg == "") args.response.success({data: accountObj}); } },
