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-6-17-stable to e80e3e8
Date Wed, 03 Jul 2013 22:25:45 GMT
Updated Branches:
  refs/heads/master-6-17-stable 5ca08ff9e -> e80e3e84f


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/e80e3e84
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/e80e3e84
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/e80e3e84

Branch: refs/heads/master-6-17-stable
Commit: e80e3e84f2521a7d4f39fc97187ac54e9dfd9298
Parents: 5ca08ff
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:25:34 2013 -0700

----------------------------------------------------------------------
 ui/scripts/domains.js | 48 ++++++++++++++++++++++++++++++----------------
 1 file changed, 32 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e80e3e84/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