Undo setting of $scope.refreshInterval at dashboard (#37175) (#38299)

* Add test for passing on dashboard url params to timepicker values

* Revert unnecessary setting of $scope.refreshInterval

refreshInterval is set at $scope.model, no need to set it directly at $scope like in discover and vis
This commit is contained in:
Matthias Wilhelm 2019-06-12 09:43:44 +02:00 committed by GitHub
parent 532ca99882
commit 06d1567c32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 2 deletions

View file

@ -119,8 +119,6 @@ app.directive('dashboardApp', function ($injector) {
$scope.getDashboardState = () => dashboardStateManager;
$scope.appState = dashboardStateManager.getAppState();
$scope.refreshInterval = timefilter.getRefreshInterval();
// The 'previouslyStored' check is so we only update the time filter on dashboard open, not during
// normal cross app navigation.

View file

@ -18,12 +18,14 @@
*/
import { PIE_CHART_VIS_NAME } from '../../page_objects/dashboard_page';
import expect from '@kbn/expect';
export default function ({ getService, getPageObjects }) {
const dashboardExpect = getService('dashboardExpect');
const pieChart = getService('pieChart');
const dashboardVisualizations = getService('dashboardVisualizations');
const PageObjects = getPageObjects(['dashboard', 'header', 'visualize', 'timePicker']);
const browser = getService('browser');
describe('dashboard time picker', function describeIndexTests() {
before(async function () {
@ -58,5 +60,26 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.timePicker.setAbsoluteRange('2000-01-01 00:00:00.000', '2000-01-01 01:00:00.000');
await dashboardExpect.docTableFieldCount(0);
});
it('Timepicker start, end, interval values are set by url', async () => {
await PageObjects.dashboard.gotoDashboardLandingPage();
await PageObjects.dashboard.clickNewDashboard();
await dashboardVisualizations.createAndAddSavedSearch({ name: 'saved search', fields: ['bytes', 'agent'] });
const currentUrl = await browser.getCurrentUrl();
const kibanaBaseUrl = currentUrl.substring(0, currentUrl.indexOf('#'));
const urlQuery = `/dashboard?` +
`_g=(refreshInterval:(pause:!t,value:2000),` +
`time:(from:'2012-11-17T00:00:00.000Z',mode:absolute,to:'2015-11-17T18:01:36.621Z'))&` +
`_a=(description:'',filters:!()` +
`)`;
await browser.get(`${kibanaBaseUrl}#${urlQuery}`, true);
await PageObjects.header.waitUntilLoadingHasFinished();
const time = await PageObjects.timePicker.getTimeConfig();
const refresh = await PageObjects.timePicker.getRefreshConfig();
expect(time.start).to.be('Nov 17, 2012 @ 00:00:00.000');
expect(time.end).to.be('Nov 17, 2015 @ 18:01:36.621');
expect(refresh.interval).to.be('2');
});
});
}