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.

This commit is contained in:
Jessica Wang 2012-09-27 11:48:11 -07:00 committed by Edison Su
parent 6cd878d8e0
commit 68f377e29c
1 changed files with 20 additions and 4 deletions

View File

@ -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];