ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From onechipore...@apache.org
Subject [1/2] ambari git commit: AMBARI-12693. Alerts response tooltip hanging around (onechiporenko)
Date Tue, 11 Aug 2015 09:07:24 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk f52236c59 -> 8a12fecf1


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/a4203583
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a4203583
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a4203583

Branch: refs/heads/trunk
Commit: a4203583f8714442ec48f5318b75960c6f8a892a
Parents: f52236c
Author: Oleg Nechiporenko <onechiporenko@apache.org>
Authored: Mon Aug 10 18:21:08 2015 +0300
Committer: Oleg Nechiporenko <onechiporenko@apache.org>
Committed: Tue Aug 11 11:54:41 2015 +0300

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


http://git-wip-us.apache.org/repos/asf/ambari/blob/a4203583/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/a4203583/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/a4203583/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..cbbded9 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 () {
@@ -187,4 +172,4 @@ App.AlertInstanceServiceHostView = Em.View.extend({
   showSeparator: function () {
     return this.get('instance.serviceDisplayName') && this.get('instance.hostName');
   }.property('instance.serviceDisplayName', 'instance.hostName')
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/a4203583/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/a4203583/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;
-    });
-  });
 });


Mime
View raw message