ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atk...@apache.org
Subject ambari git commit: AMBARI-12215 Service Summary: failed requests to widget metrics. (atkach)
Date Wed, 01 Jul 2015 10:30:28 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 18443a0c6 -> 1fefb5f15


AMBARI-12215 Service Summary: failed requests to widget metrics. (atkach)


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

Branch: refs/heads/trunk
Commit: 1fefb5f157773f438837d3de6909481a98ccb8bc
Parents: 18443a0
Author: Andrii Tkach <atkach@hortonworks.com>
Authored: Wed Jul 1 13:29:37 2015 +0300
Committer: Andrii Tkach <atkach@hortonworks.com>
Committed: Wed Jul 1 13:29:37 2015 +0300

----------------------------------------------------------------------
 .../app/mixins/common/widgets/widget_mixin.js   |  4 +++-
 .../test/mixins/common/widget_mixin_test.js     | 23 ++++++++++++++++----
 2 files changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1fefb5f1/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 961ce7d..5946e31 100644
--- a/ambari-web/app/mixins/common/widgets/widget_mixin.js
+++ b/ambari-web/app/mixins/common/widgets/widget_mixin.js
@@ -736,6 +736,8 @@ App.WidgetLoadAggregator = Em.Object.create({
     var self = this;
     for (var id in bulks) {
       (function (_request) {
+        if (_request.context.get('state') !== 'inDOM') return;
+
         _request.data.metric_paths = self.arrayUtils.uniqObjectsbyId(_request.data.metric_paths,
"id");
         _request.context[_request.startCallName].call(_request.context, _request.data).done(function
(response) {
           _request.subRequests.forEach(function (subRequest) {
@@ -749,4 +751,4 @@ App.WidgetLoadAggregator = Em.Object.create({
       })(bulks[id]);
     }
   }
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/1fefb5f1/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 1881d98..1a70dc8 100644
--- a/ambari-web/test/mixins/common/widget_mixin_test.js
+++ b/ambari-web/test/mixins/common/widget_mixin_test.js
@@ -458,14 +458,15 @@ describe('App.WidgetLoadAggregator', function () {
   });
 
   describe("#runRequests()", function () {
-    var mock = {
+    var mock = Em.Object.create({
       f1: function () {
         return {
           done: Em.K,
           complete: Em.K
         }
-      }
-    };
+      },
+      state: 'inDOM'
+    });
     beforeEach(function () {
       sinon.stub(aggregator, 'groupRequests', function (requests) {
         return requests;
@@ -476,7 +477,7 @@ describe('App.WidgetLoadAggregator', function () {
       aggregator.groupRequests.restore();
       mock.f1.restore();
     });
-    it("", function () {
+    it("view in DOM", function () {
       var requests = {
         'r1': {
           data: {
@@ -489,5 +490,19 @@ describe('App.WidgetLoadAggregator', function () {
       aggregator.runRequests(requests);
       expect(mock.f1.calledWith(requests['r1'].data)).to.be.true;
     });
+    it("view destroyed", function () {
+      var requests = {
+        'r1': {
+          data: {
+            metric_paths: ['m1', 'm1', 'm2']
+          },
+          context: mock,
+          startCallName: 'f1'
+        }
+      };
+      mock.set('state', 'destroyed');
+      aggregator.runRequests(requests);
+      expect(mock.f1.called).to.be.false;
+    });
   });
 });


Mime
View raw message