Repository: ambari Updated Branches: refs/heads/trunk d9443620a -> 662a0af63
AMBARI-5525. Flume agent selection lost during periodic background refresh. (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/662a0af6 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/662a0af6 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/662a0af6 Branch: refs/heads/trunk Commit: 662a0af63f9bcaa268df3beb53f90da99f92bd5a Parents: d944362 Author: Aleksandr Kovalenko <[email protected]> Authored: Tue Apr 22 16:34:58 2014 +0300 Committer: Aleksandr Kovalenko <[email protected]> Committed: Tue Apr 22 16:34:58 2014 +0300 ---------------------------------------------------------------------- .../controllers/main/service/info/summary.js | 2 +- .../templates/main/service/services/flume.hbs | 4 +-- .../app/views/main/service/services/flume.js | 32 +++++++++++--------- 3 files changed, 20 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/662a0af6/ambari-web/app/controllers/main/service/info/summary.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/service/info/summary.js b/ambari-web/app/controllers/main/service/info/summary.js index 08150cb..6365c00 100644 --- a/ambari-web/app/controllers/main/service/info/summary.js +++ b/ambari-web/app/controllers/main/service/info/summary.js @@ -44,7 +44,7 @@ App.MainServiceInfoSummaryController = Em.Controller.extend({ */ stopFlumeAgent: function () { var selectedFlumeAgent = this.get('selectedFlumeAgent'); - if (selectedFlumeAgent && selectedFlumeAgent.get('status') === 'STARTED') { + if (selectedFlumeAgent && selectedFlumeAgent.get('status') === 'RUNNING') { var self = this; App.showConfirmationPopup(function () { var command = 'STOP'; http://git-wip-us.apache.org/repos/asf/ambari/blob/662a0af6/ambari-web/app/templates/main/service/services/flume.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/service/services/flume.hbs b/ambari-web/app/templates/main/service/services/flume.hbs index e5dd18a..ddbb868 100644 --- a/ambari-web/app/templates/main/service/services/flume.hbs +++ b/ambari-web/app/templates/main/service/services/flume.hbs @@ -52,7 +52,7 @@ </thead> <tbody> {{#each agent in view.pageContent}} - <tr {{action showAgentInfo agent target="view"}}> + {{#view view.agentView contentBinding="agent"}} <td class="agent-status"> <span {{bindAttr class="agent.healthClass"}}></span> </td> @@ -73,7 +73,7 @@ <td> {{agent.sinksCount}} </td> - </tr> + {{/view}} {{/each}} </tbody> </table> http://git-wip-us.apache.org/repos/asf/ambari/blob/662a0af6/ambari-web/app/views/main/service/services/flume.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/service/services/flume.js b/ambari-web/app/views/main/service/services/flume.js index 659549b..f5ca07c 100644 --- a/ambari-web/app/views/main/service/services/flume.js +++ b/ambari-web/app/views/main/service/services/flume.js @@ -49,6 +49,20 @@ App.MainDashboardServiceFlumeView = App.TableView.extend({ return App.HostComponent.find().findProperty('componentName', 'FLUME_HANDLER'); }.property(), + agentView: Em.View.extend({ + content: null, + tagName: 'tr', + classNameBindings: ['selectedClass'], + + selectedClass: function () { + return this.get('controller.selectedFlumeAgent.id') === this.get('content.id') ? 'highlight' : ''; + }.property('controller.selectedFlumeAgent'), + + click: function () { + this.get('parentView').showAgentInfo(this.get('content')); + } + }), + sortView: sort.wrapperView, statusSort: sort.fieldView.extend({ @@ -100,7 +114,7 @@ App.MainDashboardServiceFlumeView = App.TableView.extend({ this.set('isActionsDisabled', !selectedFlumeAgent); if (selectedFlumeAgent) { this.set('isStartAgentDisabled', selectedFlumeAgent.get('status') !== 'INSTALLED'); - this.set('isStopAgentDisabled', selectedFlumeAgent.get('status') !== 'STARTED'); + this.set('isStopAgentDisabled', selectedFlumeAgent.get('status') !== 'RUNNING'); } }.observes('controller.selectedFlumeAgent', 'controller.selectedFlumeAgent.status'), @@ -111,21 +125,9 @@ App.MainDashboardServiceFlumeView = App.TableView.extend({ * @method showAgentInfo * @param {object} event */ - showAgentInfo: function (event) { - var agent = event.context; + showAgentInfo: function (agent) { this.set('controller.selectedFlumeAgent', agent); - this.toggleHighlight($(event.currentTarget)); - this.setAgentMetrics(event.context); - }, - /** - * Highlight current row and remove highlight from previously selected item. - * - * @method toggleHighlight - * @param {object} element - jQuery object - */ - toggleHighlight: function(element) { - element.parent().find('.highlight').removeClass('highlight'); - element.addClass('highlight'); + this.setAgentMetrics(agent); }, /** * Show Flume agent metric.
