Repository: ambari Updated Branches: refs/heads/branch-2.1 55a4837b0 -> 492c435a5
AMBARI-13546. Flume graph popups are closing only from second time. (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/492c435a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/492c435a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/492c435a Branch: refs/heads/branch-2.1 Commit: 492c435a533b04b9cefe0e18fa3718dbe5b4b235 Parents: 55a4837 Author: Aleksandr Kovalenko <akovale...@hortonworks.com> Authored: Fri Oct 23 18:37:15 2015 +0300 Committer: Aleksandr Kovalenko <akovale...@hortonworks.com> Committed: Fri Oct 23 20:59:30 2015 +0300 ---------------------------------------------------------------------- .../app/views/common/chart/linear_time.js | 6 ++--- .../test/views/common/chart/linear_time_test.js | 25 ++++++++++++-------- 2 files changed, 17 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/492c435a/ambari-web/app/views/common/chart/linear_time.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/views/common/chart/linear_time.js b/ambari-web/app/views/common/chart/linear_time.js index f6e71a3..96ce4cb 100644 --- a/ambari-web/app/views/common/chart/linear_time.js +++ b/ambari-web/app/views/common/chart/linear_time.js @@ -830,8 +830,7 @@ App.ChartLinearTimeView = Ember.View.extend(App.ExportMetricsMixin, { onPrimary: function () { self.setProperties({ - currentTimeIndex: self.get('controller.isServiceWithEnhancedWidgets') === false ? - self.get('parentView.currentTimeRangeIndex') : self.get('parentView.parentView.currentTimeRangeIndex'), + currentTimeIndex: !Em.isNone(self.get('parentView.currentTimeRangeIndex')) ? self.get('parentView.currentTimeRangeIndex') : self.get('parentView.parentView.currentTimeRangeIndex'), isPopup: false }); this._super(); @@ -898,8 +897,7 @@ App.ChartLinearTimeView = Ember.View.extend(App.ExportMetricsMixin, { // should be set by time range control dropdown list when create current graph currentTimeIndex: 0, setCurrentTimeIndexFromParent: function () { - var index = this.get('controller.isServiceWithEnhancedWidgets') === false ? - this.get('parentView.currentTimeRangeIndex') : this.get('parentView.parentView.currentTimeRangeIndex'); + var index = !Em.isNone(this.get('parentView.currentTimeRangeIndex')) ? this.get('parentView.currentTimeRangeIndex') : this.get('parentView.parentView.currentTimeRangeIndex'); this.set('currentTimeIndex', index); }.observes('parentView.parentView.currentTimeRangeIndex', 'parentView.currentTimeRangeIndex'), timeUnitSeconds: function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/492c435a/ambari-web/test/views/common/chart/linear_time_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/chart/linear_time_test.js b/ambari-web/test/views/common/chart/linear_time_test.js index 0d4b200..b8475e8 100644 --- a/ambari-web/test/views/common/chart/linear_time_test.js +++ b/ambari-web/test/views/common/chart/linear_time_test.js @@ -229,18 +229,22 @@ describe('App.ChartLinearTimeView', function () { var view, cases = [ { - isServiceWithEnhancedWidgets: false, - currentTimeIndex: 1, - title: 'service with enhanced widgets' + parent: 1, + child: 2, + result: 2, + title: 'child and parent have currentTimeRangeIndex' }, { - isServiceWithEnhancedWidgets: true, - currentTimeIndex: 2, - title: 'service without enhanced widgets' + parent: undefined, + child: 2, + result: 2, + title: 'only child has currentTimeRangeIndex' }, { - currentTimeIndex: 2, - title: 'other view' + parent: 1, + child: undefined, + result: 1, + title: 'only parent has currentTimeRangeIndex' } ]; @@ -258,9 +262,10 @@ describe('App.ChartLinearTimeView', function () { cases.forEach(function (item) { it(item.title, function () { - view.set('controller.isServiceWithEnhancedWidgets', item.isServiceWithEnhancedWidgets); + view.set('parentView.currentTimeRangeIndex', item.child); + view.set('parentView.parentView.currentTimeRangeIndex', item.parent); view.propertyDidChange('parentView.currentTimeRangeIndex'); - expect(view.get('currentTimeIndex')).to.equal(item.currentTimeIndex); + expect(view.get('currentTimeIndex')).to.equal(item.result); }); });