[ambari] branch trunk updated: AMBARI-24905 Service display name on left navigation bar should be suffixed with "Client" if only client service component is present for a service

2018-11-19 Thread atkach
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 
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 @@
 
   {{/unless}}
   
-  {{unbound view.displayName}}
+  {{view.content.displayName}}
   
 



[ambari] branch trunk updated: AMBARI-24905 Service display name on left navigation bar should be suffixed with "Client" if only client service component is present for a service

2018-11-15 Thread atkach
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 
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 @@
 
   {{/unless}}
   
-  {{unbound view.content.displayName}}
+  {{unbound view.displayName}}
   
 
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,