Updated Branches: refs/heads/master 592cd7586 -> 7f56a5ce7
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. Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/7f56a5ce Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/7f56a5ce Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/7f56a5ce Branch: refs/heads/master Commit: 7f56a5ce7cac865200d590b86b3a465382156850 Parents: 592cd75 Author: Jessica Wang <jessicaw...@apache.org> Authored: Fri Aug 9 15:51:46 2013 -0700 Committer: Jessica Wang <jessicaw...@apache.org> Committed: Fri Aug 9 15:53:11 2013 -0700 ---------------------------------------------------------------------- ui/scripts/network.js | 57 +++++++++++++++++----------------------------- 1 file changed, 21 insertions(+), 36 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7f56a5ce/ui/scripts/network.js ---------------------------------------------------------------------- diff --git a/ui/scripts/network.js b/ui/scripts/network.js index 2c501aa..53580a6 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)