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.

This commit is contained in:
Jessica Wang 2012-10-18 14:00:32 -07:00
parent a8e18f0529
commit 714b0593d3

View File

@ -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;
},