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 Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/a96b27b5 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/a96b27b5 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/a96b27b5 Branch: refs/heads/marvin-parallel Commit: a96b27b5ac6005ed6176942ee7a9eb2494899694 Parents: 6ad1ed0 Author: Brian Federle <[email protected]> Authored: Wed Oct 24 14:02:16 2012 -0700 Committer: Brian Federle <[email protected]> Committed: Wed Oct 24 14:28:02 2012 -0700 ---------------------------------------------------------------------- ui/scripts/network.js | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a96b27b5/ui/scripts/network.js ---------------------------------------------------------------------- diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 66e9cfc..61e342c 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; },
