Support IP address and services UI for shared networks

Currently, the IP addresses section and PF/LB/FW rule configuration is
disabled for shared networks; this change enables it for any shared
network with the source NAT service enabled. This makes the UI the
same for how it is with isolated networks.
This commit is contained in:
Brian Federle 2012-10-25 12:02:13 -07:00
parent cc8b97ce97
commit 062190ccd8
1 changed files with 5 additions and 39 deletions

View File

@ -555,46 +555,12 @@
if(services == null)
return false;
if(args.context.networks[0].type == "Isolated") {
for(var i=0; i < services.length; i++) {
var service = services[i];
if(service.name == "SourceNat") {
return true;
}
}
}
else if(args.context.networks[0].type == "Shared") {
var havingSecurityGroupService = false;
var havingElasticIpCapability = false;
var havingElasticLbCapability = false;
for(var i=0; i < services.length; i++) {
var service = services[i];
if(service.name == "SecurityGroup") {
havingSecurityGroupService = true;
}
else if(service.name == "StaticNat") {
$(service.capability).each(function(){
if(this.name == "ElasticIp" && this.value == "true") {
havingElasticIpCapability = true;
return false; //break $.each() loop
}
});
}
else if(service.name == "Lb") {
$(service.capability).each(function(){
if(this.name == "ElasticLb" && this.value == "true") {
havingElasticLbCapability = true;
return false; //break $.each() loop
}
});
}
}
if(havingSecurityGroupService == true && havingElasticIpCapability == true && havingElasticLbCapability == true)
// IP addresses supported for both isolated and shared networks w/ source NAT enabled
for(var i=0; i < services.length; i++) {
var service = services[i];
if(service.name == "SourceNat") {
return true;
else
return false;
}
}
return false;