Updated Branches:
  refs/heads/master c350999c9 -> 57678257a

CLOUDSTACK-4908: UI > Infrastructure > Sockets > view all > calculate Hosts for 
each hypervisor.


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

Branch: refs/heads/master
Commit: 57678257a123da1f74fa2a81407beb94450444b3
Parents: c350999
Author: Jessica Wang <[email protected]>
Authored: Mon Nov 4 16:25:24 2013 -0800
Committer: Jessica Wang <[email protected]>
Committed: Mon Nov 4 16:25:24 2013 -0800

----------------------------------------------------------------------
 ui/scripts/system.js | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57678257/ui/scripts/system.js
----------------------------------------------------------------------
diff --git a/ui/scripts/system.js b/ui/scripts/system.js
index 1595948..381d884 100644
--- a/ui/scripts/system.js
+++ b/ui/scripts/system.js
@@ -7125,20 +7125,32 @@
                             var listView = {
                                 id: 'sockets',
                                 fields: {
-                                    hypervisor: { label: 'label.hypervisor' },
-                                    sockets: { label: 'label.sockets' },
-                                    hosts: { label: 'label.hosts' }
+                                    hypervisor: { label: 'label.hypervisor' }, 
                                   
+                                    hosts: { label: 'label.hosts' },
+                                    sockets: { label: 'label.sockets' }
                                 },
                                 dataProvider: function(args) {
                                     $.ajax({
                                         url: createURL('listHypervisors'),
                                         success: function(json) {
                                             args.response.success({
-                                                data: 
$(json.listhypervisorsresponse.hypervisor).map(function(index, hypervisor) {
+                                                data: 
$(json.listhypervisorsresponse.hypervisor).map(function(index, hypervisor) {    
                                                 
+                                                       var hostCount;
+                                                       $.ajax({
+                                                               url: 
createURL('listHosts'),
+                                                               async: false,
+                                                               data: {
+                                                                       
hypervisortype: hypervisor.name
+                                                               },
+                                                               success: 
function(json) {                                                                
       
+                                                                       
hostCount = json.listhostsresponse.count;
+                                                               }
+                                                       });                     
                                                                                
+                                                       
                                                     return {
                                                         hypervisor: 
hypervisor.name,
-                                                        sockets: 0,
-                                                        hosts: 0
+                                                        hosts: hostCount,
+                                                        sockets: 0             
                                           
                                                     };
                                                 })
                                             });

Reply via email to