You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/12/11 00:52:26 UTC
[46/50] [abbrv] git commit: updated refs/heads/ui-restyle to 326b3a6
CLOUDSTACK-5252: UI > Infrastructure > Virtual Routers > Select view: group by zone/pod/cluster > (1) pass listAll=true to listRouters. (2) reduce redundant API call.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/93ba232e
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/93ba232e
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/93ba232e
Branch: refs/heads/ui-restyle
Commit: 93ba232eeaf834a1cf2f23f28dd0b45d5fd8bb6d
Parents: a9d96af
Author: Jessica Wang <je...@apache.org>
Authored: Tue Dec 10 14:40:51 2013 -0800
Committer: Jessica Wang <je...@apache.org>
Committed: Tue Dec 10 14:41:45 2013 -0800
----------------------------------------------------------------------
ui/scripts/system.js | 64 ++++++++++++++++++++++++++++++-----------------
1 file changed, 41 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/93ba232e/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 7ccdfb0..f804312 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -8805,19 +8805,21 @@
var zoneObjs = json.listzonesresponse.zone;
if (zoneObjs != null) {
for (var i = 0; i < zoneObjs.length; i++) {
+ var currentPage = 1;
$.ajax({
url: createURL('listRouters'),
data: {
- zoneid: zoneObjs[i].id
+ zoneid: zoneObjs[i].id,
+ listAll: true,
+ page: currentPage,
+ pagesize: pageSize //global variable
},
async: false,
success: function(json) {
if (json.listroutersresponse.count != undefined) {
- zoneObjs[i].routerCount = json.listroutersresponse.count;
-
- var routerCountFromAllPages = zoneObjs[i].routerCount;
- var currentPage = 1;
- var routerCountFromFirstPageToCurrentPage = 0;
+ zoneObjs[i].routerCount = json.listroutersresponse.count;
+ var routerCountFromAllPages = json.listroutersresponse.count;
+ var routerCountFromFirstPageToCurrentPage = json.listroutersresponse.router.length;
var routerRequiresUpgrade = 0;
var callListApiWithPage = function() {
$.ajax({
@@ -8825,6 +8827,7 @@
async: false,
data: {
zoneid: zoneObjs[i].id,
+ listAll: true,
page: currentPage,
pagesize: pageSize //global variable
},
@@ -8843,7 +8846,10 @@
}
});
}
- callListApiWithPage();
+ if (routerCountFromFirstPageToCurrentPage < routerCountFromAllPages) {
+ currentPage++;
+ callListApiWithPage();
+ }
zoneObjs[i].routerRequiresUpgrade = routerRequiresUpgrade;
} else {
@@ -9024,26 +9030,29 @@
var podObjs = json.listpodsresponse.pod;
if (podObjs != null) {
for (var i = 0; i < podObjs.length; i++) {
- $.ajax({
+ var currentPage = 1;
+ $.ajax({
url: createURL('listRouters'),
data: {
- podid: podObjs[i].id
+ podid: podObjs[i].id,
+ listAll: true,
+ page: currentPage,
+ pagesize: pageSize //global variable
},
async: false,
success: function (json) {
if (json.listroutersresponse.count != undefined) {
podObjs[i].routerCount = json.listroutersresponse.count;
-
- var routerCountFromAllPages = podObjs[i].routerCount;
- var currentPage = 1;
- var routerCountFromFirstPageToCurrentPage = 0;
- var routerRequiresUpgrade = 0;
+ var routerCountFromAllPages = json.listroutersresponse.count;
+ var routerCountFromFirstPageToCurrentPage = json.listroutersresponse.router.length;
+ var routerRequiresUpgrade = 0;
var callListApiWithPage = function () {
$.ajax({
url: createURL('listRouters'),
async: false,
data: {
podid: podObjs[i].id,
+ listAll: true,
page: currentPage,
pagesize: pageSize //global variable
},
@@ -9061,8 +9070,11 @@
}
}
});
- }
- callListApiWithPage();
+ }
+ if (routerCountFromFirstPageToCurrentPage < routerCountFromAllPages) {
+ currentPage++;
+ callListApiWithPage();
+ }
podObjs[i].routerRequiresUpgrade = routerRequiresUpgrade;
} else {
@@ -9245,19 +9257,21 @@
var clusterObjs = json.listclustersresponse.cluster;
if (clusterObjs != null) {
for (var i = 0; i < clusterObjs.length; i++) {
- $.ajax({
+ var currentPage = 1;
+ $.ajax({
url: createURL('listRouters'),
data: {
- clusterid: clusterObjs[i].id
+ clusterid: clusterObjs[i].id,
+ listAll: true,
+ page: currentPage,
+ pagesize: pageSize //global variable
},
async: false,
success: function (json) {
if (json.listroutersresponse.count != undefined) {
clusterObjs[i].routerCount = json.listroutersresponse.count;
-
- var routerCountFromAllPages = clusterObjs[i].routerCount;
- var currentPage = 1;
- var routerCountFromFirstPageToCurrentPage = 0;
+ var routerCountFromAllPages = json.listroutersresponse.count;
+ var routerCountFromFirstPageToCurrentPage = json.listroutersresponse.router.length;
var routerRequiresUpgrade = 0;
var callListApiWithPage = function () {
$.ajax({
@@ -9265,6 +9279,7 @@
async: false,
data: {
clusterid: clusterObjs[i].id,
+ listAll: true,
page: currentPage,
pagesize: pageSize //global variable
},
@@ -9283,7 +9298,10 @@
}
});
}
- callListApiWithPage();
+ if (routerCountFromFirstPageToCurrentPage < routerCountFromAllPages) {
+ currentPage++;
+ callListApiWithPage();
+ }
clusterObjs[i].routerRequiresUpgrade = routerRequiresUpgrade;
} else {