Browse Source

AMBARI-6273. Manage Config Groups: if Ganglia is not installed config group popup doesn't appear (Buzhor Denys via alexantonenko)

Alex Antonenko 11 years ago
parent
commit
4173376b93

+ 14 - 3
ambari-web/app/controllers/main/service/manage_config_groups_controller.js

@@ -19,6 +19,7 @@
 
 var App = require('app');
 var hostsManagement = require('utils/hosts');
+var numberUtils = require('utils/number_utils');
 
 App.ManageConfigGroupsController = Em.Controller.extend({
   name: 'manageConfigGroupsController',
@@ -85,7 +86,17 @@ App.ManageConfigGroupsController = Em.Controller.extend({
 
     data.items.forEach(function (host) {
       var hostComponents = [];
-
+      var diskInfo = host.Hosts.disk_info.filter(function(item) {
+        return /^ext|^ntfs|^fat|^xfs/i.test(item.type);
+      });
+      if (diskInfo.length) {
+        diskInfo = diskInfo.reduce(function(a, b) {
+          return {
+            available: parseInt(a.available) + parseInt(b.available),
+            size: parseInt(a.size) + parseInt(b.size)
+          };
+        });
+      }
       host.host_components.forEach(function (hostComponent) {
         hostComponents.push(Em.Object.create({
           componentName: hostComponent.HostRoles.component_name,
@@ -101,8 +112,8 @@ App.ManageConfigGroupsController = Em.Controller.extend({
           publicHostName: host.Hosts.public_host_name,
           cpu: host.Hosts.cpu_count,
           memory: host.Hosts.total_mem,
-          diskTotal: host.metrics.disk.disk_total,
-          diskFree: host.metrics.disk.disk_free,
+          diskTotal: numberUtils.bytesToSize(diskInfo.size, 0, undefined, 1024),
+          diskFree: numberUtils.bytesToSize(diskInfo.available, 0, undefined, 1024),
           disksMounted: host.Hosts.disk_info.length,
           hostComponents: hostComponents
         }

+ 1 - 1
ambari-web/app/utils/ajax/ajax.js

@@ -2153,7 +2153,7 @@ var urls = {
     }
   },
   'hosts.config_groups': {
-    'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/ip,Hosts/os_type,Hosts/os_arch,Hosts/public_host_name,metrics/disk,host_components&minimal_response=true',
+    'real': '/clusters/{clusterName}/hosts?fields=Hosts/cpu_count,Hosts/disk_info,Hosts/total_mem,Hosts/ip,Hosts/os_type,Hosts/os_arch,Hosts/public_host_name,host_components&minimal_response=true',
     'mock': ''
   },
   'cluster.fields': {