From a96b27b5ac6005ed6176942ee7a9eb2494899694 Mon Sep 17 00:00:00 2001 From: Brian Federle Date: Wed, 24 Oct 2012 14:02:16 -0700 Subject: [PATCH] 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 --- ui/scripts/network.js | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 66e9cfc0584..61e342c4175 100644 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -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; },