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

commit 72213a6452550921485e26f2e64230ad26cf8a16
Author: Andrii Tkach <atk...@apache.org>
AuthorDate: Fri Nov 16 15:27:27 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                   | 22 +++++++++++++++++-----
 .../app/templates/main/service/menu_item.hbs       |  2 +-
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/ambari-web/app/models/service.js b/ambari-web/app/models/service.js
index 47eb606..a0158c8 100644
--- a/ambari-web/app/models/service.js
+++ b/ambari-web/app/models/service.js
@@ -22,7 +22,14 @@ require('utils/config');
 
 App.Service = DS.Model.extend({
   serviceName: DS.attr('string', {defaultValue: ''}),
-  displayName: Em.computed.formatRole('serviceName', true),
+  displayName: function() {
+    const displayName = App.format.role(this.get('serviceName'), true);
+    if (this.get('hasMasterOrSlaveComponent') || 
displayName.endsWith('Client')) {
+      return displayName;
+    } else {
+      return displayName + ' Client';
+    }
+  }.property('serviceName'),
   passiveState: DS.attr('string', {defaultValue: "OFF"}),
   workStatus: DS.attr('string'),
   rand: DS.attr('string'),
@@ -69,10 +76,15 @@ App.Service = DS.Model.extend({
    * @type {bool}
    */
   hasMasterOrSlaveComponent: function() {
-    return this.get('slaveComponents').toArray()
-    .concat(this.get('masterComponents').toArray())
-    .mapProperty('totalCount')
-    .reduce((a, b) => a + b, 0) > 0;
+    if (App.router.get('clusterController.isHostComponentMetricsLoaded')) {
+      return this.get('slaveComponents').toArray()
+      .concat(this.get('masterComponents').toArray())
+      .mapProperty('totalCount')
+      .reduce((a, b) => a + b, 0) > 0;
+    } else {
+      //Assume that service has master or/and slave components until data 
loaded
+      return true;
+    }
   }.property('slaveComponents.@each.totalCount', 
'masterComponents.@each.totalCount'),
 
   serviceComponents: function() {
diff --git a/ambari-web/app/templates/main/service/menu_item.hbs 
b/ambari-web/app/templates/main/service/menu_item.hbs
index 9ac8d76..430d012 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.displayName}}
+      {{view.content.displayName}}
   </span>
 </a>

Reply via email to