Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EAB8818265 for ; Thu, 5 Nov 2015 14:00:10 +0000 (UTC) Received: (qmail 62108 invoked by uid 500); 5 Nov 2015 14:00:10 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 62076 invoked by uid 500); 5 Nov 2015 14:00:10 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 62063 invoked by uid 99); 5 Nov 2015 14:00:10 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Nov 2015 14:00:10 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 524D8E09C9; Thu, 5 Nov 2015 14:00:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: alexantonenko@apache.org To: commits@ambari.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: ambari git commit: AMBARI-13742. Flume Agent metrics graphs issues Date: Thu, 5 Nov 2015 14:00:10 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/branch-2.1 b4b7df682 -> ade07b3af AMBARI-13742. Flume Agent metrics graphs issues Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ade07b3a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ade07b3a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ade07b3a Branch: refs/heads/branch-2.1 Commit: ade07b3afc7fd774dee7603c02524d949af9e83f Parents: b4b7df6 Author: Alex Antonenko Authored: Thu Nov 5 15:58:11 2015 +0200 Committer: Alex Antonenko Committed: Thu Nov 5 16:00:05 2015 +0200 ---------------------------------------------------------------------- ambari-web/app/assets/test/tests.js | 1 + ambari-web/app/styles/application.less | 3 + .../flume/flume_agent_metrics_section.hbs | 40 +++++++++++++ .../app/templates/main/service/info/summary.hbs | 21 +------ ambari-web/app/views.js | 1 + .../flume/flume_agent_metrics_section.js | 45 +++++++++++++++ .../app/views/main/service/services/flume.js | 38 +++++------- .../flume/flume_agent_metrics_section_test.js | 61 ++++++++++++++++++++ 8 files changed, 166 insertions(+), 44 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/ade07b3a/ambari-web/app/assets/test/tests.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js index 09b782b..ad5e9ec 100644 --- a/ambari-web/app/assets/test/tests.js +++ b/ambari-web/app/assets/test/tests.js @@ -255,6 +255,7 @@ var files = ['test/init_model_test', 'test/views/main/service/info/config_test', 'test/views/main/service/info/summary_test', 'test/views/main/service/info/metrics/ambari_metrics/regionserver_base_test', + 'test/views/main/service/info/metrics/flume/flume_agent_metrics_section_test', 'test/views/main/service/services/ranger_test', 'test/views/main/service/widgets/create/expression_view_test', 'test/views/main/admin/highAvailability/nameNode/step1_view_test', http://git-wip-us.apache.org/repos/asf/ambari/blob/ade07b3a/ambari-web/app/styles/application.less ---------------------------------------------------------------------- diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less index 8c20e6e..b85107c 100644 --- a/ambari-web/app/styles/application.less +++ b/ambari-web/app/styles/application.less @@ -2584,6 +2584,9 @@ a:focus { margin: 3px; } } + .accordion-body.in { + overflow: visible; + } } } http://git-wip-us.apache.org/repos/asf/ambari/blob/ade07b3a/ambari-web/app/templates/main/service/info/metrics/flume/flume_agent_metrics_section.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/service/info/metrics/flume/flume_agent_metrics_section.hbs b/ambari-web/app/templates/main/service/info/metrics/flume/flume_agent_metrics_section.hbs new file mode 100644 index 0000000..f8401ba --- /dev/null +++ b/ambari-web/app/templates/main/service/info/metrics/flume/flume_agent_metrics_section.hbs @@ -0,0 +1,40 @@ +{{! +* Licensed to the Apache Software Foundation (ASF) under one +* or more contributor license agreements. See the NOTICE file +* distributed with this work for additional information +* regarding copyright ownership. The ASF licenses this file +* to you under the Apache License, Version 2.0 (the +* "License"); you may not use this file except in compliance +* with the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +}} + +
+
+
+ + + {{view.header}} + + {{#if showTimeRangeControl}} + {{view view.timeRangeListView}} + {{/if}} +
+
+
+
+ {{#if view.metricView}} + {{view view.metricView viewDataBinding="view.metricViewData"}} + {{/if}} +
+
+
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/ade07b3a/ambari-web/app/templates/main/service/info/summary.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/service/info/summary.hbs b/ambari-web/app/templates/main/service/info/summary.hbs index b295a3b..037ab16 100644 --- a/ambari-web/app/templates/main/service/info/summary.hbs +++ b/ambari-web/app/templates/main/service/info/summary.hbs @@ -152,26 +152,7 @@
{{#each collapsedSection in view.collapsedSections}} -
-
-
- - - {{collapsedSection.header}} - - -
-
-
-
- {{#if collapsedSection.metricView}} - {{view collapsedSection.metricView viewDataBinding="collapsedSection.metricViewData"}} - {{/if}} -
-
-
-
+ {{view collapsedSection}} {{/each}}
http://git-wip-us.apache.org/repos/asf/ambari/blob/ade07b3a/ambari-web/app/views.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js index e702bbc..fe9f1fb 100644 --- a/ambari-web/app/views.js +++ b/ambari-web/app/views.js @@ -259,6 +259,7 @@ require('views/main/service/info/metrics/ambari_metrics/regionserver_block_cache require('views/main/service/info/metrics/ambari_metrics/regionserver_compaction_queue_size'); require('views/main/service/info/metrics/flume/channel_sum'); require('views/main/service/info/metrics/flume/channel_size_mma'); +require('views/main/service/info/metrics/flume/flume_agent_metrics_section'); require('views/main/service/info/metrics/flume/flume_incoming_sum'); require('views/main/service/info/metrics/flume/flume_incoming_mma'); require('views/main/service/info/metrics/flume/flume_outgoing_sum'); http://git-wip-us.apache.org/repos/asf/ambari/blob/ade07b3a/ambari-web/app/views/main/service/info/metrics/flume/flume_agent_metrics_section.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/main/service/info/metrics/flume/flume_agent_metrics_section.js b/ambari-web/app/views/main/service/info/metrics/flume/flume_agent_metrics_section.js new file mode 100644 index 0000000..43e4422 --- /dev/null +++ b/ambari-web/app/views/main/service/info/metrics/flume/flume_agent_metrics_section.js @@ -0,0 +1,45 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +var App = require('app'); + +App.FlumeAgentMetricsSectionView = Em.View.extend(App.TimeRangeMixin, { + + templateName: require('templates/main/service/info/metrics/flume/flume_agent_metrics_section'), + + index: 0, + + metricTypeKey: '', + + metricView: null, + + metricViewData: null, + + id: function () { + return 'metric' + this.get('index'); + }.property('index'), + + toggleIndex: function () { + return '#' + this.get('id'); + }.property('id'), + + header: function () { + var metricType = Em.I18n.t('services.service.info.metrics.flume.' + this.get('metricTypeKey')).format(Em.I18n.t('common.metrics')); + return metricType + ' - ' + this.get('metricViewData.agent.hostName'); + }.property('metricTypeKey', 'metricViewData.agent.hostName') + +}); http://git-wip-us.apache.org/repos/asf/ambari/blob/ade07b3a/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 f0283e9..9a150bd 100644 --- a/ambari-web/app/views/main/service/services/flume.js +++ b/ambari-web/app/views/main/service/services/flume.js @@ -18,6 +18,7 @@ var App = require('app'); var date = require('utils/date/date'); var sort = require('views/common/sort_view'); +require('views/main/service/info/metrics/flume/flume_agent_metrics_section'); App.MainDashboardServiceFlumeView = App.TableView.extend(App.MainDashboardServiceViewWrapper, { templateName: require('templates/main/service/services/flume'), @@ -148,43 +149,32 @@ App.MainDashboardServiceFlumeView = App.TableView.extend(App.MainDashboardServic * @method setFlumeAgentMetric * @param {object} agent - DS.model of 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 agentHostMock = host.get('hostName'); + setAgentMetrics: function (host) { var mockMetricData = [ { header: 'channelName', - metricView: App.MainServiceInfoFlumeGraphsView.extend(), - metricViewData: { - agent: host, - metricType: 'CHANNEL' - } + metricType: 'CHANNEL' }, { header: 'sinkName', - metricView: App.MainServiceInfoFlumeGraphsView.extend(), - metricViewData: { - agent: host, - metricType: 'SINK' - } + metricType: 'SINK' }, { header: 'sourceName', + metricType: 'SOURCE' + } + ]; + var metricViews = mockMetricData.map(function (mockData, index) { + return App.FlumeAgentMetricsSectionView.extend({ + index: index, + metricTypeKey: mockData.header, metricView: App.MainServiceInfoFlumeGraphsView.extend(), metricViewData: { agent: host, - metricType: 'SOURCE' + metricType: mockData.metricType } - } - ]; - mockMetricData.forEach(function(mockData, index) { - mockData.header = getMetricTitle(mockData.header, agentHostMock); - mockData.id = 'metric' + index; - mockData.toggleIndex = '#' + mockData.id; + }); }); - this.set('parentView.collapsedSections', mockMetricData); + this.set('parentView.collapsedSections', metricViews); } }); http://git-wip-us.apache.org/repos/asf/ambari/blob/ade07b3a/ambari-web/test/views/main/service/info/metrics/flume/flume_agent_metrics_section_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/service/info/metrics/flume/flume_agent_metrics_section_test.js b/ambari-web/test/views/main/service/info/metrics/flume/flume_agent_metrics_section_test.js new file mode 100644 index 0000000..110273b --- /dev/null +++ b/ambari-web/test/views/main/service/info/metrics/flume/flume_agent_metrics_section_test.js @@ -0,0 +1,61 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var App = require('app'); +require('views/main/service/info/metrics/flume/flume_agent_metrics_section'); + +describe('App.FlumeAgentMetricsSectionView', function () { + + var view; + + beforeEach(function () { + view = App.FlumeAgentMetricsSectionView.create(); + }); + + describe('#id', function () { + it('should be set depending on index', function () { + view.set('index', 1); + expect(view.get('id')).to.equal('metric1'); + }); + }); + + describe('#toggleIndex', function () { + it('should be set depending on id', function () { + view.reopen({ + id: 'metric1' + }); + expect(view.get('toggleIndex')).to.equal('#metric1'); + }); + }); + + describe('#header', function () { + it('should be set depending on metric type and host name', function () { + view.setProperties({ + metricTypeKey: 'sinkName', + metricViewData: { + agent: { + hostName: 'h0' + } + } + }); + expect(view.get('header')).to.equal(Em.I18n.t('services.service.info.metrics.flume.sinkName'). + format(Em.I18n.t('common.metrics')) + ' - h0'); + }); + }); + +});