cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jessicaw...@apache.org
Subject git commit: updated refs/heads/master to 1bd7442
Date Wed, 03 Jul 2013 22:25:01 GMT
Updated Branches:
  refs/heads/master b59b1b4c9 -> 1bd74420c


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/master
Commit: 1bd74420cca0b61dca804bf8b1702373de9bc49d
Parents: b59b1b4
Author: Jessica Wang <jessicawang@apache.org>
Authored: Wed Jul 3 15:22:19 2013 -0700
Committer: Jessica Wang <jessicawang@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,


Mime
View raw message