From 92d548c4dd7eaf238d33eaafb59bf6a9798e21ce Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Tue, 22 Nov 2011 18:03:38 -0800 Subject: [PATCH] cloudStack 3.0 new UI - zone chart - F5, SRX - implement Delet action. --- ui/scripts/system.js | 64 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 4 deletions(-) diff --git a/ui/scripts/system.js b/ui/scripts/system.js index f2d2841c3e1..3afb3e07ee9 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -1201,7 +1201,8 @@ } else if(jsonObj.state == "Disabled") { allowedActions.push("enable"); - } + } + allowedActions.push("shutdown"); return allowedActions; }, providerActions: { @@ -1260,7 +1261,34 @@ notification: function() { return 'Disabled F5 provider'; } }, notification: { poll: pollAsyncJobResult } - } + }, + shutdown: { + label: 'Shutdown', + action: function(args) { + $.ajax({ + url: createURL("deleteNetworkServiceProvider&id=" + nspMap["f5"].id), + dataType: "json", + success: function(json) { + var jid = json.deletenetworkserviceproviderresponse.jobid; + args.response.success( + {_custom: + { + jobId: jid, + getUpdatedItem: function(json) { + nspMap["f5"] = null; + return {}; //nothing in this network service provider needs to be updated, in fact, this whole network service provider has being deleted + } + } + } + ); + } + }); + }, + messages: { + notification: function() { return 'Shutdown F5 provider'; } + }, + notification: { poll: pollAsyncJobResult } + } }, actions: { add: { @@ -1429,7 +1457,8 @@ } else if(jsonObj.state == "Disabled") { allowedActions.push("enable"); - } + } + allowedActions.push("shutdown"); return allowedActions; }, providerActions: { @@ -1488,7 +1517,34 @@ notification: function() { return 'Disabled SRX provider'; } }, notification: { poll: pollAsyncJobResult } - } + }, + shutdown: { + label: 'Shutdown', + action: function(args) { + $.ajax({ + url: createURL("deleteNetworkServiceProvider&id=" + nspMap["srx"].id), + dataType: "json", + success: function(json) { + var jid = json.deletenetworkserviceproviderresponse.jobid; + args.response.success( + {_custom: + { + jobId: jid, + getUpdatedItem: function(json) { + nspMap["srx"] = null; + return {}; //nothing in this network service provider needs to be updated, in fact, this whole network service provider has being deleted + } + } + } + ); + } + }); + }, + messages: { + notification: function() { return 'Shutdown SRX provider'; } + }, + notification: { poll: pollAsyncJobResult } + } }, actions: { add: {