mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
Add react-router-dom-v5-compat (#159173)
## Summary Prep work for bumping react-router to v6 Following https://github.com/remix-run/react-router/discussions/8753 --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
2fba1b651e
commit
09577fa0af
42 changed files with 715 additions and 613 deletions
|
@ -10,6 +10,7 @@ import React from 'react';
|
|||
import ReactDOM from 'react-dom';
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { Router, Switch, Route, Redirect } from 'react-router-dom';
|
||||
import { CompatRouter } from 'react-router-dom-v5-compat';
|
||||
import { RedirectAppLinks } from '@kbn/shared-ux-link-redirect-app';
|
||||
import { EuiPageTemplate, EuiSideNav } from '@elastic/eui';
|
||||
import { AppMountParameters, CoreStart } from '@kbn/core/public';
|
||||
|
@ -24,50 +25,52 @@ export const renderApp = (
|
|||
) => {
|
||||
ReactDOM.render(
|
||||
<Router history={history}>
|
||||
<RedirectAppLinks coreStart={core}>
|
||||
<EuiPageTemplate offset={0}>
|
||||
<EuiPageTemplate.Sidebar>
|
||||
<EuiSideNav
|
||||
items={[
|
||||
{
|
||||
id: 'Examples',
|
||||
name: 'Examples',
|
||||
items: [
|
||||
{
|
||||
id: 'todos',
|
||||
name: 'Todo app',
|
||||
'data-test-subj': 'todosExample',
|
||||
href: '/app/contentManagementExamples/todos',
|
||||
},
|
||||
{
|
||||
id: 'msearch',
|
||||
name: 'MSearch',
|
||||
'data-test-subj': 'msearchExample',
|
||||
href: '/app/contentManagementExamples/msearch',
|
||||
},
|
||||
],
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</EuiPageTemplate.Sidebar>
|
||||
<CompatRouter>
|
||||
<RedirectAppLinks coreStart={core}>
|
||||
<EuiPageTemplate offset={0}>
|
||||
<EuiPageTemplate.Sidebar>
|
||||
<EuiSideNav
|
||||
items={[
|
||||
{
|
||||
id: 'Examples',
|
||||
name: 'Examples',
|
||||
items: [
|
||||
{
|
||||
id: 'todos',
|
||||
name: 'Todo app',
|
||||
'data-test-subj': 'todosExample',
|
||||
href: '/app/contentManagementExamples/todos',
|
||||
},
|
||||
{
|
||||
id: 'msearch',
|
||||
name: 'MSearch',
|
||||
'data-test-subj': 'msearchExample',
|
||||
href: '/app/contentManagementExamples/msearch',
|
||||
},
|
||||
],
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</EuiPageTemplate.Sidebar>
|
||||
|
||||
<EuiPageTemplate.Section>
|
||||
<Switch>
|
||||
<Redirect from="/" to="/todos" exact />
|
||||
<Route path="/todos">
|
||||
<TodoApp contentClient={contentManagement.client} />
|
||||
</Route>
|
||||
<Route path="/msearch">
|
||||
<MSearchApp
|
||||
contentClient={contentManagement.client}
|
||||
core={core}
|
||||
savedObjectsTagging={savedObjectsTaggingOss}
|
||||
/>
|
||||
</Route>
|
||||
</Switch>
|
||||
</EuiPageTemplate.Section>
|
||||
</EuiPageTemplate>
|
||||
</RedirectAppLinks>
|
||||
<EuiPageTemplate.Section>
|
||||
<Switch>
|
||||
<Redirect from="/" to="/todos" exact />
|
||||
<Route path="/todos">
|
||||
<TodoApp contentClient={contentManagement.client} />
|
||||
</Route>
|
||||
<Route path="/msearch">
|
||||
<MSearchApp
|
||||
contentClient={contentManagement.client}
|
||||
core={core}
|
||||
savedObjectsTagging={savedObjectsTaggingOss}
|
||||
/>
|
||||
</Route>
|
||||
</Switch>
|
||||
</EuiPageTemplate.Section>
|
||||
</EuiPageTemplate>
|
||||
</RedirectAppLinks>
|
||||
</CompatRouter>
|
||||
</Router>,
|
||||
element
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue