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/07/19 15:03:45 UTC

[ambari] branch branch-2.7 updated: AMBARI-24241 Host details page: remove duplicate title

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

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


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new 792fd45  AMBARI-24241 Host details page: remove duplicate title
792fd45 is described below

commit 792fd45d6dcfca2749a9c7be3daa04c7b2b18819
Author: Andrii Tkach <at...@apache.org>
AuthorDate: Thu Jul 19 16:29:17 2018 +0300

    AMBARI-24241 Host details page: remove duplicate title
---
 ambari-web/app/models/host.js                   |  2 ++
 ambari-web/app/routes/main.js                   | 12 +++++++++++-
 ambari-web/app/styles/hosts.less                |  9 +++++++++
 ambari-web/app/styles/top-nav.less              |  8 +++++++-
 ambari-web/app/templates/main/host/details.hbs  | 13 +------------
 ambari-web/app/views/main/host/details.js       |  4 +---
 ambari-web/test/views/main/host/details_test.js | 16 ++--------------
 7 files changed, 33 insertions(+), 31 deletions(-)

diff --git a/ambari-web/app/models/host.js b/ambari-web/app/models/host.js
index ec7c71c..258f348 100644
--- a/ambari-web/app/models/host.js
+++ b/ambari-web/app/models/host.js
@@ -61,6 +61,8 @@ App.Host = DS.Model.extend({
    */
   selected:DS.attr('boolean'),
 
+  isActive: Em.computed.equal('passiveState', 'OFF'),
+
   criticalWarningAlertsCount: function() {
     const alertsSummary = this.get('alertsSummary');
     return alertsSummary ? (alertsSummary.CRITICAL || 0) + (alertsSummary.WARNING || 0) : 0;
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 0b5bf33..c4cf148 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -232,7 +232,17 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
     hostDetails: Em.Route.extend({
 
       breadcrumbs: {
-        labelBindingPath: 'App.router.mainHostDetailsController.content.hostName'
+        itemView: Em.View.extend({
+          tagName: "a",
+          contentBinding: 'App.router.mainHostDetailsController.content',
+          isActive: Em.computed.equal('content.passiveState', 'OFF'),
+          click: function() {
+            App.router.transitionTo('hosts.hostDetails.summary', this.get('content'));
+          },
+          template: Em.Handlebars.compile('<span class="host-breadcrumb">{{view.content.hostName}}</span>' +
+            '<span rel="HealthTooltip" {{bindAttr class="view.content.healthClass view.content.healthIconClass :icon"}} ' +
+            'data-placement="bottom" {{bindAttr data-original-title="view.content.healthToolTip" }}></span>')
+        })
       },
 
       route: '/:host_id',
diff --git a/ambari-web/app/styles/hosts.less b/ambari-web/app/styles/hosts.less
index 8842f7b..b18d91f 100644
--- a/ambari-web/app/styles/hosts.less
+++ b/ambari-web/app/styles/hosts.less
@@ -462,6 +462,15 @@
   }
 }
 
+.host-breadcrumb {
+  max-width: 50%;
+  display: inline-block;
+  text-overflow: ellipsis;
+  white-space: nowrap;
+  overflow: hidden;
+  vertical-align: bottom;
+}
+
 #host-alerts {
   padding: 0 10px;
   background-color: #ffffff;
diff --git a/ambari-web/app/styles/top-nav.less b/ambari-web/app/styles/top-nav.less
index 9899251..9fcc5f3 100644
--- a/ambari-web/app/styles/top-nav.less
+++ b/ambari-web/app/styles/top-nav.less
@@ -26,9 +26,10 @@
     margin-bottom: 10px;
 
     .navbar-header {
-      padding: 19px 15px 19px 0px;
+      padding: 19px 15px 19px 0;
       margin-top: -5px;
       font-size: 20px;
+      width: ~"calc(100% - 400px)";
       a {
         color: #313D54;
         cursor: pointer;
@@ -37,6 +38,11 @@
         cursor: default;
         color: #999;
       }
+      .icon {
+        font-size: @default-font-size;
+        margin: 0 4px;
+        vertical-align: baseline;
+      }
     }
 
     .cluster-notifications {
diff --git a/ambari-web/app/templates/main/host/details.hbs b/ambari-web/app/templates/main/host/details.hbs
index 6616f6d..f8de0cb 100644
--- a/ambari-web/app/templates/main/host/details.hbs
+++ b/ambari-web/app/templates/main/host/details.hbs
@@ -18,18 +18,7 @@
 
 {{#if view.isLoaded}}
   <div id="host-details">
-    <div class="host-details-header">
-      <div class="status-info mbm">
-        <h2 class='table-title display-inline'>
-          <a class="disabled">{{t common.host}}</a><span>:&nbsp;{{unbound view.content.hostName}}</span>
-        </h2>
-        <span rel="HealthTooltip" {{bindAttr class="view.content.healthClass view.content.healthIconClass"}} data-placement="bottom" {{bindAttr data-original-title="view.content.healthToolTip" }}></span>
-        {{#unless view.isActive}}
-          <span class="host-maintenance-notice pull-right"><span class="icon-medkit"></span> {{t hosts.host.passive.mode}}</span>
-        {{/unless}}
-      </div>
-    </div>
-    <div class="content">
+       <div class="content">
       {{view App.MainHostMenuView hostBinding="view.content"}}
         <div class="service-button">
           <div class="btn-group display-inline-block">
diff --git a/ambari-web/app/views/main/host/details.js b/ambari-web/app/views/main/host/details.js
index 610360a..3d9e8ed 100644
--- a/ambari-web/app/views/main/host/details.js
+++ b/ambari-web/app/views/main/host/details.js
@@ -38,10 +38,8 @@ App.MainHostDetailsView = Em.View.extend({
 
   hasManyClientsWithConfigs: Em.computed.gt('clientsWithConfigs.length', 1),
 
-  isActive: Em.computed.equal('controller.content.passiveState', 'OFF'),
-
   maintenance: function () {
-    var onOff = this.get('isActive') ? "On" : "Off";
+    var onOff = this.get('controller.content.isActive') ? "On" : "Off";
     var result = [];
     if (App.isAuthorized("SERVICE.START_STOP")) {
       result = result.concat([
diff --git a/ambari-web/test/views/main/host/details_test.js b/ambari-web/test/views/main/host/details_test.js
index 857b644..bcae55d 100644
--- a/ambari-web/test/views/main/host/details_test.js
+++ b/ambari-web/test/views/main/host/details_test.js
@@ -72,25 +72,13 @@ describe('App.MainHostDetailsView', function () {
     });
   });
 
-  describe('#isActive', function () {
-    activeCases.forEach(function (item) {
-      it('should be ' + item.isActive, function () {
-        view.set('controller', {
-          content: {
-            passiveState: item.passiveState
-          }
-        });
-        expect(view.get('isActive')).to.equal(item.isActive);
-      });
-    });
-  });
-
   describe('#maintenance', function () {
     activeCases.forEach(function (item) {
       it('passive state label should contain ' + item.label, function () {
         view.set('controller', {
           content: {
-            passiveState: item.passiveState
+            passiveState: item.passiveState,
+            isActive: item.isActive
           }
         });
         expect(view.get('maintenance').findProperty('action', 'onOffPassiveModeForHost').label).to.contain(item.label);