From abed8840fef56041606ef3171e1e5ef9809105d4 Mon Sep 17 00:00:00 2001 From: Matthias Wilhelm Date: Wed, 14 Aug 2019 18:12:29 +0200 Subject: [PATCH] Restore discover histogram selection triggering fetch (#43097) * Listen to timefilter fetch event to start fetching * Improve functional test to catch error --- .../kibana/public/discover/controllers/discover.js | 1 + test/functional/apps/discover/_discover.js | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/legacy/core_plugins/kibana/public/discover/controllers/discover.js b/src/legacy/core_plugins/kibana/public/discover/controllers/discover.js index 377fd72e9c771..433a42c687373 100644 --- a/src/legacy/core_plugins/kibana/public/discover/controllers/discover.js +++ b/src/legacy/core_plugins/kibana/public/discover/controllers/discover.js @@ -550,6 +550,7 @@ function discoverController( $scope.$listen(timefilter, 'autoRefreshFetch', $scope.fetch); $scope.$listen(timefilter, 'refreshIntervalUpdate', $scope.updateRefreshInterval); $scope.$listen(timefilter, 'timeUpdate', $scope.updateTime); + $scope.$listen(timefilter, 'fetch', $scope.fetch); $scope.$watchCollection('state.sort', function (sort) { if (!sort) return; diff --git a/test/functional/apps/discover/_discover.js b/test/functional/apps/discover/_discover.js index 1b2ddf22e7a69..5b6652843af0b 100644 --- a/test/functional/apps/discover/_discover.js +++ b/test/functional/apps/discover/_discover.js @@ -147,6 +147,8 @@ export default function ({ getService, getPageObjects }) { const time = await PageObjects.timePicker.getTimeConfig(); expect(time.start).to.be('Sep 20, 2015 @ 00:00:00.000'); expect(time.end).to.be('Sep 20, 2015 @ 03:00:00.000'); + const rowData = await PageObjects.discover.getDocTableIndex(1); + expect(rowData).to.have.string('Sep 20, 2015 @ 02:57:03.761'); }); it('should modify the time range when the histogram is brushed', async function () { @@ -156,9 +158,9 @@ export default function ({ getService, getPageObjects }) { await PageObjects.visualize.waitForVisualization(); const newDurationHours = await PageObjects.timePicker.getTimeDurationInHours(); - if (newDurationHours < 1 || newDurationHours >= 5) { - throw new Error(`expected new duration of ${newDurationHours} hours to be between 1 and 5 hours`); - } + expect(Math.round(newDurationHours)).to.be(3); + const rowData = await PageObjects.discover.getDocTableIndex(1); + expect(rowData).to.have.string('Sep 20, 2015 @ 02:56:02.323'); }); it('should show correct initial chart interval of Auto', async function () {