From 635ab5fbac444d1d14bebfcf84ea08c20a70b975 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Fri, 25 Oct 2013 15:16:17 -0700 Subject: [PATCH] CLOUDSTACK-4966: UI > Instances > destroyed VM > implement "expunge" option (for root-admin and domain-admin only). --- ui/scripts/instances.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/ui/scripts/instances.js b/ui/scripts/instances.js index e225f3939c6..3ad99f7a7b7 100644 --- a/ui/scripts/instances.js +++ b/ui/scripts/instances.js @@ -593,6 +593,43 @@ poll: pollAsyncJobResult } }, + + expunge: { + label: 'Expunge Instance', + compactLabel: 'Expunge', + messages: { + confirm: function(args) { + return 'Please confirm you want to expunge this instance.'; + }, + notification: function(args) { + return 'Expunge Instance'; + } + }, + action: function(args) { + $.ajax({ + url: createURL('destroyVirtualMachine'), + data: { + id: args.context.instances[0].id, + expunge: true + }, + success: function(json) { + var jid = json.destroyvirtualmachineresponse.jobid; + args.response.success({ + _custom: { + jobId: jid, + getActionFilter: function() { + return vmActionfilter; + } + } + }); + } + }); + }, + notification: { + poll: pollAsyncJobResult + } + }, + restore: { label: 'label.action.restore.instance', compactLabel: 'label.restore', @@ -2049,6 +2086,7 @@ if (jsonObj.state == 'Destroyed') { if (isAdmin() || isDomainAdmin()) { allowedActions.push("restore"); + allowedActions.push("expunge"); } } else if (jsonObj.state == 'Running') { allowedActions.push("stop");