Skip to content

Commit 9e070e4

Browse files
author
Jessica Wang
committed
cloudStack 3.0 new UI - domain page - add Instance Total field, Volume Total field.
1 parent a76711b commit 9e070e4

1 file changed

Lines changed: 39 additions & 9 deletions

File tree

ui/scripts/domains.js

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@
141141
{
142142
id: { label: 'ID' },
143143
accountTotal: { label: 'Accounts' },
144-
instances: { label: 'Instances' },
145-
volumes: { label: 'Volumes' }
144+
vmTotal: { label: 'Instances' },
145+
volumeTotal: { label: 'Volumes' }
146146
}
147147
],
148148
dataProvider: function(args) {
@@ -152,16 +152,46 @@
152152
async: false,
153153
dataType: "json",
154154
success: function(json) {
155-
var accounts = json.listaccountsresponse.account;
156-
var accountTotal;
157-
if (accounts != null)
158-
accountTotal = accounts.length;
155+
var items = json.listaccountsresponse.account;
156+
var total;
157+
if (items != null)
158+
total = items.length;
159159
else
160-
accountTotal = 0;
161-
domainObj["accountTotal"] = accountTotal;
160+
total = 0;
161+
domainObj["accountTotal"] = total;
162162
}
163163
});
164-
164+
165+
$.ajax({
166+
url: createURL("listVirtualMachines&domainid=" + domainObj.id),
167+
async: false,
168+
dataType: "json",
169+
success: function(json) {
170+
var items = json.listvirtualmachinesresponse.virtualmachine;
171+
var total;
172+
if (items != null)
173+
total = items.length;
174+
else
175+
total = 0;
176+
domainObj["vmTotal"] = total;
177+
}
178+
});
179+
180+
$.ajax({
181+
url: createURL("listVolumes&domainid=" + domainObj.id),
182+
async: false,
183+
dataType: "json",
184+
success: function(json) {
185+
var items = json.listvolumesresponse.volume;
186+
var total;
187+
if (items != null)
188+
total = items.length;
189+
else
190+
total = 0;
191+
domainObj["volumeTotal"] = total;
192+
}
193+
});
194+
165195
args.response.success({
166196
data: domainObj
167197
});

0 commit comments

Comments
 (0)