From e6d03f2322822aee331a1a2aa60190c4c755c402 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Fri, 9 Aug 2013 15:51:46 -0700 Subject: [PATCH] CLOUDSTACK-4142: listNetworkOfferings API has been changed to not return system-owned network offerings to regular user(domain user). This API change causes several UI bugs. Change Edit Network action, Configuration tab of IP Address detailsView, to get network services from listNetworks API response instead of listNetworkOfferings API response. --- ui/scripts/network.js | 57 ++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 36 deletions(-) diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 2c501aa22e1..53580a65b6a 100755 --- a/ui/scripts/network.js +++ b/ui/scripts/network.js @@ -1168,20 +1168,13 @@ }); } }); - $.ajax({ - url: createURL("listNetworkOfferings&id=" + args.context.networks[0].networkofferingid), //include currently selected network offeirng to dropdown - dataType: "json", - async: false, - success: function(json) { - var networkOfferingObjs = json.listnetworkofferingsresponse.networkoffering; - $(networkOfferingObjs).each(function() { - items.push({ - id: this.id, - description: this.displaytext - }); - }); - } - }); + + //include currently selected network offeirng to dropdown + items.push({ + id: args.context.networks[0].networkofferingid, + description: args.context.networks[0].networkofferingdisplaytext + }); + args.response.success({ data: items }); @@ -2707,28 +2700,20 @@ var havingVpnService = false; if ('networks' in args.context && args.context.networks[0].vpcid == null) { //a non-VPC network from Guest Network section - $.ajax({ - url: createURL('listNetworkOfferings'), - data: { - listAll: true, - id: args.context.networks[0].networkofferingid - }, - async: false, - success: function(json) { - var networkoffering = json.listnetworkofferingsresponse.networkoffering[0]; - $(networkoffering.service).each(function() { - var thisService = this; - if (thisService.name == "Firewall") - havingFirewallService = true; - if (thisService.name == "PortForwarding") - havingPortForwardingService = true; - if (thisService.name == "Lb") - havingLbService = true; - if (thisService.name == "Vpn") - havingVpnService = true; - }); - } - }); + var services = args.context.networks[0].service; + if(services != null) { + for(var i = 0; i < services.length; i++) { + var thisService = services[i]; + if (thisService.name == "Firewall") + havingFirewallService = true; + if (thisService.name == "PortForwarding") + havingPortForwardingService = true; + if (thisService.name == "Lb") + havingLbService = true; + if (thisService.name == "Vpn") + havingVpnService = true; + } + } } else { //a VPC network from Guest Network section or from VPC section // Firewall is not supported in IP from VPC section // (because ACL has already supported in tier from VPC section)