mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
[Spaces] Support for query params in next route when entering space (#184858)
## Summary Added support for query params in next route when entering space. ### Checklist - [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios ### For maintainers - [x] This was checked for breaking API changes and was [labeled appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) __Fixes: https://github.com/elastic/kibana/issues/184857__
This commit is contained in:
parent
318f153290
commit
15424370e1
2 changed files with 9 additions and 2 deletions
|
@ -198,6 +198,13 @@ describe('Enter Space view routes', () => {
|
|||
},
|
||||
expectedLocation: '/mock-server-basepath/app/management/kibana/home',
|
||||
},
|
||||
{
|
||||
query: {
|
||||
next: '/app/management/kibana/objects?initialQuery=type:(visualization)',
|
||||
},
|
||||
expectedLocation:
|
||||
'/mock-server-basepath/app/management/kibana/objects?initialQuery=type:(visualization)',
|
||||
},
|
||||
]) {
|
||||
const request = httpServerMock.createKibanaRequest({
|
||||
query,
|
||||
|
|
|
@ -42,11 +42,11 @@ export function initSpacesViewsRoutes(deps: ViewRouteDeps) {
|
|||
|
||||
const route = nextCandidateRoute === '/' ? defaultRoute : nextCandidateRoute;
|
||||
// need to get reed of ../../ to make sure we will not be out of space basePath
|
||||
const normalizedRoute = new URL(route, 'https://localhost').pathname;
|
||||
const normalizedRoute = new URL(route, 'https://localhost');
|
||||
|
||||
return response.redirected({
|
||||
headers: {
|
||||
location: `${basePath}${normalizedRoute}`,
|
||||
location: `${basePath}${normalizedRoute.pathname}${normalizedRoute.search}`,
|
||||
},
|
||||
});
|
||||
} catch (e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue