Repository: ambari Updated Branches: refs/heads/trunk 8867b3685 -> 9a070cff5
AMBARI-13143. Links from alerts-popup to host/service don't work (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9a070cff Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9a070cff Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9a070cff Branch: refs/heads/trunk Commit: 9a070cff5404a005834d7462a5d9e5dc6efc7325 Parents: 8867b36 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Fri Sep 18 14:40:26 2015 +0300 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Fri Sep 18 14:40:26 2015 +0300 ---------------------------------------------------------------------- .../alerts/definition_details_controller.js | 22 ----------------- .../main/alerts/instance_service_host.hbs | 4 ++-- .../main/alerts/definition_details_view.js | 25 +++++++++++++++++++- .../definitions_details_controller_test.js | 21 ---------------- .../main/alerts/definition_details_view_test.js | 21 ++++++++++++++++ 5 files changed, 47 insertions(+), 46 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9a070cff/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 336033e..3438f2b 100644 --- a/ambari-web/app/controllers/main/alerts/definition_details_controller.js +++ b/ambari-web/app/controllers/main/alerts/definition_details_controller.js @@ -304,28 +304,6 @@ 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/9a070cff/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 ffcf7ed..cff614c 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="controller"}} href="#">{{view.instance.serviceDisplayName}}</a> + <a {{action goToService view.instance.service target="view.parentView"}} href="#">{{view.instance.serviceDisplayName}}</a> {{else}} {{view.instance.serviceDisplayName}} {{/if}} @@ -26,7 +26,7 @@ / {{/if}} {{#if view.instance.hostName}} - <a {{action goToHostAlerts view.instance.host target="controller"}} href="#"> + <a {{action goToHostAlerts view.instance.host target="view.parentView"}} href="#"> {{view.instance.hostName}} </a> {{/if}} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/9a070cff/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 12b563c..6b5e065 100644 --- a/ambari-web/app/views/main/alerts/definition_details_view.js +++ b/ambari-web/app/views/main/alerts/definition_details_view.js @@ -110,6 +110,28 @@ App.MainAlertDefinitionDetailsView = App.TableView.extend({ willDestroyElement: function() { this.$("[rel=tooltip]").tooltip('destroy'); this.$(".alert-text").tooltip('destroy'); + }, + + /** + * 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); + } } }), @@ -172,4 +194,5 @@ 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/9a070cff/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 baeae36..dea1f2a 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,25 +163,4 @@ 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/9a070cff/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 3bbf049..ff336a0 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 @@ -30,4 +30,25 @@ 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; + }); + }); + });