From becd611c0766bdbee2d99a5a030b42f8b54dc56d Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 5 Nov 2012 15:38:09 -0800 Subject: [PATCH] cloudstack UI - Infrastructure page - (1) restore hosts count on UI since listHosts API has been fixed. (2) specifying pagesize as 1 because we don't need any embedded objects to be returned for count display. --- ui/scripts/system.js | 52 ++++++++++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 14 deletions(-) diff --git a/ui/scripts/system.js b/ui/scripts/system.js index 7d3f1b9f3c9..ee269641c25 100644 --- a/ui/scripts/system.js +++ b/ui/scripts/system.js @@ -194,6 +194,10 @@ podCount: function(data) { $.ajax({ url: createURL('listPods'), + data: { + page: 1, + pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property. + }, success: function(json) { dataFns.clusterCount($.extend(data, { podCount: json.listpodsresponse.count ? @@ -206,20 +210,24 @@ clusterCount: function(data) { $.ajax({ url: createURL('listClusters'), - success: function(json) { - /* + data: { + page: 1, + pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property. + }, + success: function(json) { dataFns.hostCount($.extend(data, { clusterCount: json.listclustersresponse.count ? json.listclustersresponse.count : 0 })); - */ + + //comment the 4 lines above and uncomment the following 4 lines if listHosts API still responds slowly. - //uncomment the 4 lines above and remove the following 4 lines after "count" in listHosts API is fixed. + /* dataFns.primaryStorageCount($.extend(data, { clusterCount: json.listclustersresponse.count ? json.listclustersresponse.count : 0 })); - + */ } }); }, @@ -228,7 +236,9 @@ $.ajax({ url: createURL('listHosts'), data: { - type: 'routing' + type: 'routing', + page: 1, + pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property. }, success: function(json) { dataFns.primaryStorageCount($.extend(data, { @@ -242,20 +252,24 @@ primaryStorageCount: function(data) { $.ajax({ url: createURL('listStoragePools'), - success: function(json) { - /* + data: { + page: 1, + pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property. + }, + success: function(json) { dataFns.secondaryStorageCount($.extend(data, { primaryStorageCount: json.liststoragepoolsresponse.count ? json.liststoragepoolsresponse.count : 0 })); - */ + + //comment the 4 lines above and uncomment the following 4 lines if listHosts API still responds slowly. - //uncomment the 4 lines above and remove the following 4 lines after "count" in listHosts API is fixed. + /* dataFns.systemVmCount($.extend(data, { primaryStorageCount: json.liststoragepoolsresponse.count ? json.liststoragepoolsresponse.count : 0 })); - + */ } }); }, @@ -264,7 +278,9 @@ $.ajax({ url: createURL('listHosts'), data: { - type: 'SecondaryStorage' + type: 'SecondaryStorage', + page: 1, + pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property. }, success: function(json) { dataFns.systemVmCount($.extend(data, { @@ -278,6 +294,10 @@ systemVmCount: function(data) { $.ajax({ url: createURL('listSystemVms'), + data: { + page: 1, + pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property. + }, success: function(json) { dataFns.virtualRouterCount($.extend(data, { systemVmCount: json.listsystemvmsresponse.count ? @@ -291,14 +311,18 @@ $.ajax({ url: createURL('listRouters'), data: { - projectid: -1 + projectid: -1, + page: 1, + pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property. }, success: function(json) { var total1 = json.listroutersresponse.count ? json.listroutersresponse.count : 0; $.ajax({ url: createURL('listRouters'), data: { - listAll: true + listAll: true, + page: 1, + pagesize: 1 //specifying pagesize as 1 because we don't need any embedded objects to be returned here. The only thing we need from API response is "count" property. }, success: function(json) { var total2 = json.listroutersresponse.count ? json.listroutersresponse.count : 0;