Skip to content

Commit f883b0f

Browse files
author
Jessica Wang
committed
CLOUDSTACK-2120: mixed zone management - UI: count total number of Primary Storages, Secondary Storages based on selected option in zone type dropdown on top menu.
1 parent 880f98c commit f883b0f

1 file changed

Lines changed: 23 additions & 12 deletions

File tree

ui/scripts/system.js

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -269,29 +269,40 @@
269269
},
270270

271271
primaryStorageCount: function(data) {
272+
var data2 = {
273+
page: 1,
274+
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.
275+
};
276+
if(cloudStack.context.zoneType != null && cloudStack.context.zoneType.length > 0) { //Basic type or Advanced type
277+
$.extend(data2, {
278+
zonetype: cloudStack.context.zoneType
279+
});
280+
}
272281
$.ajax({
273282
url: createURL('listStoragePools'),
274-
data: {
275-
page: 1,
276-
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.
277-
},
283+
data: data2,
278284
success: function(json) {
279-
dataFns.secondaryStorageCount($.extend(data, {
280-
primaryStorageCount: json.liststoragepoolsresponse.count ?
281-
json.liststoragepoolsresponse.count : 0
285+
dataFns.secondaryStorageCount($.extend(data, {
286+
primaryStorageCount: json.liststoragepoolsresponse.count ? json.liststoragepoolsresponse.count : 0
282287
}));
283288
}
284289
});
285290
},
286291

287292
secondaryStorageCount: function(data) {
293+
var data2 = {
294+
type: 'SecondaryStorage',
295+
page: 1,
296+
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.
297+
};
298+
if(cloudStack.context.zoneType != null && cloudStack.context.zoneType.length > 0) { //Basic type or Advanced type
299+
$.extend(data2, {
300+
zonetype: cloudStack.context.zoneType
301+
});
302+
}
288303
$.ajax({
289304
url: createURL('listHosts'),
290-
data: {
291-
type: 'SecondaryStorage',
292-
page: 1,
293-
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.
294-
},
305+
data: data2,
295306
success: function(json) {
296307
dataFns.systemVmCount($.extend(data, {
297308
secondaryStorageCount: json.listhostsresponse.count ?

0 commit comments

Comments
 (0)