Ver código fonte

AMBARI-5525. Flume agent selection lost during periodic background refresh. (akovalenko)

Aleksandr Kovalenko 11 anos atrás
pai
commit
662a0af63f

+ 1 - 1
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';

+ 2 - 2
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>

+ 17 - 15
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.