From 68f377e29ccd7491962d50283395081538d34bd9 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Thu, 27 Sep 2012 11:48:11 -0700 Subject: [PATCH] CS-16407: cloudstack UI - Infrastructure page - zone - Physical network - Guest - network tab - make 2 API calls to get guest networks. The first one is to get guest networks under all projects. The 2nd one is to get guest networks that are not under any project. --- ui/scripts/system.js | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/ui/scripts/system.js b/ui/scripts/system.js index e5d53e2a4ac..37592294fac 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -1446,8 +1446,9 @@ //need to make 2 listNetworks API call to get all guest networks from one physical network in Advanced zone var items = []; + //"listNetworks&projectid=-1": list guest networks under all projects (no matter who the owner is) $.ajax({ - url: createURL("listNetworks&listAll=true&trafficType=Guest&zoneId=" + selectedZoneObj.id + "&physicalnetworkid=" + selectedPhysicalNetworkObj.id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), + url: createURL("listNetworks&projectid=-1&trafficType=Guest&zoneId=" + selectedZoneObj.id + "&physicalnetworkid=" + selectedPhysicalNetworkObj.id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", async: false, success: function(json) { @@ -1461,6 +1462,7 @@ networkCollectionMap[this.id] = this.name; }); + //"listNetworks&listAll=true: list guest networks that are not under any project (no matter who the owner is) $.ajax({ url: createURL("listNetworks&listAll=true&trafficType=Guest&zoneId=" + selectedZoneObj.id + "&physicalnetworkid=" + selectedPhysicalNetworkObj.id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")), dataType: "json", @@ -1784,10 +1786,24 @@ project: { label: 'label.project' } } ], - dataProvider: function(args) { + dataProvider: function(args) { + var data = { + id: args.context.networks[0].id + }; + if(args.context.networks[0].projectid != null) { + $.extend(data, { + projectid: -1 + }); + } + else { + $.extend(data, { + listAll: true //pass "&listAll=true" to "listNetworks&id=xxxxxxxx" for now before API gets fixed. + }); + } + $.ajax({ - url: createURL("listNetworks&id=" + args.context.networks[0].id + "&listAll=true"), //pass "&listAll=true" to "listNetworks&id=xxxxxxxx" for now before API gets fixed. - dataType: "json", + url: createURL("listNetworks"), + data: data, async: false, success: function(json) { selectedGuestNetworkObj = json.listnetworksresponse.network[0];