Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions x-pack/plugins/lens/public/app_plugin/mounter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}
};

Expand Down
23 changes: 23 additions & 0 deletions x-pack/test/functional/apps/lens/persistent_context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
}