ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [32/33] ambari git commit: AMBARI-15085. Enhanced graph widgets aren't updated after getting no data (alexantonenko)
Date Thu, 18 Feb 2016 13:33:51 GMT
AMBARI-15085. Enhanced graph widgets aren't updated after getting no data (alexantonenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: f92714910c74336a6e797056173dc287185f5ed1
Parents: 1bd4c23
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Thu Feb 18 12:03:54 2016 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Thu Feb 18 13:14:49 2016 +0200

----------------------------------------------------------------------
 .../app/mixins/common/widgets/widget_mixin.js   |  8 +++--
 .../test/mixins/common/widget_mixin_test.js     | 35 +++++++++++++++-----
 2 files changed, 33 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f9271491/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 13e55f2..4d777e4 100644
--- a/ambari-web/app/mixins/common/widgets/widget_mixin.js
+++ b/ambari-web/app/mixins/common/widgets/widget_mixin.js
@@ -318,7 +318,9 @@ App.WidgetMixin = Ember.Mixin.create({
             graph.set('hasData', false);
             this.set('isExportButtonHidden', true);
             graph._showMessage('info', this.t('graphs.noData.title'), this.t('graphs.noDataAtTime.message'));
-            this.get('metrics').clear();
+            this.set('metrics', this.get('metrics').reject(function (item) {
+              return this.get('content.metrics').someProperty('name', item.name);
+            }, this));
           }
         }
       }, this);
@@ -341,7 +343,9 @@ App.WidgetMixin = Ember.Mixin.create({
         graph.set('hasData', false);
         this.set('isExportButtonHidden', true);
         graph._showMessage('warn', this.t('graphs.error.title'), this.t('graphs.error.message').format(textStatus,
errorThrown));
-        this.get('metrics').clear();
+        this.set('metrics', this.get('metrics').reject(function (item) {
+          return this.get('content.metrics').someProperty('name', item.name);
+        }, this));
       }
     }
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/f9271491/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 c70150d..662f8b8 100644
--- a/ambari-web/test/mixins/common/widget_mixin_test.js
+++ b/ambari-web/test/mixins/common/widget_mixin_test.js
@@ -391,11 +391,19 @@ describe('App.WidgetMixin', function () {
       view = Em.Object.create({
         _showMessage: Em.K
       }),
+      metrics = [
+        {
+          name: 'n0'
+        },
+        {
+          name: 'n1'
+        }
+      ],
       cases = [
         {
           graphView: null,
           isForcedAbort: false,
-          metricsLength: 1,
+          metrics: metrics,
           showMessageCallCount: 0,
           isExportButtonHidden: false,
           title: 'no graph view'
@@ -403,7 +411,7 @@ describe('App.WidgetMixin', function () {
         {
           graphView: {},
           isForcedAbort: false,
-          metricsLength: 1,
+          metrics: metrics,
           showMessageCallCount: 0,
           isExportButtonHidden: false,
           title: 'no childViews property'
@@ -412,7 +420,7 @@ describe('App.WidgetMixin', function () {
           graphView: {},
           childViews: [],
           isForcedAbort: false,
-          metricsLength: 1,
+          metrics: metrics,
           showMessageCallCount: 0,
           isExportButtonHidden: false,
           title: 'no child views'
@@ -421,7 +429,7 @@ describe('App.WidgetMixin', function () {
           graphView: {},
           childViews: [Em.Object.create({})],
           isForcedAbort: false,
-          metricsLength: 1,
+          metrics: metrics,
           showMessageCallCount: 0,
           isExportButtonHidden: false,
           title: 'no view with _showMessage method'
@@ -430,7 +438,11 @@ describe('App.WidgetMixin', function () {
           graphView: {},
           childViews: [Em.Object.create({}), view],
           isForcedAbort: false,
-          metricsLength: 0,
+          metrics: [
+            {
+              name: 'n1'
+            }
+          ],
           showMessageCallCount: 1,
           isExportButtonHidden: true,
           title: 'graph view is available'
@@ -439,7 +451,7 @@ describe('App.WidgetMixin', function () {
           graphView: {},
           childViews: [Em.Object.create({}), view],
           isForcedAbort: true,
-          metricsLength: 1,
+          metrics: metrics,
           showMessageCallCount: 0,
           isExportButtonHidden: false,
           title: 'request is aborted'
@@ -480,7 +492,14 @@ describe('App.WidgetMixin', function () {
 
         beforeEach(function () {
           obj = Em.Object.create(App.WidgetMixin, {
-            metrics: [{}],
+            metrics: metrics,
+            content: {
+              metrics: [
+                {
+                  name: 'n0'
+                }
+              ]
+            },
             isExportButtonHidden: false,
             graphView: item.graphView,
             childViews: item.childViews
@@ -491,7 +510,7 @@ describe('App.WidgetMixin', function () {
         });
 
         it('metrics array', function () {
-          expect(obj.get('metrics')).to.have.length(item.metricsLength);
+          expect(obj.get('metrics')).to.eql(item.metrics);
         });
 
         it('error message', function () {


Mime
View raw message