CS-16566: Remove egress rule tab if network ACL not present

-If network ACL feature is not part of a network's offering, then hide
 the egress rule tab

-Also includes code cleanup of network tabFilter
This commit is contained in:
Brian Federle 2012-10-24 14:02:16 -07:00
parent 6ad1ed05e3
commit a96b27b5ac
1 changed files with 16 additions and 5 deletions

View File

@ -782,30 +782,41 @@
tabFilter: function(args) {
var networkOfferingHavingELB = false;
var hasNetworkACL = false;
$.ajax({
url: createURL("listNetworkOfferings&id=" + args.context.networks[0].networkofferingid),
dataType: "json",
async: false,
success: function(json) {
var networkoffering = json.listnetworkofferingsresponse.networkoffering[0];
$(networkoffering.service).each(function(){
var thisService = this;
if(thisService.name == "Lb") {
if (thisService.name == 'NetworkACL') {
hasNetworkACL = true;
} else if (thisService.name == "Lb") {
$(thisService.capability).each(function(){
if(this.name == "ElasticLb" && this.value == "true") {
if (this.name == "ElasticLb" && this.value == "true") {
networkOfferingHavingELB = true;
return false; //break $.each() loop
}
});
return false; //break $.each() loop
}
});
}
});
var hiddenTabs = [];
if(networkOfferingHavingELB == false)
if (!networkOfferingHavingELB) {
hiddenTabs.push("addloadBalancer");
}
if (!hasNetworkACL) {
hiddenTabs.push('egressRules');
}
return hiddenTabs;
},