[Discover] Fix navigating back when changing index pattern (#84061)
This commit is contained in:
parent
b246701d39
commit
f0192c1c03
|
@ -252,7 +252,8 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise
|
|||
if (!_.isEqual(newStatePartial, oldStatePartial)) {
|
||||
$scope.$evalAsync(async () => {
|
||||
if (oldStatePartial.index !== newStatePartial.index) {
|
||||
//in case of index switch the route has currently to be reloaded, legacy
|
||||
//in case of index pattern switch the route has currently to be reloaded, legacy
|
||||
$route.reload();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -289,8 +290,7 @@ function discoverController($element, $route, $scope, $timeout, $window, Promise
|
|||
$scope.state.sort,
|
||||
config.get(MODIFY_COLUMNS_ON_SWITCH)
|
||||
);
|
||||
await replaceUrlAppState(nextAppState);
|
||||
$route.reload();
|
||||
await setAppState(nextAppState);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
||||
export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
||||
const browser = getService('browser');
|
||||
const esArchiver = getService('esArchiver');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
const security = getService('security');
|
||||
|
@ -50,5 +51,21 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
throw new Error('Expected timepicker to exist');
|
||||
}
|
||||
});
|
||||
it('should switch between with and without timefield using the browser back button', async () => {
|
||||
await PageObjects.discover.selectIndexPattern('without-timefield');
|
||||
if (await PageObjects.timePicker.timePickerExists()) {
|
||||
throw new Error('Expected timepicker not to exist');
|
||||
}
|
||||
|
||||
await PageObjects.discover.selectIndexPattern('with-timefield');
|
||||
if (!(await PageObjects.timePicker.timePickerExists())) {
|
||||
throw new Error('Expected timepicker to exist');
|
||||
}
|
||||
// Navigating back to discover
|
||||
await browser.goBack();
|
||||
if (await PageObjects.timePicker.timePickerExists()) {
|
||||
throw new Error('Expected timepicker not to exist');
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue