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.
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/68f377e2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/68f377e2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/68f377e2 Branch: refs/heads/4.0 Commit: 68f377e29ccd7491962d50283395081538d34bd9 Parents: 6cd878d Author: Jessica Wang <[email protected]> Authored: Thu Sep 27 11:48:11 2012 -0700 Committer: Edison Su <[email protected]> Committed: Thu Sep 27 17:23:18 2012 -0700 ---------------------------------------------------------------------- ui/scripts/system.js | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/68f377e2/ui/scripts/system.js ---------------------------------------------------------------------- diff --git a/ui/scripts/system.js b/ui/scripts/system.js index e5d53e2..3759229 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];
