You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2015/08/10 17:15:54 UTC

ambari git commit: AMBARI-12693. Alerts response tooltip hanging around (onechiporenko)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 49b71d92e -> 72f30b38c


AMBARI-12693. Alerts response tooltip hanging around (onechiporenko)


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

Branch: refs/heads/branch-2.1
Commit: 72f30b38c8bb1e19ad4394adc477d353d4f8f5ab
Parents: 49b71d9
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Mon Aug 10 18:12:32 2015 +0300
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Mon Aug 10 18:12:32 2015 +0300

----------------------------------------------------------------------
 .../alerts/definition_details_controller.js     | 23 ++++++++++++++++
 .../main/alerts/instance_service_host.hbs       |  4 +--
 .../main/alerts/definition_details_view.js      | 29 +++++---------------
 .../definitions_details_controller_test.js      | 21 ++++++++++++++
 .../main/alerts/definition_details_view_test.js | 22 +--------------
 5 files changed, 54 insertions(+), 45 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/72f30b38/ambari-web/app/controllers/main/alerts/definition_details_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/alerts/definition_details_controller.js b/ambari-web/app/controllers/main/alerts/definition_details_controller.js
index 9be220e..27e6a4a 100644
--- a/ambari-web/app/controllers/main/alerts/definition_details_controller.js
+++ b/ambari-web/app/controllers/main/alerts/definition_details_controller.js
@@ -304,5 +304,28 @@ App.MainAlertDefinitionDetailsController = Em.Controller.extend({
         this.hide();
       }
     });
+  },
+
+  /**
+   * Router transition to service page
+   * @param event
+   */
+  goToService: function (event) {
+    if (event && event.context) {
+      App.router.transitionTo('main.services.service.summary', event.context);
+    }
+  },
+
+  /**
+   * Router transition to host level alerts page
+   * @param {object} event
+   * @method goToHostAlerts
+   */
+  goToHostAlerts: function (event) {
+    if (event && event.context) {
+      App.router.get('mainHostDetailsController').set('referer', App.router.location.lastSetURL);
+      App.router.transitionTo('main.hosts.hostDetails.alerts', event.context);
+    }
   }
+
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/72f30b38/ambari-web/app/templates/main/alerts/instance_service_host.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/alerts/instance_service_host.hbs b/ambari-web/app/templates/main/alerts/instance_service_host.hbs
index cff614c..ffcf7ed 100644
--- a/ambari-web/app/templates/main/alerts/instance_service_host.hbs
+++ b/ambari-web/app/templates/main/alerts/instance_service_host.hbs
@@ -17,7 +17,7 @@
 }}
 {{#if view.instance.serviceDisplayName}}
   {{#if view.serviceIsLink}}
-    <a {{action goToService view.instance.service target="view.parentView"}} href="#">{{view.instance.serviceDisplayName}}</a>
+    <a {{action goToService view.instance.service target="controller"}} href="#">{{view.instance.serviceDisplayName}}</a>
   {{else}}
     {{view.instance.serviceDisplayName}}
   {{/if}}
@@ -26,7 +26,7 @@
   &nbsp;/&nbsp;
 {{/if}}
 {{#if view.instance.hostName}}
-  <a {{action goToHostAlerts view.instance.host target="view.parentView"}} href="#">
+  <a {{action goToHostAlerts view.instance.host target="controller"}} href="#">
     {{view.instance.hostName}}
   </a>
 {{/if}}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/72f30b38/ambari-web/app/views/main/alerts/definition_details_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/alerts/definition_details_view.js b/ambari-web/app/views/main/alerts/definition_details_view.js
index eabe36c..2c7dae2 100644
--- a/ambari-web/app/views/main/alerts/definition_details_view.js
+++ b/ambari-web/app/views/main/alerts/definition_details_view.js
@@ -99,34 +99,19 @@ App.MainAlertDefinitionDetailsView = App.TableView.extend({
   instanceTableRow: Em.View.extend({
     tagName: 'tr',
     didInsertElement: function () {
-      App.tooltip($("[rel=tooltip]"));
-      App.tooltip($(".alert-text"), {
+      App.tooltip(this.$("[rel=tooltip]"));
+      App.tooltip(this.$(".alert-text"), {
         placement: 'left',
         delay: { "show": 0, "hide": 1500 },
         template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner alert-def-detail-tooltip"></div></div>'
-      });    },
-
-    /**
-     * Router transition to service page
-     * @param event
-     */
-    goToService: function (event) {
-      if (event && event.context) {
-        App.router.transitionTo('main.services.service.summary', event.context);
-      }
+      });
     },
 
-    /**
-     * Router transition to host level alerts page
-     * @param {object} event
-     * @method goToHostAlerts
-     */
-    goToHostAlerts: function (event) {
-      if (event && event.context) {
-        App.router.get('mainHostDetailsController').set('referer', App.router.location.lastSetURL);
-        App.router.transitionTo('main.hosts.hostDetails.alerts', event.context);
-      }
+    willDestroyElement: function() {
+      this.$("[rel=tooltip]").tooltip('destroy');
+      this.$(".alert-text").tooltip('destroy');
     }
+
   }),
 
   paginationLeftClass: function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/72f30b38/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js b/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
index dea1f2a..baeae36 100644
--- a/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
@@ -163,4 +163,25 @@ describe('App.MainAlertDefinitionDetailsController', function () {
     });
   });
 
+  describe("#goToHostAlerts()", function () {
+    beforeEach(function () {
+      sinon.stub(App.get('router'), 'transitionTo', Em.K);
+    });
+    afterEach(function () {
+      App.get('router').transitionTo.restore();
+    });
+    it("not route to host - no event", function () {
+      controller.goToHostAlerts(null);
+      expect(App.get('router').transitionTo.notCalled).to.be.true;
+    });
+    it("not route to host - no event context", function () {
+      controller.goToHostAlerts({});
+      expect(App.get('router').transitionTo.notCalled).to.be.true;
+    });
+    it("routes to host", function () {
+      controller.goToHostAlerts({"context": "hostname"});
+      expect(App.get('router').transitionTo.calledOnce).to.be.true;
+    });
+  });
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/72f30b38/ambari-web/test/views/main/alerts/definition_details_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/alerts/definition_details_view_test.js b/ambari-web/test/views/main/alerts/definition_details_view_test.js
index 331474d..3bbf049 100644
--- a/ambari-web/test/views/main/alerts/definition_details_view_test.js
+++ b/ambari-web/test/views/main/alerts/definition_details_view_test.js
@@ -18,7 +18,7 @@
 
 var App = require('app');
 
-var view;
+var view, instanceTableRow;
 
 describe('App.MainAlertDefinitionDetailsView', function () {
 
@@ -30,24 +30,4 @@ describe('App.MainAlertDefinitionDetailsView', function () {
 
   });
 
-  describe("#goToHostAlerts()", function () {
-    beforeEach(function () {
-      sinon.stub(App.get('router'), 'transitionTo', Em.K);
-    });
-    afterEach(function () {
-      App.get('router').transitionTo.restore();
-    });
-    it("not route to host - no event", function () {
-      instanceTableRow.goToHostAlerts(null);
-      expect(App.get('router').transitionTo.notCalled).to.be.true;
-    });
-    it("not route to host - no event context", function () {
-      instanceTableRow.goToHostAlerts({});
-      expect(App.get('router').transitionTo.notCalled).to.be.true;
-    });
-    it("routes to host", function () {
-      instanceTableRow.goToHostAlerts({"context": "hostname"});
-      expect(App.get('router').transitionTo.calledOnce).to.be.true;
-    });
-  });
 });