ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject git commit: AMBARI-6779. Refactor Flume agents table to be more host centric (alexantonenko)
Date Thu, 07 Aug 2014 20:37:36 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 9f74a44a1 -> 6a91834c2


AMBARI-6779. Refactor Flume agents table to be more host centric (alexantonenko)


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

Branch: refs/heads/trunk
Commit: 6a91834c28cac0a9b20d5a2067dc6337b2d611ae
Parents: 9f74a44
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Thu Aug 7 23:27:44 2014 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Thu Aug 7 23:27:44 2014 +0300

----------------------------------------------------------------------
 .../controllers/main/service/info/summary.js    |  10 +-
 ambari-web/app/messages.js                      |   9 +-
 ambari-web/app/models/service/flume.js          |  16 +++
 ambari-web/app/styles/application.less          |  17 ++-
 .../templates/main/service/services/flume.hbs   | 136 ++++++++++++-------
 .../app/views/main/service/services/flume.js    | 114 ++++++----------
 6 files changed, 171 insertions(+), 131 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6a91834c/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 ce90ac4..ab4770f 100644
--- a/ambari-web/app/controllers/main/service/info/summary.js
+++ b/ambari-web/app/controllers/main/service/info/summary.js
@@ -27,7 +27,7 @@ App.MainServiceInfoSummaryController = Em.Controller.extend({
    * @method startFlumeAgent
    */
   startFlumeAgent: function () {
-    var selectedFlumeAgent = this.get('selectedFlumeAgent');
+    var selectedFlumeAgent = arguments[0].context;
     if (selectedFlumeAgent && selectedFlumeAgent.get('status') === 'NOT_RUNNING')
{
       var self = this;
       App.showConfirmationPopup(function () {
@@ -43,7 +43,7 @@ App.MainServiceInfoSummaryController = Em.Controller.extend({
    * @method stopFlumeAgent
    */
   stopFlumeAgent: function () {
-    var selectedFlumeAgent = this.get('selectedFlumeAgent');
+    var selectedFlumeAgent = arguments[0].context;
     if (selectedFlumeAgent && selectedFlumeAgent.get('status') === 'RUNNING') {
       var self = this;
       App.showConfirmationPopup(function () {
@@ -88,6 +88,12 @@ App.MainServiceInfoSummaryController = Em.Controller.extend({
     });
   },
 
+  gotoConfigs: function (){
+    App.router.get('mainServiceItemController').set('routeToConfigs', true);
+    App.router.transitionTo('main.services.service.configs', this.get('content'));
+    App.router.get('mainServiceItemController').set('routeToConfigs', false);
+  },
+
   nagiosUrl: function(){
     return App.router.get('clusterController.nagiosUrl');
   }.property('App.router.clusterController.nagiosUrl'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a91834c/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index b6af038..7f134f6 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1912,16 +1912,13 @@ Em.I18n.translations = {
   'dashboard.services.mapreduce.jobTrackerUptime':'Job Trackers Uptime',
   'dashboard.services.mapreduce.chart.label':'Jobs Running',
 
-  'dashboard.services.flume.summary.single':'1 Flume on ',
-  'dashboard.services.flume.summary.multiple':'{0} Flume on ',
-  'dashboard.services.flume.summary.hosts.single':'1 host',
-  'dashboard.services.flume.summary.hosts.multiple':'{0} hosts',
+  'dashboard.services.flume.summary.title':'Flume installed on {0} host{1} ({2} agent{3})',
+  'dashboard.services.flume.summary.configure':'Configure Agents',
   'dashboard.services.flume.agentsLabel': 'Flume',
   'dashboard.services.flume.channels': 'Channels',
   'dashboard.services.flume.sources': 'Sources',
   'dashboard.services.flume.sinks': 'Sinks',
-  'dashboard.services.flume.agent': '',
-
+  'dashboard.services.flume.agent': 'Agent',
 
   'dashboard.services.hbase.summary':'{0} region servers with {1} average load',
   'dashboard.services.hbase.masterServer':'HBase Master',

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a91834c/ambari-web/app/models/service/flume.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service/flume.js b/ambari-web/app/models/service/flume.js
index 79af5a7..4a76969 100644
--- a/ambari-web/app/models/service/flume.js
+++ b/ambari-web/app/models/service/flume.js
@@ -54,7 +54,23 @@ App.FlumeAgent = DS.Model.extend({
       return App.healthIconClassYellow;
       break;
     }
+  }.property('status'),
+
+  displayStatus : function() {
+    switch (this.get('status')) {
+      case 'RUNNING':
+        return "Running";
+        break;
+      case 'NOT_RUNNING':
+        return "Stopped";
+        break;
+      case 'UNKNOWN':
+      default:
+        return "Unknown";
+        break;
+    }
   }.property('status')
+
 });
 
 App.FlumeAgent.FIXTURES = [];

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a91834c/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index 7041e4b..4a4a5ae 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -6673,13 +6673,12 @@ i.icon-asterisks {
     width: 100%;
     .highlight {
       td, th {
-        background-color: #BDC3C7;
+        background-color: #BDC3C7 !important;
         color: #666;
       }
     }
     td.agent-status {
-      width: 14px;
-      overflow: hidden;
+      width: 125px;
     }
     td.agent-name {
       width: 20%;
@@ -6709,19 +6708,29 @@ i.icon-asterisks {
     .sorting {
       background: url(	data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAByUDbMAAAKQWlDQ1BJQ0MgUHJvZmlsZQAASA2dlndUU9kWh8+9N73QEiIgJfQaegkg0jtIFQRRiUmAUAKGhCZ2RAVGFBEpVmRUwAFHhyJjRRQLg4Ji1wnyEFDGwVFEReXdjGsJ7601896a/cdZ39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UfPjPmM3Xqx9MXwy4yX0+OFvyn+tveV0auffnf7vWdiycTwa9HrmT9K3qi+OfrW9m3nZOjk03dp76anit6rvj/2gf2h+2P0x5Hp7E/4T5WfjT93fAn88ngmbWbm3/eE8/syOll+AAAACXBIWXMAAAsTAAALEwEAmpwYAAABmElEQVQ4EdWSv0vDQBTH7y4ZUkKhTdtYHArOUvwPdHAVpeBY3PwH/BfEycF/wclR6NzBxUFxKrgokRLaSkmhTZr+ADWJ32s5DeXaSkHBW97du/c+73vvHiF/vaIooj+pyZYFAaTbtn0DuzR2YQBX1G63K57n7TQajfNlhRfCfN8/6na7u4AS13VPOp3O/iLgXBgAa0i+/Hh7J5RSEoYh6fV6FfjX5wGlMCQwgKpQNs0Lo4kdjUYEz77FvSIDSmGA7DmOU+SKxGJkukeRDfTwWPjjVo0fxH48Hic1TbtmjBX5c2F1WA/3rSAI7obDoSVif81+vyNWAmNQHgwGB6qqbqHxOUVRklD
 kQ2ELCu+h+qJQKDzGUiZb6TPT6TTt9/uHABLeK947QFKE0RSyNg3DkM6c9AN0Xb9CwguUCNDXeKDQQyaTeZpVxc9SZVASQMk2frWFzyCTwUBDElqCmKZZxv10VmaIUmU8Bgmv+Xy+JNRxXzabraJfz3y/0mo2m2e1Wi2q1+sQG+VWgogkAKhlWaeY/pLw/T/7CTBQv9a27vsbAAAAAElFTkSuQmCC)
no-repeat right 50%;
     }
-    .agent-row {
+    #flume-host-agent-row {
       cursor: pointer;
+      text-align: left;
+      background-color: #ffffff;
     }
     .empty-label {
       border-top: 1px solid #dddddd;
       text-align: center
     }
   }
+  .wrapp-flume-status{
+    text-align: left;
+  }
   .flume-agents-actions {
     margin: 0 5px 5px 0;
     a {
       text-decoration: none;
     }
+    a.dropdown-toggle {
+      padding: 2px 6px;
+      font-size: 11px;
+      line-height: 17px;
+    }
   }
   .scrollable-container {
     max-height: 450px;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a91834c/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 7bea002..b6f7689 100644
--- a/ambari-web/app/templates/main/service/services/flume.hbs
+++ b/ambari-web/app/templates/main/service/services/flume.hbs
@@ -19,62 +19,99 @@
 <!-- Flume Agents -->
     <div id="flume-summary">
       <a href="#" {{action filterHosts view.flumeHandlerComponent}}>{{view.summaryHeader}}</a>
-        <div class="btn-group display-inline-block flume-agents-actions pull-right">
-          <a {{bindAttr class=":btn :dropdown-toggle view.isActionsDisabled:disabled"}}
data-toggle="dropdown" href="javascript:void(null)">{{t common.actions}}
-            <span class="caret"></span>
-          </a>
-          <ul class="pull-left dropdown-menu">
-            <li {{bindAttr class="view.isStartAgentDisabled:disabled"}}>
-              <a href="javascript:void(null)"
-                      {{bindAttr class="view.isStartAgentDisabled:disabled"}}
-                      {{action startFlumeAgent target="controller"}}>
-                {{t services.service.summary.flume.startAgent}}</a>
-            </li>
-            <li {{bindAttr class="view.isStopAgentDisabled:disabled"}}>
-              <a href="javascript:void(null)"
-                      {{bindAttr class="view.isStopAgentDisabled:disabled"}}
-                      {{action stopFlumeAgent target="controller"}}>
-                {{t services.service.summary.flume.stopAgent}}</a>
-            </li>
-          </ul>
-        </div>
-      <div class="scrollable-container">
+      <a href="#" class="pull-right" {{action gotoConfigs target="controller"}}>{{t
dashboard.services.flume.summary.configure}}</a>
+      <div id="flume-agent-table" class="scrollable-container">
         <table class="table table-hover table-bordered table-striped" id="flume-agents-table">
           <thead>
           {{#view view.sortView contentBinding="view.filteredContent" class="label-row"}}
-            {{view view.parentView.statusSort}}
-            {{view view.parentView.agentSort}}
             {{view view.parentView.hostSort}}
-            {{view view.parentView.sourceSort}}
-            {{view view.parentView.channelSort}}
-            {{view view.parentView.sinkSort}}
+            <th>{{t dashboard.services.flume.agent}}</th>
+            <th>{{t dashboard.services.flume.sources}}</th>
+            <th>{{t dashboard.services.flume.channels}}</th>
+            <th>{{t dashboard.services.flume.sinks}}</th>
           {{/view}}
           </thead>
-          <tbody>
           {{#if view.pageContent}}
-            {{#each agent in view.pageContent}}
-              {{#view view.agentView contentBinding="agent"}}
-                <td class="agent-status">
-                  <span {{bindAttr class="agent.healthClass"}}></span>
-                </td>
-                <td class="agent-name">
-                  {{agent.name}}
-                </td>
-                <td class="agent-host-name">
-                  <a href="javascript:void(null)" {{action showDetails agent.host}}>
-                    {{agent.hostName}}
-                  </a>
-                </td>
-                <td>
-                  {{agent.sourcesCount}}
-                </td>
-                <td>
-                  {{agent.channelsCount}}
-                </td>
-                <td>
-                  {{agent.sinksCount}}
-                </td>
-              {{/view}}
+            {{#each host in view.pageContent}}
+              <tbody>
+                {{#view view.agentView contentBinding="host"}}
+                  <td {{bindAttr rowspan="host.rowspan"}} id="flume-host-agent-row" class="agent-host-name">
+                      <a href="javascript:void(null)" {{action showDetails host.agents}}>
+                        {{host.hostName}}
+                      </a>
+                  </td>
+                  <td class="agent-status">
+                    <div class="wrapp-flume-status">
+                      <span {{bindAttr class="host.firtstAgent.healthClass"}}></span>
{{host.firtstAgent.name}}
+                      <div class="btn-group display-inline-block flume-agents-actions">
+                          <a {{bindAttr class=":btn :dropdown-toggle"}} data-toggle="dropdown"
href="javascript:void(null)">{{host.firtstAgent.displayStatus}}
+                              <span class="caret"></span>
+                          </a>
+                          <ul class="pull-left dropdown-menu">
+                              <li {{bindAttr class="host.firtstAgent.isStartAgentDisabled:disabled"}}>
+                                  <a href="javascript:void(null)"
+                                    {{bindAttr class="host.firtstAgent.isStartAgentDisabled:disabled"}}
+                                    {{action startFlumeAgent host.firtstAgent target="controller"}}>
+                                    {{t services.service.summary.flume.startAgent}}</a>
+                              </li>
+                              <li {{bindAttr class="host.firtstAgent.isStopAgentDisabled:disabled"}}>
+                                  <a href="javascript:void(null)"
+                                    {{bindAttr class="host.firtstAgent.isStopAgentDisabled:disabled"}}
+                                    {{action stopFlumeAgent host.firtstAgent target="controller"}}>
+                                    {{t services.service.summary.flume.stopAgent}}</a>
+                              </li>
+                          </ul>
+                      </div>
+                    </div>
+                  </td>
+                  <td>
+                    {{host.firtstAgent.sourcesCount}}
+                  </td>
+                  <td>
+                    {{host.firtstAgent.channelsCount}}
+                  </td>
+                  <td>
+                    {{host.firtstAgent.sinksCount}}
+                  </td>
+                {{/view}}
+                {{#each agent in host.otherAgents}}
+                  <tr>
+                    <td class="agent-status">
+                        <div class="wrapp-flume-status">
+                            <span {{bindAttr class="agent.healthClass"}}></span>
{{agent.name}}
+                            <div class="btn-group display-inline-block flume-agents-actions">
+                                <a {{bindAttr class=":btn :dropdown-toggle"}} data-toggle="dropdown"
href="javascript:void(null)">{{agent.displayStatus}}
+                                    <span class="caret"></span>
+                                </a>
+                                <ul class="pull-left dropdown-menu">
+                                    <li {{bindAttr class="agent.isStartAgentDisabled:disabled"}}>
+                                        <a href="javascript:void(null)"
+                                          {{bindAttr class="agent.isStartAgentDisabled:disabled"}}
+                                          {{action startFlumeAgent agent target="controller"}}>
+                                          {{t services.service.summary.flume.startAgent}}</a>
+                                    </li>
+                                    <li {{bindAttr class="agent.isStopAgentDisabled:disabled"}}>
+                                        <a href="javascript:void(null)"
+                                          {{bindAttr class="agent.isStopAgentDisabled:disabled"}}
+                                          {{action stopFlumeAgent agent target="controller"}}>
+                                          {{t services.service.summary.flume.stopAgent}}</a>
+                                    </li>
+                                </ul>
+                            </div>
+                        </div>
+                    </td>
+                    <td>
+                      {{agent.sourcesCount}}
+                    </td>
+                    <td>
+                      {{agent.channelsCount}}
+                    </td>
+                    <td>
+                      {{agent.sinksCount}}
+                    </td>
+                  </tr>
+                {{/each}}
+              </tbody>
             {{/each}}
           {{else}}
             <tr>
@@ -83,7 +120,6 @@
               </td>
             </tr>
           {{/if}}
-          </tbody>
         </table>
       </div>
     </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/6a91834c/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 2a122a6..e847f31 100644
--- a/ambari-web/app/views/main/service/services/flume.js
+++ b/ambari-web/app/views/main/service/services/flume.js
@@ -24,25 +24,32 @@ App.MainDashboardServiceFlumeView = App.TableView.extend({
 
   pagination: false,
 
-  isActionsDisabled: true,
-
-  isStartAgentDisabled: true,
-
-  isStopAgentDisabled: true,
+  selectedHost: null,
 
   content: function () {
-    return this.get('service.agents');
-  }.property('service.agents.length'),
+    var hostNames = this.get('service.agents').mapProperty('hostName').uniq(),
+    content = [],
+    self = this;
+    hostNames.forEach(function(hostName) {
+      var agents = self.get('service.agents').filterProperty('hostName', hostName);
+      content.push(
+        Em.Object.create({
+          hostName: hostName,
+          agents: agents,
+          rowspan: agents.length,
+          firtstAgent: agents[0],
+          otherAgents: agents.without(agents[0])
+        })
+      );
+    });
+    return content;
+  }.property('service.agents.length', 'service.@each.agents'),
 
   summaryHeader: function () {
-    var agents = App.FlumeService.find().objectAt(0).get('agents');//this.get('service.agents');
-    var agentCount = agents.get('length');
-    var hostCount = this.get('service.flumeHandlersTotal');
-    var prefix = agentCount == 1 ? this.t("dashboard.services.flume.summary.single") :
-        this.t("dashboard.services.flume.summary.multiple").format(agentCount);
-    var suffix = hostCount == 1 ? this.t("dashboard.services.flume.summary.hosts.single")
:
-        this.t("dashboard.services.flume.summary.hosts.multiple").format(hostCount);
-    return prefix + suffix;
+    var agents = App.FlumeService.find().objectAt(0).get('agents'),
+    agentCount = agents.get('length'),
+    hostCount = this.get('service.flumeHandlersTotal');
+    return this.t("dashboard.services.flume.summary.title").format(hostCount, (hostCount
> 1 ? "s" : ""), agentCount,  (agentCount > 1 ? "s" : ""));
   }.property('service.agents', 'service.hostComponents.length'),
 
   flumeHandlerComponent: function () {
@@ -55,57 +62,26 @@ App.MainDashboardServiceFlumeView = App.TableView.extend({
   agentView: Em.View.extend({
     content: null,
     tagName: 'tr',
-    classNameBindings: ['selectedClass', ':agent-row'],
 
-    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'));
+    click: function (e) {
+      var numberOfAgents = this.get('content.agents').length;
+      if($(e.target).attr('id') == "flume-host-agent-row"){
+        $(e.currentTarget).parents("table:first").find('tr').removeClass('highlight');
+        $(e.currentTarget).addClass('highlight').nextAll("tr").slice(0,numberOfAgents - 1).addClass('highlight');
+        this.get('parentView').showAgentInfo(this.get('content'));
+      }
     }
   }),
 
   sortView: sort.wrapperView,
 
-  statusSort: sort.fieldView.extend({
-    column: '1',
-    name: 'status',
-    displayName: ''
-  }),
-
-  agentSort: sort.fieldView.extend({
-    column: '2',
-    name: 'name',
-    displayName: Em.I18n.t('dashboard.services.flume.agent')
-  }),
-
   hostSort: sort.fieldView.extend({
-    column: '3',
+    column: '1',
     name: 'hostName',
     displayName: Em.I18n.t('common.host')
   }),
 
-  sourceSort: sort.fieldView.extend({
-    column: '4',
-    name: 'sourcesCount',
-    displayName: Em.I18n.t('dashboard.services.flume.sources')
-  }),
-
-  channelSort: sort.fieldView.extend({
-    column: '5',
-    name: 'channelsCount',
-    displayName: Em.I18n.t('dashboard.services.flume.channels')
-  }),
-
-  sinkSort: sort.fieldView.extend({
-    column: '6',
-    name: 'sinksCount',
-    displayName: Em.I18n.t('dashboard.services.flume.sinks')
-  }),
-
   didInsertElement: function () {
-    this.set('controller.selectedFlumeAgent', null);
     this.filter();
   },
 
@@ -113,13 +89,13 @@ App.MainDashboardServiceFlumeView = App.TableView.extend({
    * Change classes for dropdown DOM elements after status change of selected agent
    */
   setActionsDropdownClasses: function () {
-    var selectedFlumeAgent = this.get('controller.selectedFlumeAgent');
-    this.set('isActionsDisabled', !selectedFlumeAgent);
-    if (selectedFlumeAgent) {
-      this.set('isStartAgentDisabled', selectedFlumeAgent.get('status') !== 'NOT_RUNNING');
-      this.set('isStopAgentDisabled', selectedFlumeAgent.get('status') !== 'RUNNING');
-    }
-  }.observes('controller.selectedFlumeAgent', 'controller.selectedFlumeAgent.status'),
+    this.get('content').forEach(function(hosts){
+      hosts.agents.forEach(function (agent) {
+        agent.set('isStartAgentDisabled', agent.get('status') !== 'NOT_RUNNING');
+        agent.set('isStopAgentDisabled', agent.get('status') !== 'RUNNING');
+      });
+    });
+  }.observes('content.@each.agents.@each.status'),
 
   /**
    * Action handler from flume tepmlate.
@@ -128,9 +104,9 @@ App.MainDashboardServiceFlumeView = App.TableView.extend({
    * @method showAgentInfo
    * @param {object} agent
    */
-  showAgentInfo: function (agent) {
-    this.set('controller.selectedFlumeAgent', agent);
-    this.setAgentMetrics(agent);
+  showAgentInfo: function (host) {
+    this.set('selectedHost', host);
+    this.setAgentMetrics(host);
   },
   /**
    * Show Flume agent metric.
@@ -138,19 +114,19 @@ App.MainDashboardServiceFlumeView = App.TableView.extend({
    * @method setFlumeAgentMetric
    * @param {object} agent - DS.model of agent
    */
-  setAgentMetrics: function(agent) {
+  setAgentMetrics: function(host) {
     var getMetricTitle = function(metricTypeKey, hostName) {
       var metricType = Em.I18n.t('services.service.info.metrics.flume.' + metricTypeKey).format(Em.I18n.t('common.metrics'));
       return  metricType + ' - ' + hostName;
     };
     var gangliaUrlTpl = App.router.get('clusterController.gangliaUrl') + '/?r=hour&cs=&ce=&m=load_one&s=by+name&c=HDPFlumeServer&h={0}&host_regex=&max_graphs=0&tab=m&vn=&sh=1&z=small&hc=4';
-    var agentHostMock = agent.get('hostName');
+    var agentHostMock = host.get('hostName');
     var mockMetricData = [
       {
         header: 'channelName',
         metricView: App.MainServiceInfoFlumeGraphsView.extend(),
         metricViewData: {
-          agent: agent,
+          agent: host,
           metricType: 'CHANNEL'
         }
       },
@@ -158,7 +134,7 @@ App.MainDashboardServiceFlumeView = App.TableView.extend({
         header: 'sinkName',
         metricView: App.MainServiceInfoFlumeGraphsView.extend(),
         metricViewData: {
-          agent: agent,
+          agent: host,
           metricType: 'SINK'
         }
       },
@@ -166,7 +142,7 @@ App.MainDashboardServiceFlumeView = App.TableView.extend({
         header: 'sourceName',
         metricView: App.MainServiceInfoFlumeGraphsView.extend(),
         metricViewData: {
-          agent: agent,
+          agent: host,
           metricType: 'SOURCE'
         }
       }


Mime
View raw message