mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-7450: UI - dashboard - pass &pageSize=1&page=1 to listXXX API calls that are for getting total number of items.
This commit is contained in:
parent
718fd5f39f
commit
21ff99b0ae
@ -29,26 +29,61 @@
|
|||||||
dataProvider: function(args) {
|
dataProvider: function(args) {
|
||||||
var dataFns = {
|
var dataFns = {
|
||||||
instances: function(data) {
|
instances: function(data) {
|
||||||
$.ajax({
|
var totalInstanceCount = 0;
|
||||||
url: createURL('listVirtualMachines'),
|
$.ajax({
|
||||||
|
url: createURL("listVirtualMachines"),
|
||||||
data: {
|
data: {
|
||||||
listAll: true
|
listAll: true,
|
||||||
|
page: 1,
|
||||||
|
pageSize: 1
|
||||||
},
|
},
|
||||||
|
async: false,
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var instances = json.listvirtualmachinesresponse.virtualmachine ?
|
if (json.listvirtualmachinesresponse.count != undefined) {
|
||||||
json.listvirtualmachinesresponse.virtualmachine : [];
|
totalInstanceCount = json.listvirtualmachinesresponse.count;
|
||||||
|
}
|
||||||
dataFns.account($.extend(data, {
|
|
||||||
runningInstances: $.grep(instances, function(instance) {
|
|
||||||
return instance.state == 'Running';
|
|
||||||
}).length,
|
|
||||||
stoppedInstances: $.grep(instances, function(instance) {
|
|
||||||
return instance.state == 'Stopped';
|
|
||||||
}).length,
|
|
||||||
totalInstances: instances.length
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var RunningInstanceCount = 0;
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("listVirtualMachines"),
|
||||||
|
data: {
|
||||||
|
listAll: true,
|
||||||
|
page: 1,
|
||||||
|
pageSize: 1,
|
||||||
|
state: "Running"
|
||||||
|
},
|
||||||
|
async: false,
|
||||||
|
success: function(json) {
|
||||||
|
if (json.listvirtualmachinesresponse.count != undefined) {
|
||||||
|
RunningInstanceCount = json.listvirtualmachinesresponse.count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
var stoppedInstanceCount = 0;
|
||||||
|
$.ajax({
|
||||||
|
url: createURL("listVirtualMachines"),
|
||||||
|
data: {
|
||||||
|
listAll: true,
|
||||||
|
page: 1,
|
||||||
|
pageSize: 1,
|
||||||
|
state: "Stopped"
|
||||||
|
},
|
||||||
|
async: false,
|
||||||
|
success: function(json) {
|
||||||
|
if (json.listvirtualmachinesresponse.count != undefined) {
|
||||||
|
stoppedInstanceCount = json.listvirtualmachinesresponse.count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dataFns.account($.extend(data, {
|
||||||
|
runningInstances: RunningInstanceCount,
|
||||||
|
stoppedInstances: stoppedInstanceCount,
|
||||||
|
totalInstances: totalInstanceCount
|
||||||
|
}));
|
||||||
},
|
},
|
||||||
|
|
||||||
account: function(data) {
|
account: function(data) {
|
||||||
@ -68,7 +103,8 @@
|
|||||||
data: {
|
data: {
|
||||||
listAll: true,
|
listAll: true,
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 4
|
pageSize: (pageSize > 4? 4: pageSize) //if default.page.size > 4, show 4 items only (since space on dashboard is limited)
|
||||||
|
//pageSize: 1 //for testing only
|
||||||
},
|
},
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
dataFns.ipAddresses($.extend(data, {
|
dataFns.ipAddresses($.extend(data, {
|
||||||
@ -83,6 +119,8 @@
|
|||||||
url: createURL('listNetworks'),
|
url: createURL('listNetworks'),
|
||||||
data: {
|
data: {
|
||||||
listAll: true,
|
listAll: true,
|
||||||
|
page: 1,
|
||||||
|
pageSize: 1,
|
||||||
type: 'isolated',
|
type: 'isolated',
|
||||||
supportedServices: 'SourceNat'
|
supportedServices: 'SourceNat'
|
||||||
},
|
},
|
||||||
@ -92,6 +130,10 @@
|
|||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: createURL('listPublicIpAddresses'),
|
url: createURL('listPublicIpAddresses'),
|
||||||
|
data: {
|
||||||
|
page: 1,
|
||||||
|
pageSize: 1
|
||||||
|
},
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var ipTotal = json.listpublicipaddressesresponse.count ?
|
var ipTotal = json.listpublicipaddressesresponse.count ?
|
||||||
json.listpublicipaddressesresponse.count : 0;
|
json.listpublicipaddressesresponse.count : 0;
|
||||||
@ -163,7 +205,7 @@
|
|||||||
url: createURL('listAlerts'),
|
url: createURL('listAlerts'),
|
||||||
data: {
|
data: {
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 4
|
pageSize: (pageSize > 4? 4: pageSize) //if default.page.size > 4, show 4 items only (since space on dashboard is limited)
|
||||||
},
|
},
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var alerts = json.listalertsresponse.alert ?
|
var alerts = json.listalertsresponse.alert ?
|
||||||
@ -188,7 +230,7 @@
|
|||||||
data: {
|
data: {
|
||||||
state: 'Alert',
|
state: 'Alert',
|
||||||
page: 1,
|
page: 1,
|
||||||
pageSize: 4
|
pageSize: (pageSize > 4? 4: pageSize) //if default.page.size > 4, show 4 items only (since space on dashboard is limited)
|
||||||
},
|
},
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var hosts = json.listhostsresponse.host ?
|
var hosts = json.listhostsresponse.host ?
|
||||||
@ -213,7 +255,7 @@
|
|||||||
fetchLatest: false,
|
fetchLatest: false,
|
||||||
sortBy: 'usage',
|
sortBy: 'usage',
|
||||||
page: 0,
|
page: 0,
|
||||||
pagesize: 8
|
pageSize: (pageSize > 8? 8: pageSize)
|
||||||
},
|
},
|
||||||
success: function(json) {
|
success: function(json) {
|
||||||
var capacities = json.listcapacityresponse.capacity ?
|
var capacities = json.listcapacityresponse.capacity ?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user