From d0874522d0d361e31ba87a0f5ce87b49fb2d079f Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 7 Nov 2011 14:42:47 -0800 Subject: [PATCH] cloudStack 3.0 new UI - account page - implement Delete Account action. --- ui/scripts/accounts.js | 46 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js index 402512b0e0b..d38c9cc5979 100644 --- a/ui/scripts/accounts.js +++ b/ui/scripts/accounts.js @@ -403,8 +403,50 @@ args.complete(); } } - } + }, + 'delete': { + label: 'Delete account', + messages: { + confirm: function(args) { + return 'Are you sure you want to delete this account?'; + }, + success: function(args) { + return 'Account is being deleted.'; + }, + notification: function(args) { + return 'Deleting account'; + }, + complete: function(args) { + return 'Account has been deleted.'; + } + }, + action: function(args) { + $.ajax({ + url: createURL("deleteAccount&id=" + args.context.accounts[0].id), + dataType: "json", + async: true, + success: function(json) { + var jid = json.deleteaccountresponse.jobid; + args.response.success( + {_custom: + {jobId: jid, + getUpdatedItem: function(json) { + return {}; //nothing in this account needs to be updated, in fact, this whole account has being deleted + }, + getActionFilter: function() { + return accountActionfilter; + } + } + } + ); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + } }, @@ -523,7 +565,7 @@ } ], - dataProvider: function(args) { + dataProvider: function(args) { var accountObj = args.context.accounts[0]; $.ajax({ url: createURL("listResourceLimits&domainid=" + accountObj.domainid + "&account=" + accountObj.name),