This is an automated email from the ASF dual-hosted git repository.

ishanbha pushed a commit to branch branch-feature-AMBARI-14714
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-feature-AMBARI-14714 by 
this push:
     new 6342b70  [AMBARI-24417] HDFS Service page Datanode does not show 
count. (#1991)
6342b70 is described below

commit 6342b700af7df22a849dac1e6a1f91a1889a2f02
Author: Ishan Bhatt <[email protected]>
AuthorDate: Wed Aug 15 10:40:46 2018 -0700

    [AMBARI-24417] HDFS Service page Datanode does not show count. (#1991)
    
    * [AMBARI-24417] HDFS Service page Datanode does not show count.
    
    * Changed check condition
---
 ambari-web/app/controllers/global/update_controller.js |  1 +
 .../main/service/info/summary/hdfs/slaves.hbs          |  2 +-
 .../app/views/main/service/info/summary/hdfs/slaves.js | 18 ++++++++++++++++++
 .../test/controllers/global/update_controller_test.js  |  2 +-
 4 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/ambari-web/app/controllers/global/update_controller.js 
b/ambari-web/app/controllers/global/update_controller.js
index c7a3e47..d20664f 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -196,6 +196,7 @@ App.UpdateController = Em.Controller.extend({
     if (this.get('isWorking') && !App.get('isOnlyViewUser')) {
       App.updater.run(this, 'updateHostsMetrics', 'isWorking', 
App.contentUpdateInterval, '\/main\/(hosts).*');
       App.updater.run(this, 'updateServiceMetric', 'isWorking', 
App.componentsUpdateInterval, '\/main\/(dashboard|services).*');
+      App.updater.run(this, 'updateComponentsState', 'isWorking', 
App.componentsUpdateInterval);
       App.updater.run(this, 'graphsUpdate', 'isWorking');
 
       if (!App.get('router.mainAlertInstancesController.isUpdating')) {
diff --git a/ambari-web/app/templates/main/service/info/summary/hdfs/slaves.hbs 
b/ambari-web/app/templates/main/service/info/summary/hdfs/slaves.hbs
index 7ac47f2..37a6b1f 100644
--- a/ambari-web/app/templates/main/service/info/summary/hdfs/slaves.hbs
+++ b/ambari-web/app/templates/main/service/info/summary/hdfs/slaves.hbs
@@ -29,7 +29,7 @@
         <div class="summary-value main-info">
           {{#if App.router.clusterController.isServiceContentFullyLoaded}}
             <span>
-              {{#view App.ComponentLiveTextView 
liveComponentsBinding="view.service.dataNodesStarted" 
totalComponentsBinding="view.service.dataNodesTotal"}}
+              {{#view App.ComponentLiveTextView 
liveComponentsBinding="view.dataNodesStarted" 
totalComponentsBinding="view.dataNodesTotal"}}
                 {{view.liveComponents}}/{{view.totalComponents}}
               {{/view}}
             </span>
diff --git a/ambari-web/app/views/main/service/info/summary/hdfs/slaves.js 
b/ambari-web/app/views/main/service/info/summary/hdfs/slaves.js
index 176a624..c13648a 100644
--- a/ambari-web/app/views/main/service/info/summary/hdfs/slaves.js
+++ b/ambari-web/app/views/main/service/info/summary/hdfs/slaves.js
@@ -52,6 +52,24 @@ App.HDFSSlaveComponentsView = Em.View.extend({
 
   journalNodesTotal: Em.computed.alias('service.journalNodes.length'),
 
+  dataNodesStarted: function () {
+    var startedNum = this.get('service.dataNodesStarted');
+    if (!startedNum) {
+      let dataNodeComponent = 
App.SlaveComponent.find().findProperty('componentName', 'DATANODE');
+      startedNum = dataNodeComponent ? dataNodeComponent.get('startedCount') : 
0;
+    }
+    return startedNum;
+  }.property('service.dataNodesStarted'),
+
+  dataNodesTotal: function () {
+    var totalNum = this.get('service.dataNodesTotal');
+    if (!totalNum) {
+      let dataNodeComponent = 
App.SlaveComponent.find().findProperty('componentName', 'DATANODE');
+      totalNum = dataNodeComponent ? dataNodeComponent.get('totalCount') : 0;
+    }
+    return totalNum;
+  }.property('service.dataNodesTotal'),
+
   /**
    * Define if NFS_GATEWAY is present in the installed stack
    * @type {Boolean}
diff --git a/ambari-web/test/controllers/global/update_controller_test.js 
b/ambari-web/test/controllers/global/update_controller_test.js
index 18abd53..cb6c881 100644
--- a/ambari-web/test/controllers/global/update_controller_test.js
+++ b/ambari-web/test/controllers/global/update_controller_test.js
@@ -65,7 +65,7 @@ describe('App.UpdateController', function () {
 
     it('isWorking = true', function () {
       controller.set('isWorking', true);
-      expect(App.updater.run.callCount).to.equal(6);
+      expect(App.updater.run.callCount).to.equal(7);
     });
   });
 

Reply via email to