Browse Source

Display more detail on CPU / Cores on Host pages. (xiwang via yusaku)

Yusaku Sako 11 năm trước cách đây
mục cha
commit
2e9a93faed

+ 1 - 1
ambari-web/app/controllers/global/cluster_controller.js

@@ -326,7 +326,7 @@ App.ClusterController = Em.Controller.extend({
       return;
     }
     var clusterUrl = this.getUrl('/data/clusters/cluster.json', '?fields=Clusters');
-    var hostsRealUrl = '/hosts?fields=Hosts/host_name,Hosts/public_host_name,Hosts/cpu_count,Hosts/total_mem,' +
+    var hostsRealUrl = '/hosts?fields=Hosts/host_name,Hosts/public_host_name,Hosts/cpu_count,Hosts/ph_cpu_count,Hosts/total_mem,' +
       'Hosts/host_status,Hosts/last_heartbeat_time,Hosts/os_arch,Hosts/os_type,Hosts/ip,host_components,Hosts/disk_info,' +
       'metrics/disk,metrics/load/load_one,metrics/cpu/cpu_system,metrics/cpu/cpu_user,metrics/memory/mem_total,metrics/memory/mem_free'+
       '&minimal_response=true';

+ 3 - 0
ambari-web/app/mappers/hosts_mapper.js

@@ -39,6 +39,7 @@ App.hostsMapper = App.QuickDataMapper.create({
       item: 'id'
     },
     cpu: 'Hosts.cpu_count',
+    cpu_physical: 'Hosts.ph_cpu_count',
     memory: 'Hosts.total_mem',
     disk_info: 'Hosts.disk_info',
     disk_total: 'metrics.disk.disk_total',
@@ -109,6 +110,7 @@ App.hostsMapper = App.QuickDataMapper.create({
               public_host_name: host.public_host_name,
               memory: host.memory,
               cpu: host.cpu,
+              cpu_physical: host.cpu_physical,
               host_components: host.host_components
             };
           });
@@ -125,6 +127,7 @@ App.hostsMapper = App.QuickDataMapper.create({
               host.public_host_name = cacheHost.public_host_name;
               host.memory = cacheHost.memory;
               host.cpu = cacheHost.cpu;
+              host.cpu_physical = cacheHost.cpu_physical;
               host.host_components = cacheHost.host_components;
             }
           });

+ 1 - 0
ambari-web/app/messages.js

@@ -90,6 +90,7 @@ Em.I18n.translations = {
   'common.value':'Value',
   'common.ipAddress':'IP Address',
   'common.cpu':'CPU',
+  'common.cores': 'Cores (CPU)',
   'common.ram':'RAM',
   'common.disk':'Disk',
   'common.diskUsage':'Disk Usage',

+ 5 - 0
ambari-web/app/models/host.js

@@ -26,6 +26,7 @@ App.Host = DS.Model.extend({
   cluster: DS.belongsTo('App.Cluster'),
   hostComponents: DS.hasMany('App.HostComponent'),
   cpu: DS.attr('string'),
+  cpuPhysical: DS.attr('string'),
   memory: DS.attr('string'),
   diskTotal: DS.attr('number'),
   diskFree: DS.attr('number'),
@@ -107,6 +108,10 @@ App.Host = DS.Model.extend({
     return this.get('diskInfo.length');
   }.property('diskInfo.length'),
 
+  coresFormatted: function() {
+    return this.get('cpu') + ' (' + this.get('cpuPhysical') + ')';
+  }.property('cpu', 'cpuPhysical'),
+
   /**
    * API return diskTotal and diskFree. Need to save their different
    * @returns {Number}

+ 1 - 1
ambari-web/app/templates/main/host.hbs

@@ -118,7 +118,7 @@
             {{/if}}
           </td>
           <td>{{host.ip}}</td>
-          <td>{{host.cpu}}</td>
+          <td>{{host.coresFormatted}}</td>
           <td>{{host.memoryFormatted}}</td>
 
           <td>

+ 1 - 1
ambari-web/app/templates/main/host/summary.hbs

@@ -207,7 +207,7 @@
                         <dt>{{t hosts.host.summary.hostname}}:</dt><dd>&nbsp;{{view.content.publicHostName}}</dd>
                         <dt>{{t common.ipAddress}}:</dt><dd>&nbsp;{{view.content.ip}}</dd>
                         <dt>{{t common.os}}:</dt><dd>&nbsp;{{view.content.osType}}&nbsp;({{view.content.osArch}})</dd>
-                        <dt>{{t common.cpu}}:</dt><dd>&nbsp;{{view.content.cpu}}</dd>
+                        <dt>{{t common.cores}}:</dt><dd>&nbsp;{{view.content.coresFormatted}}</dd>
                         <dt>{{t common.disk}}:</dt><dd>&nbsp;{{view.content.diskInfoBar}}</dd>
                         <dt>{{t common.memory}}:</dt><dd>&nbsp;{{view.content.memoryFormatted}}</dd>
                         <dt>{{t common.loadAvg}}:</dt><dd>&nbsp;{{view.content.loadAvg}}</dd>

+ 1 - 1
ambari-web/app/views/main/host.js

@@ -62,7 +62,7 @@ App.MainHostView = App.TableView.extend({
   cpuSort: sort.fieldView.extend({
     column: 3,
     name:'cpu',
-    displayName: Em.I18n.t('common.cpu'),
+    displayName: Em.I18n.t('common.cores'),
     type: 'number'
   }),
   memorySort: sort.fieldView.extend({