[Lens] Fix URL query loss on redirect (#81475)
This commit is contained in:
parent
2dcfe2a99f
commit
db0816f4a1
|
@ -97,9 +97,12 @@ export async function mountApp(
|
|||
|
||||
const redirectTo = (routeProps: RouteComponentProps<{ id?: string }>, savedObjectId?: string) => {
|
||||
if (!savedObjectId) {
|
||||
routeProps.history.push('/');
|
||||
routeProps.history.push({ pathname: '/', search: routeProps.history.location.search });
|
||||
} else {
|
||||
routeProps.history.push(`/edit/${savedObjectId}`);
|
||||
routeProps.history.push({
|
||||
pathname: `/edit/${savedObjectId}`,
|
||||
search: routeProps.history.location.search,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -66,5 +66,28 @@ export default function ({ getService, getPageObjects }: FtrProviderContext) {
|
|||
expect(timeRange.end).to.equal('Sep 19, 2025 @ 06:31:44.000');
|
||||
await filterBar.hasFilter('ip', '97.220.3.248', false, true);
|
||||
});
|
||||
|
||||
it('keeps time range and pinned filters after refreshing directly after saving', async () => {
|
||||
// restore defaults so visualization becomes saveable
|
||||
await security.testUser.restoreDefaults();
|
||||
await PageObjects.lens.configureDimension({
|
||||
dimension: 'lnsXY_xDimensionPanel > lns-empty-dimension',
|
||||
operation: 'date_histogram',
|
||||
field: '@timestamp',
|
||||
});
|
||||
|
||||
await PageObjects.lens.configureDimension({
|
||||
dimension: 'lnsXY_yDimensionPanel > lns-empty-dimension',
|
||||
operation: 'avg',
|
||||
field: 'bytes',
|
||||
});
|
||||
await PageObjects.lens.save('persistentcontext');
|
||||
await browser.refresh();
|
||||
await PageObjects.header.waitUntilLoadingHasFinished();
|
||||
const timeRange = await PageObjects.timePicker.getTimeConfig();
|
||||
expect(timeRange.start).to.equal('Sep 7, 2015 @ 06:31:44.000');
|
||||
expect(timeRange.end).to.equal('Sep 19, 2025 @ 06:31:44.000');
|
||||
await filterBar.hasFilter('ip', '97.220.3.248', false, true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue