From 674552269a341a327fd9ecd26465095bf3cbd4af Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Wed, 14 Aug 2013 11:09:21 -0700 Subject: [PATCH] CLOUDSTACK-4142: listNetworkOfferings API has been changed to not return system owned network offerings to regular user. Therefore, change VPC tier detailView to get services from listNetworks API response instead of listNetworkOfferings API response. --- ui/scripts/vpc.js | 48 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/ui/scripts/vpc.js b/ui/scripts/vpc.js index af37873b99e..4ec158fe128 100644 --- a/ui/scripts/vpc.js +++ b/ui/scripts/vpc.js @@ -3325,32 +3325,30 @@ }, tabFilter: function(args) { - var networkOfferingHavingELB = 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") { - $(thisService.capability).each(function() { - if (this.name == "ElasticLb" && this.value == "true") { - networkOfferingHavingELB = true; - return false; //break $.each() loop - } - }); - return false; //break $.each() loop - } - }); - } - }); - - var hiddenTabs = ['ipAddresses', 'acl']; // Disable IP address tab; it is redundant with 'view all' button - - if (networkOfferingHavingELB == false) + var hiddenTabs = ['ipAddresses', 'acl']; // Disable IP address tab; it is redundant with 'view all' button + + var networkOfferingHavingELB = false; + var services = args.context.networks[0].service; + if(services != null) { + for(var i = 0; i < services.length; i++) { + if (services[i].name == "Lb") { + var capabilities = services[i].capability; + if(capabilities != null) { + for(var k = 0; k < capabilities.length; k++) { + if(capabilities[k].name == "ElasticLb") { + networkOfferingHavingELB = true; + break; + } + } + } + break; + } + } + } + if (networkOfferingHavingELB == false) { hiddenTabs.push("addloadBalancer"); + } + return hiddenTabs; },