You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2015/09/21 14:02:51 UTC

ambari git commit: AMBARI-13147 Heatmaps page: page hangs for a while on HDFS metrics. (atkach)

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 db89de8f2 -> 3ad59b7ee


AMBARI-13147 Heatmaps page: page hangs for a while on HDFS metrics. (atkach)


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

Branch: refs/heads/branch-2.1
Commit: 3ad59b7ee29ac563c4b3966c1b7dba01be2127c0
Parents: db89de8
Author: Andrii Tkach <at...@hortonworks.com>
Authored: Mon Sep 21 15:02:43 2015 +0300
Committer: Andrii Tkach <at...@hortonworks.com>
Committed: Mon Sep 21 15:02:43 2015 +0300

----------------------------------------------------------------------
 ambari-web/app/mixins/common/widgets/widget_mixin.js      |  2 ++
 ambari-web/app/views/common/widget/heatmap_widget_view.js | 10 ++++++++--
 ambari-web/test/mixins/common/widget_mixin_test.js        |  4 ++++
 3 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/3ad59b7e/ambari-web/app/mixins/common/widgets/widget_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/widgets/widget_mixin.js b/ambari-web/app/mixins/common/widgets/widget_mixin.js
index fcdfcb2..d003949 100644
--- a/ambari-web/app/mixins/common/widgets/widget_mixin.js
+++ b/ambari-web/app/mixins/common/widgets/widget_mixin.js
@@ -410,6 +410,8 @@ App.WidgetMixin = Ember.Mixin.create({
       expressions = [],
       match;
 
+    if (Em.isNone(input)) return expressions;
+
     while (match = pattern.exec(input.value)) {
       expressions.push(match[1]);
     }

http://git-wip-us.apache.org/repos/asf/ambari/blob/3ad59b7e/ambari-web/app/views/common/widget/heatmap_widget_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/widget/heatmap_widget_view.js b/ambari-web/app/views/common/widget/heatmap_widget_view.js
index 972797a..6c74420 100644
--- a/ambari-web/app/views/common/widget/heatmap_widget_view.js
+++ b/ambari-web/app/views/common/widget/heatmap_widget_view.js
@@ -120,6 +120,12 @@ App.HeatmapWidgetView = Em.View.extend(App.WidgetMixin, {
   computeExpression: function (expressions, metrics) {
     var hostToValueMap = {};
     var hostNames = metrics.mapProperty('hostName');
+    var metricsMap = {};
+
+    metrics.forEach(function (_metric) {
+      metricsMap[_metric.name + "_" + _metric.hostName] = _metric;
+    }, this);
+
     hostNames.forEach(function (_hostName) {
       expressions.forEach(function (_expression) {
         var validExpression = true;
@@ -128,7 +134,7 @@ App.HeatmapWidgetView = Em.View.extend(App.WidgetMixin, {
         var beforeCompute = _expression.replace(this.get('VALUE_NAME_REGEX'), function (match) {
           var _metric;
           if (window.isNaN(match)) {
-            _metric = metrics.filterProperty('name', match).findProperty('hostName', _hostName);
+            _metric = metricsMap[match + "_" + _hostName];
             if (_metric) {
               return _metric.data;
             } else {
@@ -154,4 +160,4 @@ App.HeatmapWidgetView = Em.View.extend(App.WidgetMixin, {
 
     return hostToValueMap;
   }
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/3ad59b7e/ambari-web/test/mixins/common/widget_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/widget_mixin_test.js b/ambari-web/test/mixins/common/widget_mixin_test.js
index e8416d9..efc29af 100644
--- a/ambari-web/test/mixins/common/widget_mixin_test.js
+++ b/ambari-web/test/mixins/common/widget_mixin_test.js
@@ -77,6 +77,10 @@ describe('App.WidgetMixin', function () {
         expect(mixinObject.extractExpressions(input)).to.eql(test.result);
       });
     });
+    it('input is null', function () {
+      var input = null;
+      expect(mixinObject.extractExpressions(input)).to.be.empty;
+    });
   });
 
   describe("#getRequestData()", function () {