You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/07/04 02:57:40 UTC
[07/10] git commit: updated refs/heads/vmsync to 3ecc52a
CLOUDSTACK-3207: UI > domain page > get total number of instances, volumes by both listAccounts API and listProjects API.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/1bd74420
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1bd74420
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1bd74420
Branch: refs/heads/vmsync
Commit: 1bd74420cca0b61dca804bf8b1702373de9bc49d
Parents: b59b1b4
Author: Jessica Wang <je...@apache.org>
Authored: Wed Jul 3 15:22:19 2013 -0700
Committer: Jessica Wang <je...@apache.org>
Committed: Wed Jul 3 15:24:52 2013 -0700
----------------------------------------------------------------------
ui/scripts/domains.js | 48 ++++++++++++++++++++++++++++++----------------
1 file changed, 32 insertions(+), 16 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/1bd74420/ui/scripts/domains.js
----------------------------------------------------------------------
diff --git a/ui/scripts/domains.js b/ui/scripts/domains.js
index e82f8ff..01f4236 100644
--- a/ui/scripts/domains.js
+++ b/ui/scripts/domains.js
@@ -435,6 +435,9 @@
],
dataProvider: function(args) {
var domainObj = args.context.domains[0];
+ var totalVMs=0;
+ var totalVolumes=0;
+
$.ajax({
url: createURL("listAccounts&domainid=" + domainObj.id),
async: false,
@@ -443,26 +446,39 @@
},
success: function(json) {
var items = json.listaccountsresponse.account;
- var total;
- if (items != null)
- total = items.length;
- else
- total = 0;
- domainObj["accountTotal"] = total;
- var itemsAcc;
- var totalVMs=0;
- var totalVolumes=0;
- for(var i=0;i<total;i++) {
- itemsAcc = json.listaccountsresponse.account[i];
- totalVMs = totalVMs + itemsAcc.vmtotal;
- totalVolumes = totalVolumes + itemsAcc.volumetotal;
+ if(items != null) {
+ domainObj["accountTotal"] = items.length;
+ for(var i = 0; i < items.length; i++) {
+ totalVMs += items[i].vmtotal;
+ totalVolumes += items[i].volumetotal;
+ }
}
- domainObj["vmTotal"] = totalVMs;
- domainObj["volumeTotal"] = totalVolumes;
-
+ else {
+ domainObj["accountTotal"] = 0;
+ }
}
});
+ $.ajax({
+ url: createURL("listProjects&domainid=" + domainObj.id),
+ async: false,
+ data: {
+ details: 'min'
+ },
+ success: function(json) {
+ var items = json.listprojectsresponse.project;
+ if(items != null) {
+ for(var i = 0; i < items.length; i++) {
+ totalVMs += items[i].vmtotal;
+ totalVolumes += items[i].volumetotal;
+ }
+ }
+ }
+ });
+
+ domainObj["vmTotal"] = totalVMs;
+ domainObj["volumeTotal"] = totalVolumes;
+
/* $.ajax({
url: createURL("listVirtualMachines&details=min&domainid=" + domainObj.id),
async: false,