From 714b0593d3dfaa81af3c13d19a8105d1036954f7 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 18 Oct 2012 14:00:32 -0700 Subject: [PATCH] cloudstack UI - Static NAT, Port Forwarding and Firewall Implementation on JuniperSRX - IP Address page - configuration - if Firewall is provided by JuniperSRX, hide Firewall icon when Port forwarding is configured on IP Address. --- ui/scripts/network.js | 44 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 299b70b6f97..c4454810074 100644 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -1820,8 +1820,10 @@ var havingFirewallService = false; var havingPortForwardingService = false; var havingLbService = false; - var havingVpnService = false; - + var havingVpnService = false; + + var FirewallProviderArrayIncludesJuniperSRX = false; + if('networks' in args.context && args.context.networks[0].vpcid == null) { //a non-VPC network from Guest Network section $.ajax({ url: createURL('listNetworkOfferings'), @@ -1834,14 +1836,25 @@ var networkoffering = json.listnetworkofferingsresponse.networkoffering[0]; $(networkoffering.service).each(function(){ var thisService = this; - if(thisService.name == "Firewall") + if(thisService.name == "Firewall") { havingFirewallService = true; - if(thisService.name == "PortForwarding") + var providerArray = thisService.provider; + for(var k = 0; k < providerArray.length; k++) { + if(providerArray[k].name == "JuniperSRX") { + FirewallProviderArrayIncludesJuniperSRX = true; + break; + } + } + } + if(thisService.name == "PortForwarding") { havingPortForwardingService = true; - if(thisService.name == "Lb") + } + if(thisService.name == "Lb") { havingLbService = true; - if(thisService.name == "Vpn") + } + if(thisService.name == "Vpn") { havingVpnService = true; + } }); } }); @@ -1960,7 +1973,24 @@ }); } } - + + if(FirewallProviderArrayIncludesJuniperSRX == true) { //if Firewall is provided by JuniperSRX + $.ajax({ + url: createURL('listPortForwardingRules'), + data: { + ipaddressid: args.context.ipAddresses[0].id, + listAll: true + }, + async: false, + success: function(json) { + var rules = json.listportforwardingrulesresponse.portforwardingrule; + if(rules != null && rules.length > 0) { + disallowedActions.push("firewall"); //hide Firewall icon when Port forwarding is configured on IP Address + } + } + }); + } + return disallowedActions; },