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 1fae6cf  AMBARI-24905 Service display name on left navigation bar 
should be suffixed with "Client" if only client service component is present 
for a service
1fae6cf is described below

commit 1fae6cf19dfc4f1bfb428eb34480e7382c460db8
Author: Andrii Tkach <atk...@apache.org>
AuthorDate: Thu Nov 15 14:16:47 2018 +0200

    AMBARI-24905 Service display name on left navigation bar should be suffixed 
with "Client" if only client service component is present for a service
---
 ambari-web/app/models/service.js                    | 10 ++++++++++
 ambari-web/app/templates/main/service/menu_item.hbs |  2 +-
 ambari-web/app/views/main/menu.js                   |  8 ++++++++
 ambari-web/app/views/main/service/info/menu.js      |  4 ++--
 ambari-web/app/views/main/service/item.js           |  8 +-------
 5 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/ambari-web/app/models/service.js b/ambari-web/app/models/service.js
index 994f9ce..47eb606 100644
--- a/ambari-web/app/models/service.js
+++ b/ambari-web/app/models/service.js
@@ -64,6 +64,16 @@ App.Service = DS.Model.extend({
    * @type {bool}
    */
   isInPassive: Em.computed.equal('passiveState', 'ON'),
+  
+  /**
+   * @type {bool}
+   */
+  hasMasterOrSlaveComponent: function() {
+    return this.get('slaveComponents').toArray()
+    .concat(this.get('masterComponents').toArray())
+    .mapProperty('totalCount')
+    .reduce((a, b) => a + b, 0) > 0;
+  }.property('slaveComponents.@each.totalCount', 
'masterComponents.@each.totalCount'),
 
   serviceComponents: function() {
     var clientComponents = 
this.get('clientComponents').mapProperty('componentName');
diff --git a/ambari-web/app/templates/main/service/menu_item.hbs 
b/ambari-web/app/templates/main/service/menu_item.hbs
index 8fb389d..9ac8d76 100644
--- a/ambari-web/app/templates/main/service/menu_item.hbs
+++ b/ambari-web/app/templates/main/service/menu_item.hbs
@@ -33,6 +33,6 @@
     <i {{bindAttr class="view.content.isStarted:started:stopped :icon-circle 
:status-icon"}}></i>
   {{/unless}}
   <span {{bindAttr class="view.isClientOnlyService:client-only-service 
:menu-item-name view.content.workStatus view.isMasterDown:master-down" 
data-original-title="view.content.toolTipContent"}} rel="serviceHealthTooltip">
-      {{unbound view.content.displayName}}
+      {{unbound view.displayName}}
   </span>
 </a>
diff --git a/ambari-web/app/views/main/menu.js 
b/ambari-web/app/views/main/menu.js
index 9de9df8..cf8085b 100644
--- a/ambari-web/app/views/main/menu.js
+++ b/ambari-web/app/views/main/menu.js
@@ -221,6 +221,14 @@ App.SideNavServiceMenuView = Em.CollectionView.extend({
     isClientOnlyService : function(){
       return 
App.get('services.clientOnly').contains(this.get('content.serviceName'));
     }.property('content.serviceName'),
+    
+    displayName: function() {
+      if (this.get('content.hasMasterOrSlaveComponent') || 
this.get('content.displayName').endsWith('Client')) {
+        return this.get('content.displayName');
+      } else {
+        return this.get('content.displayName') + ' Client';
+      }
+    }.property('content.displayName', 'content.hasMasterOrSlaveComponent'),
 
     isConfigurable: function () {
       return 
!App.get('services.noConfigTypes').contains(this.get('content.serviceName'));
diff --git a/ambari-web/app/views/main/service/info/menu.js 
b/ambari-web/app/views/main/service/info/menu.js
index 89d5401..1d36a60 100644
--- a/ambari-web/app/views/main/service/info/menu.js
+++ b/ambari-web/app/views/main/service/info/menu.js
@@ -53,7 +53,7 @@ App.MainServiceInfoMenuView = Em.CollectionView.extend({
       });
     }
     return menuItems;
-  }.property(),
+  }.property('heatmapTab', 'configTab', 'metricTab'),
 
   init: function () {
     this._super();
@@ -64,7 +64,7 @@ App.MainServiceInfoMenuView = Em.CollectionView.extend({
     this.get('_childViews').forEach(function(view) {
       view.set('active', (document.URL.endsWith(view.get('content.routing')) ? 
"active" : ""));
     }, this);
-  }.observes('App.router.location.lastSetURL'),
+  }.observes('App.router.location.lastSetURL', 'heatmapTab', 'configTab', 
'metricTab'),
 
   deactivateChildViews: function () {
     this.get('_childViews').setEach('active', '');
diff --git a/ambari-web/app/views/main/service/item.js 
b/ambari-web/app/views/main/service/item.js
index b92b7aa..0186b86 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -383,13 +383,7 @@ App.MainServiceItemView = 
Em.View.extend(App.HiveInteractiveCheck, {
     return App.havePermissions('CLUSTER.VIEW_CONFIGS') && 
!App.get('services.noConfigTypes').contains(this.get('controller.content.serviceName'));
   }.property('controller.content.serviceName','App.services.noConfigTypes'),
   
-  hasMasterOrSlaveComponent: function() {
-    return App.SlaveComponent.find().toArray()
-    .concat(App.MasterComponent.find().toArray())
-    .filterProperty('service.serviceName', 
this.get('controller.content.serviceName'))
-    .mapProperty('totalCount')
-    .reduce((a, b) => a + b, 0) > 0;
-  }.property('controller.content.serviceName'),
+  hasMasterOrSlaveComponent: 
Em.computed.alias('controller.content.hasMasterOrSlaveComponent'),
 
   hasHeatmapTab: function() {
     return 
App.StackService.find(this.get('controller.content.serviceName')).get('hasHeatmapSection')

Reply via email to