From 3d22b494340cd299a20294e6f2ceff4e2e5d35e3 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Tue, 22 Nov 2011 15:32:56 -0800 Subject: [PATCH] cloudStack 3.0 new UI - zone chart - F5 - implement Enable, Disable action for network service provider F5. --- ui/scripts/system.js | 69 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 432893b945c..e638e1a83f5 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -1179,6 +1179,75 @@ fields: { ipaddress: { label: 'IP Address' }, lbdevicestate: { label: 'Status' } + }, + providerActionFilter: function(args) { + var allowedActions = []; + var jsonObj = nspMap["f5"]; + if(jsonObj.state == "Enabled") { + allowedActions.push("disable"); + } + else if(jsonObj.state == "Disabled") { + allowedActions.push("enable"); + } + return allowedActions; + }, + providerActions: { + enable: { + label: 'Enable', + action: function(args) { + $.ajax({ + url: createURL("updateNetworkServiceProvider&id=" + nspMap["f5"].id + "&state=Enabled"), //??? + dataType: "json", + success: function(json) { + var jid = json.updatenetworkserviceproviderresponse.jobid; + args.response.success( + {_custom: + { + jobId: jid, + getUpdatedItem: function(json) { + var item = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + nspMap["f5"] = item; + return item; + } + } + } + ); + } + }); + }, + messages: { + notification: function() { return 'Enabled Netscaler provider'; } + }, + notification: { poll: pollAsyncJobResult } + }, + disable: { + label: 'Disable', + action: function(args) { + $.ajax({ + url: createURL("updateNetworkServiceProvider&id=" + nspMap["f5"].id + "&state=Disabled"), + dataType: "json", + success: function(json) { + var jid = json.updatenetworkserviceproviderresponse.jobid; + args.response.success( + {_custom: + { + jobId: jid, + getUpdatedItem: function(json) { + var item = json.queryasyncjobresultresponse.jobresult.networkserviceprovider; + nspMap["f5"] = item; + return item; + } + } + } + ); + } + }); + }, + messages: { + notification: function() { return 'Disabled Netscaler provider'; } + }, + notification: { poll: pollAsyncJobResult } + } }, actions: { add: {