-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Discover] Fix broken setting of bucketInterval #62939
Changes from 5 commits
b0c17d3
729d8c1
005c885
8bf104a
1d47b0f
d984237
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -675,17 +675,6 @@ function discoverController( | |
} | ||
}); | ||
|
||
$scope.$watch('vis.aggs', function() { | ||
// no timefield, no vis, nothing to update | ||
if (!getTimeField() || !$scope.vis) return; | ||
|
||
const buckets = $scope.vis.data.aggs.byTypeName('buckets'); | ||
|
||
if (buckets && buckets.length === 1) { | ||
$scope.bucketInterval = buckets[0].buckets.getInterval(); | ||
} | ||
}); | ||
|
||
$scope.$watchMulti( | ||
['rows', 'fetchStatus'], | ||
(function updateResultState() { | ||
|
@@ -891,6 +880,9 @@ function discoverController( | |
tabifiedData, | ||
getDimensions($scope.vis.data.aggs.aggs, $scope.timeRange) | ||
); | ||
if ($scope.vis.data.aggs.aggs[1]) { | ||
$scope.bucketInterval = $scope.vis.data.aggs.aggs[1].buckets.getInterval(); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dear @ppisljar, this API changed. This works, but I wonder if there's a better way to do it. Before it was done this way:
|
||
} | ||
|
||
$scope.hits = resp.hits.total; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,34 +66,34 @@ export default function({ getService, getPageObjects }) { | |
}); | ||
|
||
it('should visualize monthly data with different day intervals', async () => { | ||
//Nov 1, 2017 @ 01:00:00.000 - Mar 21, 2018 @ 02:00:00.000 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. all the input time ranges in this tests where invalid, fixed that |
||
const fromTime = '2017-11-01 00:00:00.000'; | ||
const toTime = '2018-03-21 00:00:00.000'; | ||
const fromTime = 'Nov 01, 2017 @ 00:00:00.000'; | ||
const toTime = 'Mar 21, 2018 @ 00:00:00.000'; | ||
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime); | ||
await PageObjects.discover.setChartInterval('Monthly'); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
const chartCanvasExist = await elasticChart.canvasExists(); | ||
expect(chartCanvasExist).to.be(true); | ||
}); | ||
it('should visualize weekly data with within DST changes', async () => { | ||
//Nov 1, 2017 @ 01:00:00.000 - Mar 21, 2018 @ 02:00:00.000 | ||
const fromTime = '2018-03-01 00:00:00.000'; | ||
const toTime = '2018-05-01 00:00:00.000'; | ||
const fromTime = 'Mar 01, 2018 @ 00:00:00.000'; | ||
const toTime = 'May 01, 2018 @ 00:00:00.000'; | ||
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime); | ||
await PageObjects.discover.setChartInterval('Weekly'); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
const chartCanvasExist = await elasticChart.canvasExists(); | ||
expect(chartCanvasExist).to.be(true); | ||
}); | ||
it('should visualize monthly data with different years Scaled to 30d', async () => { | ||
//Nov 1, 2017 @ 01:00:00.000 - Mar 21, 2018 @ 02:00:00.000 | ||
const fromTime = '2010-01-01 00:00:00.000'; | ||
const toTime = '2018-03-21 00:00:00.000'; | ||
it('should visualize monthly data with different years Scaled to 30 days', async () => { | ||
const fromTime = 'Jan 01, 2010 @ 00:00:00.000'; | ||
const toTime = 'Mar 21, 2019 @ 00:00:00.000'; | ||
|
||
await PageObjects.timePicker.setAbsoluteRange(fromTime, toTime); | ||
await PageObjects.discover.setChartInterval('Daily'); | ||
await PageObjects.header.waitUntilLoadingHasFinished(); | ||
const chartCanvasExist = await elasticChart.canvasExists(); | ||
expect(chartCanvasExist).to.be(true); | ||
const chartIntervalScaledDesc = await PageObjects.discover.getChartIntervalScaledToDesc(); | ||
expect(chartIntervalScaledDesc).to.be('Scaled to 30 days'); | ||
}); | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The watcher didn't work due to the Visualizations API changes, decided it's even not needed and removed it in favor of a simpler solution