From 05964ea465b2b70ce0fd1f75a6489b4dae98d15a Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 17 May 2012 11:31:47 -0700 Subject: [PATCH] CS-14901: cloudstack 3.0 UI - IP Address page - non-SourceNAT IP - when network offering's Conserve Mode is off, hide LoadBalancer when any PortForwarding rule exists, hide PortForwarding when any LoadBalancer rule exists. --- ui/scripts/network.js | 75 +++++++++++++++++++++++++++++++------------ 1 file changed, 54 insertions(+), 21 deletions(-) diff --git a/ui/scripts/network.js b/ui/scripts/network.js index d3c477bb302..31c7bd04397 100644 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -70,6 +70,24 @@ } //3. Once a PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer. + $.ajax({ + url: createURL('listPortForwardingRules'), + data: { + ipaddressid: item.id, + listAll: true + }, + dataType: 'json', + async: false, + success: function(json) { + var rules = json.listportforwardingrulesresponse.portforwardingrule; + if(rules != null && rules.length > 0) { + disallowedActions.push('enableVPN'); + disallowedActions.push('enableStaticNAT'); + } + } + }); + + //4. Once a LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding. $.ajax({ url: createURL('listLoadBalancerRules'), data: { @@ -85,27 +103,7 @@ disallowedActions.push('enableStaticNAT'); } } - }); - - //4. Once a LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding. - $.ajax({ - url: createURL('listPortForwardingRules'), - data: { - ipaddressid: item.id, - listAll: true - }, - dataType: 'json', - async: false, - success: function(json) { - // Get instance - var rules = json.listportforwardingrulesresponse.portforwardingrule; - if(rules != null && rules.length > 0) { - disallowedActions.push('enableVPN'); - disallowedActions.push('enableStaticNAT'); - } - } - }); - + }); } } @@ -1562,6 +1560,41 @@ disallowedActions.push("portForwarding"); disallowedActions.push("loadBalancing"); } + + //3. Once a PortForwarding rule is added, hide StaticNat/VPN/LoadBalancer. + $.ajax({ + url: createURL('listPortForwardingRules'), + data: { + ipaddressid: args.context.ipAddresses[0].id, + listAll: true + }, + dataType: 'json', + async: false, + success: function(json) { + // Get instance + var rules = json.listportforwardingrulesresponse.portforwardingrule; + if(rules != null && rules.length > 0) { + disallowedActions.push("loadBalancing"); + } + } + }); + + //4. Once a LoadBalancer rule is added, hide StaticNat/VPN/PortForwarding. + $.ajax({ + url: createURL('listLoadBalancerRules'), + data: { + publicipid: args.context.ipAddresses[0].id, + listAll: true + }, + dataType: 'json', + async: false, + success: function(json) { + var rules = json.listloadbalancerrulesresponse.loadbalancerrule; + if(rules != null && rules.length > 0) { + disallowedActions.push("portForwarding"); + } + } + }); } }