Skip to content

Commit d7508a4

Browse files
author
Jessica Wang
committed
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.
1 parent 7e1c3ec commit d7508a4

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

ui/scripts/system.js

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1446,8 +1446,9 @@
14461446

14471447
//need to make 2 listNetworks API call to get all guest networks from one physical network in Advanced zone
14481448
var items = [];
1449+
//"listNetworks&projectid=-1": list guest networks under all projects (no matter who the owner is)
14491450
$.ajax({
1450-
url: createURL("listNetworks&listAll=true&trafficType=Guest&zoneId=" + selectedZoneObj.id + "&physicalnetworkid=" + selectedPhysicalNetworkObj.id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
1451+
url: createURL("listNetworks&projectid=-1&trafficType=Guest&zoneId=" + selectedZoneObj.id + "&physicalnetworkid=" + selectedPhysicalNetworkObj.id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
14511452
dataType: "json",
14521453
async: false,
14531454
success: function(json) {
@@ -1461,6 +1462,7 @@
14611462
networkCollectionMap[this.id] = this.name;
14621463
});
14631464

1465+
//"listNetworks&listAll=true: list guest networks that are not under any project (no matter who the owner is)
14641466
$.ajax({
14651467
url: createURL("listNetworks&listAll=true&trafficType=Guest&zoneId=" + selectedZoneObj.id + "&physicalnetworkid=" + selectedPhysicalNetworkObj.id + "&page=" + args.page + "&pagesize=" + pageSize + array1.join("")),
14661468
dataType: "json",
@@ -1784,10 +1786,24 @@
17841786
project: { label: 'label.project' }
17851787
}
17861788
],
1787-
dataProvider: function(args) {
1789+
dataProvider: function(args) {
1790+
var data = {
1791+
id: args.context.networks[0].id
1792+
};
1793+
if(args.context.networks[0].projectid != null) {
1794+
$.extend(data, {
1795+
projectid: -1
1796+
});
1797+
}
1798+
else {
1799+
$.extend(data, {
1800+
listAll: true //pass "&listAll=true" to "listNetworks&id=xxxxxxxx" for now before API gets fixed.
1801+
});
1802+
}
1803+
17881804
$.ajax({
1789-
url: createURL("listNetworks&id=" + args.context.networks[0].id + "&listAll=true"), //pass "&listAll=true" to "listNetworks&id=xxxxxxxx" for now before API gets fixed.
1790-
dataType: "json",
1805+
url: createURL("listNetworks"),
1806+
data: data,
17911807
async: false,
17921808
success: function(json) {
17931809
selectedGuestNetworkObj = json.listnetworksresponse.network[0];

0 commit comments

Comments
 (0)