ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject ambari git commit: AMBARI-19128. Tooltip is not hidden on host alerts page (onechiporenko)
Date Wed, 07 Dec 2016 17:07:45 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 4bc1a73f4 -> 9fc7f0ae1


AMBARI-19128. Tooltip is not hidden on host alerts page (onechiporenko)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9fc7f0ae
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9fc7f0ae
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9fc7f0ae

Branch: refs/heads/trunk
Commit: 9fc7f0ae153ec90229fedc62d2fd35b3eb0c5843
Parents: 4bc1a73
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Wed Dec 7 17:03:33 2016 +0200
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Wed Dec 7 19:07:32 2016 +0200

----------------------------------------------------------------------
 .../app/templates/main/host/host_alerts.hbs     |  8 ++--
 .../app/views/main/host/host_alerts_view.js     | 41 +++++++++++---------
 .../views/main/host/host_alerts_view_test.js    |  3 +-
 3 files changed, 28 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9fc7f0ae/ambari-web/app/templates/main/host/host_alerts.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/host/host_alerts.hbs b/ambari-web/app/templates/main/host/host_alerts.hbs
index 17c8bc3..2b02388 100644
--- a/ambari-web/app/templates/main/host/host_alerts.hbs
+++ b/ambari-web/app/templates/main/host/host_alerts.hbs
@@ -56,9 +56,11 @@
             <td>
               {{template "templates/main/alerts/alert_instance/status"}}
             </td>
-            <td><span
-                    class="alert-text" {{bindAttr data-original-title="instance.escapeSpecialCharactersFromTooltip"}}
-                    class="alert-text">{{instance.text}}</span></td>
+            <td>
+              <span class="alert-text" {{bindAttr data-original-title="instance.escapeSpecialCharactersFromTooltip"}}>
+                {{instance.text}}
+              </span>
+            </td>
           </tr>
         {{/each}}
       {{else}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fc7f0ae/ambari-web/app/views/main/host/host_alerts_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/host_alerts_view.js b/ambari-web/app/views/main/host/host_alerts_view.js
index 34a2a3e..fd0979f 100644
--- a/ambari-web/app/views/main/host/host_alerts_view.js
+++ b/ambari-web/app/views/main/host/host_alerts_view.js
@@ -46,10 +46,9 @@ App.MainHostAlertsView = App.TableView.extend({
         }
       });
       return [].concat(criticalAlerts, warningAlerts, okAlerts, otherAlerts);
-    } else {
-      return [];
     }
-  }.property('controller.content.@each'),
+    return [];
+  }.property('controller.content.[]'),
 
   willInsertElement: function () {
     var hostName = this.get('parentView.controller.content.hostName');
@@ -223,22 +222,16 @@ App.MainHostAlertsView = App.TableView.extend({
    * @type {string}
    */
   paginationLeftClass: function () {
-    if (this.get("startIndex") > 1) {
-      return "paginate_previous";
-    }
-    return "paginate_disabled_previous";
-  }.property("startIndex", 'filteredCount'),
+    return this.get('startIndex') > 1 ? 'paginate_previous' : 'paginate_disabled_previous';
+  }.property('startIndex', 'filteredCount'),
 
   /**
    * Determines how display "next"-link - as link or text
    * @type {string}
    */
   paginationRightClass: function () {
-    if ((this.get("endIndex")) < this.get("filteredCount")) {
-      return "paginate_next";
-    }
-    return "paginate_disabled_next";
-  }.property("endIndex", 'filteredCount'),
+    return this.get('endIndex') < this.get('filteredCount') ? 'paginate_next' : 'paginate_disabled_next';
+  }.property('endIndex', 'filteredCount'),
 
   /**
    * Show previous-page if user not in the first page
@@ -266,12 +259,12 @@ App.MainHostAlertsView = App.TableView.extend({
    */
   tooltipsUpdater: function () {
     Em.run.once(this,this.tooltipsUpdaterOnce);
-  }.observes('pageContent.@each'),
+  }.observes('pageContent.[]'),
 
   tooltipsUpdaterOnce: function() {
     var self = this;
     Em.run.next(this, function () {
-      App.tooltip(self.$(".enable-disable-button, .timeago, .alert-text"));
+      App.tooltip(self.$('.timeago, .alert-text'));
     });
   },
 
@@ -281,14 +274,24 @@ App.MainHostAlertsView = App.TableView.extend({
   clearFilters: function() {
     this.set('filterConditions', []);
     this.get('childViews').forEach(function(childView) {
-      if (childView['clearFilter']) {
-        childView.clearFilter();
-      }
+      Em.tryInvoke(childView, 'clearFilter');
     });
   },
 
+  /**
+   * Tooltips should be removed if some filter is applied or cleared
+   *
+   * @method clearTooltips
+   */
+  clearTooltips: function () {
+    var $elements = this.$('.timeago, .alert-text');
+    if ($elements) {
+      $elements.tooltip('destroy');
+    }
+  }.observes('filteredCount'),
+
   willDestroyElement: function() {
-    this.$(".enable-disable-button, .timeago, .alert-text").tooltip('destroy');
+    this.clearTooltips();
   }
 
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fc7f0ae/ambari-web/test/views/main/host/host_alerts_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/host/host_alerts_view_test.js b/ambari-web/test/views/main/host/host_alerts_view_test.js
index 2c0d59a..f8d2e95 100644
--- a/ambari-web/test/views/main/host/host_alerts_view_test.js
+++ b/ambari-web/test/views/main/host/host_alerts_view_test.js
@@ -186,7 +186,6 @@ describe('App.MainHostAlertsView', function () {
     });
   });
 
-
   describe("#paginationLeftClass", function() {
 
     it("startIndex is 2", function() {
@@ -271,7 +270,7 @@ describe('App.MainHostAlertsView', function () {
 
     it("tooltip should be called", function() {
       view.willDestroyElement();
-      expect(view.$.calledWith(".enable-disable-button, .timeago, .alert-text")).to.be.true;
+      expect(view.$.calledWith('.timeago, .alert-text')).to.be.true;
       expect(mock.tooltip.calledWith('destroy')).to.be.true;
     });
   });


Mime
View raw message