ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-16183. Metrics widgets update is invoked after Cancel action in Custom time range popup (alexantonenko)
Date Fri, 29 Apr 2016 14:04:35 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk fdd07bd81 -> ce279f7d8


AMBARI-16183. Metrics widgets update is invoked after Cancel action in Custom time range popup
(alexantonenko)


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

Branch: refs/heads/trunk
Commit: ce279f7d8fe8a7b2f265436ba5593a7cb2da8a4d
Parents: fdd07bd
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Fri Apr 29 16:21:49 2016 +0300
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Fri Apr 29 17:04:28 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/mixins/common/widgets/time_range_mixin.js  |  3 ++-
 .../test/mixins/common/widgets/time_range_mixin_test.js   | 10 ++++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ce279f7d/ambari-web/app/mixins/common/widgets/time_range_mixin.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/widgets/time_range_mixin.js b/ambari-web/app/mixins/common/widgets/time_range_mixin.js
index e2ac94a..0553a8e 100644
--- a/ambari-web/app/mixins/common/widgets/time_range_mixin.js
+++ b/ambari-web/app/mixins/common/widgets/time_range_mixin.js
@@ -101,6 +101,7 @@ App.TimeRangeMixin = Em.Mixin.create({
         if (callback) {
           callback();
         }
+        this.set('currentTimeRangeIndex', index);
         this.setProperties(timeRange);
         if (context) {
           context.setProperties(timeRange);
@@ -141,13 +142,13 @@ App.TimeRangeMixin = Em.Mixin.create({
     } else {
       // Preset time range is specified by user
       this.setProperties({
+        currentTimeRangeIndex: index,
         customStartTime: null,
         customEndTime: null,
         customDurationFormatted: null
       });
     }
 
-    this.set('currentTimeRangeIndex', index);
   },
 
   timeRangeListView: App.TimeRangeListView.extend()

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce279f7d/ambari-web/test/mixins/common/widgets/time_range_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/widgets/time_range_mixin_test.js b/ambari-web/test/mixins/common/widgets/time_range_mixin_test.js
index 39ce6f1..4991a8c 100644
--- a/ambari-web/test/mixins/common/widgets/time_range_mixin_test.js
+++ b/ambari-web/test/mixins/common/widgets/time_range_mixin_test.js
@@ -49,12 +49,14 @@ describe('App.TimeRangeMixin', function () {
     var indexCases = [
         {
           index: 1,
+          currentTimeRangeIndex: 1,
           showCustomDatePopupCallCount: 0,
           title: 'preset time range',
           popupTestTitle: 'popup should not be displayed'
         },
         {
           index: 8,
+          currentTimeRangeIndex: 0,
           showCustomDatePopupCallCount: 1,
           title: 'custom time range',
           popupTestTitle: 'popup should be displayed'
@@ -63,6 +65,7 @@ describe('App.TimeRangeMixin', function () {
       rangeCases = [
         {
           index: 1,
+          currentTimeRangeIndex: 1,
           customStartTime: null,
           customEndTime: null,
           customDurationFormatted: null,
@@ -71,6 +74,7 @@ describe('App.TimeRangeMixin', function () {
         },
         {
           index: 8,
+          currentTimeRangeIndex: 0,
           customStartTime: 1,
           customEndTime: 1,
           customDurationFormatted: '1 hour',
@@ -80,6 +84,7 @@ describe('App.TimeRangeMixin', function () {
       ];
 
     beforeEach(function () {
+      obj.set('currentTimeRangeIndex', 0);
       sinon.stub(timeRangePopup, 'showCustomDatePopup', Em.K);
     });
 
@@ -100,7 +105,7 @@ describe('App.TimeRangeMixin', function () {
         });
 
         it('should set time range', function () {
-          expect(obj.get('currentTimeRangeIndex')).to.equal(item.index);
+          expect(obj.get('currentTimeRangeIndex')).to.equal(item.currentTimeRangeIndex);
         });
 
         it(item.popupTestTitle, function () {
@@ -129,7 +134,8 @@ describe('App.TimeRangeMixin', function () {
         });
 
         it(item.testTitle, function () {
-          expect(obj.getProperties(['customStartTime', 'customEndTime', 'customDurationFormatted'])).to.eql({
+          expect(obj.getProperties(['currentTimeRangeIndex', 'customStartTime', 'customEndTime',
'customDurationFormatted'])).to.eql({
+            currentTimeRangeIndex: item.currentTimeRangeIndex,
             customStartTime: item.customStartTime,
             customEndTime: item.customEndTime,
             customDurationFormatted: item.customDurationFormatted


Mime
View raw message