cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject git commit: refs/heads/master - CLOUDSTACK-1044: Fix duplicate listCapacity call on dashboard
Date Fri, 15 Mar 2013 17:49:04 GMT
Updated Branches:
  refs/heads/master e74dd13f7 -> 42d33fc3f


CLOUDSTACK-1044: Fix duplicate listCapacity call on dashboard


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/42d33fc3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/42d33fc3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/42d33fc3

Branch: refs/heads/master
Commit: 42d33fc3ffe3821eea2b23c0db605ca201e2b7ee
Parents: e74dd13
Author: Brian Federle <brian.federle@citrix.com>
Authored: Thu Mar 14 16:20:53 2013 -0700
Committer: Brian Federle <brian.federle@citrix.com>
Committed: Fri Mar 15 10:48:49 2013 -0700

----------------------------------------------------------------------
 ui/scripts/dashboard.js |   71 +++++++----------------------------------
 1 files changed, 12 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/42d33fc3/ui/scripts/dashboard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/dashboard.js b/ui/scripts/dashboard.js
index 88c3cd1..845ae52 100644
--- a/ui/scripts/dashboard.js
+++ b/ui/scripts/dashboard.js
@@ -91,7 +91,7 @@
                 var netTotal = json.listnetworksresponse.count ?
                   json.listnetworksresponse.count : 0;
 
-                 $.ajax({
+                $.ajax({
                   url: createURL('listPublicIpAddresses'),
                   success: function(json) {
                     var ipTotal = json.listpublicipaddressesresponse.count ?
@@ -102,7 +102,7 @@
                       ipTotal: ipTotal
                     }));
                   }
-                });                
+                });
               }
             });
           }
@@ -128,7 +128,7 @@
           }
         }
       },
-      
+
       dataProvider: function(args) {
         var dataFns = {
           zones: function(data) {
@@ -142,71 +142,24 @@
             });
           },
           capacity: function(data) {
-           var latestData =null;
-           if(window.fetchLatestflag == 1)
-           {
+            var latestData =null;
+            if(window.fetchLatestflag == 1)
+            {
               latestData = {
 
-                  fetchLatest:true
-                 }
+                fetchLatest:true
+              }
             }
-           else
+            else
             {
               latestData = {
                 fetchLatest:false
-               }         
+              }
             }
-	    window.fetchLatestflag = 0;          
-            if (data.zones) {
-              $.ajax({
-                url: createURL('listCapacity'),
-                data: latestData,
-                success: function(json) {
-                  var capacities = json.listcapacityresponse.capacity;
 
-                  var capacity = function(id, converter) {
-                    var result = $.grep(capacities, function(capacity) {
-                      return capacity.type == id;
-                    });
-                    return result[0] ? result[0] : {
-                      capacityused: 0,
-                      capacitytotal: 0,
-                      percentused: 0
-                    };
-                  };
+            window.fetchLatestflag = 0;
 
-                  dataFns.alerts($.extend(data, {
-                    publicIPAllocated: capacity(8).capacityused,
-                    publicIPTotal: capacity(8).capacitytotal,
-                    publicIPPercentage: parseInt(capacity(8).percentused),
-                    privateIPAllocated: capacity(5).capacityused,
-                    privateIPTotal: capacity(5).capacitytotal,
-                    privateIPPercentage: parseInt(capacity(8).percentused),
-                    memoryAllocated: cloudStack.converters.convertBytes(capacity(0).capacityused),
-                    memoryTotal: cloudStack.converters.convertBytes(capacity(0).capacitytotal),
-                    memoryPercentage: parseInt(capacity(0).percentused),
-                    cpuAllocated: cloudStack.converters.convertHz(capacity(1).capacityused),
-                    cpuTotal: cloudStack.converters.convertHz(capacity(1).capacitytotal),
-                    cpuPercentage: parseInt(capacity(1).percentused)
-                  }));
-                }
-              });
-            } else {
-              dataFns.alerts($.extend(data, {
-                publicIPAllocated: 0,
-                publicIPTotal: 0,
-                publicIPPercentage: 0,
-                privateIPAllocated: 0,
-                privateIPTotal: 0,
-                privateIPPercentage: 0,
-                memoryAllocated: 0,
-                memoryTotal: 0,
-                memoryPercentage: 0,
-                cpuAllocated: 0,
-                cpuTotal: 0,
-                cpuPercentage: 0
-              }));
-            }
+            dataFns.alerts(data);
           },
 
           alerts: function(data) {


Mime
View raw message