You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2018/11/26 17:01:07 UTC

[ambari] branch trunk updated: AMBARI-24954 Counter installedClients for AMBARI_INFRA_SOLR is null

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

atkach pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/trunk by this push:
     new d10ef61  AMBARI-24954 Counter installedClients for AMBARI_INFRA_SOLR is null
d10ef61 is described below

commit d10ef61fbda48b63fff724f93645f082b37af0af
Author: Andrii Tkach <at...@apache.org>
AuthorDate: Mon Nov 26 18:03:53 2018 +0200

    AMBARI-24954 Counter installedClients for AMBARI_INFRA_SOLR is null
---
 ambari-web/app/mappers/components_state_mapper.js  | 35 ++++------------------
 .../test/mappers/components_state_mapper_test.js   | 14 +++++++++
 2 files changed, 19 insertions(+), 30 deletions(-)

diff --git a/ambari-web/app/mappers/components_state_mapper.js b/ambari-web/app/mappers/components_state_mapper.js
index db7a7f3..6bce663 100644
--- a/ambari-web/app/mappers/components_state_mapper.js
+++ b/ambari-web/app/mappers/components_state_mapper.js
@@ -105,33 +105,6 @@ App.componentsStateMapper = App.QuickDataMapper.create({
     'MAPREDUCE2_CLIENT': {
       map_reduce2_clients: 'INSTALLED_PATH'
     },
-    'TEZ_CLIENT': {
-      installed_clients: 'INSTALLED_PATH'
-    },
-    'HIVE_CLIENT': {
-      installed_clients: 'INSTALLED_PATH'
-    },
-    'FALCON_CLIENT': {
-      installed_clients: 'INSTALLED_PATH'
-    },
-    'OOZIE_CLIENT': {
-      installed_clients: 'INSTALLED_PATH'
-    },
-    'ZOOKEEPER_CLIENT': {
-      installed_clients: 'INSTALLED_PATH'
-    },
-    'PIG': {
-      installed_clients: 'INSTALLED_PATH'
-    },
-    'SQOOP': {
-      installed_clients: 'INSTALLED_PATH'
-    },
-    'YARN_CLIENT': {
-      installed_clients: 'INSTALLED_PATH'
-    },
-    'HDFS_CLIENT': {
-      installed_clients: 'INSTALLED_PATH'
-    },
     'FLUME_HANDLER': {
       flume_handlers_total: 'TOTAL_PATH'
     }
@@ -142,9 +115,11 @@ App.componentsStateMapper = App.QuickDataMapper.create({
    * @return {Object}
    */
   getComponentConfig: function (componentName) {
-    var config = {};
-    var componentConfig = this.get('configMap')[componentName];
-    var paths = this.get('paths');
+    const config = {};
+    const isClient = App.StackServiceComponent.find(componentName).get('isClient');
+    const defaultValue = isClient ? { installed_clients: 'TOTAL_PATH' } : {};
+    const componentConfig = Em.getWithDefault(this.get('configMap'), componentName, defaultValue);
+    const paths = this.get('paths');
 
     for (var property in componentConfig) {
       if (paths[componentConfig[property]]) {
diff --git a/ambari-web/test/mappers/components_state_mapper_test.js b/ambari-web/test/mappers/components_state_mapper_test.js
index 58c5737..abcd456 100644
--- a/ambari-web/test/mappers/components_state_mapper_test.js
+++ b/ambari-web/test/mappers/components_state_mapper_test.js
@@ -22,6 +22,15 @@ require('mappers/components_state_mapper');
 describe('App.componentsStateMapper', function () {
 
   describe('#getComponentConfig', function() {
+    
+    beforeEach(function() {
+      sinon.stub(App.StackServiceComponent, 'find').returns(Em.Object.create({
+        isClient: true
+      }));
+    });
+    afterEach(function() {
+      App.StackServiceComponent.find.restore();
+    });
     it('should paths to component properties', function() {
       expect(App.componentsStateMapper.getComponentConfig('DATANODE')).to.be.eql({
         "data_nodes_installed": "ServiceComponentInfo.installed_count",
@@ -29,6 +38,11 @@ describe('App.componentsStateMapper', function () {
         "data_nodes_total": "ServiceComponentInfo.total_count"
       });
     });
+    it('Client paths', function() {
+      expect(App.componentsStateMapper.getComponentConfig('HDFS_CLIENT')).to.be.eql({
+        "installed_clients": "ServiceComponentInfo.total_count"
+      });
+    });
   });
 
   describe('#getExtendedModel', function() {