55 */
66
77import { ApmRoute } from '@elastic/apm-rum-react' ;
8+ import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json' ;
9+ import euiLightVars from '@elastic/eui/dist/eui_theme_light.json' ;
810import React from 'react' ;
911import ReactDOM from 'react-dom' ;
1012import { Route , Router , Switch } from 'react-router-dom' ;
11- import styled , { ThemeProvider , DefaultTheme } from 'styled-components' ;
12- import euiDarkVars from '@elastic/eui/dist/eui_theme_dark.json' ;
13- import euiLightVars from '@elastic/eui/dist/eui_theme_light.json' ;
14- import { CoreStart , AppMountParameters } from '../../../../../src/core/public' ;
15- import { ApmPluginSetupDeps } from '../plugin' ;
13+ import 'react-vis/dist/style.css' ;
14+ import styled , { DefaultTheme , ThemeProvider } from 'styled-components' ;
15+ import { ConfigSchema } from '../' ;
16+ import { AppMountParameters , CoreStart } from '../../../../../src/core/public' ;
17+ import {
18+ KibanaContextProvider ,
19+ RedirectAppLinks ,
20+ useUiSetting$ ,
21+ } from '../../../../../src/plugins/kibana_react/public' ;
22+ import { AlertsContextProvider } from '../../../triggers_actions_ui/public' ;
23+ import { routes } from '../components/app/Main/route_config' ;
24+ import { ScrollToTopOnPathChange } from '../components/app/Main/ScrollToTopOnPathChange' ;
25+ import { UpdateBreadcrumbs } from '../components/app/Main/UpdateBreadcrumbs' ;
1626import { ApmPluginContext } from '../context/ApmPluginContext' ;
1727import { LicenseProvider } from '../context/LicenseContext' ;
1828import { LoadingIndicatorProvider } from '../context/LoadingIndicatorContext' ;
1929import { LocationProvider } from '../context/LocationContext' ;
2030import { MatchedRouteProvider } from '../context/MatchedRouteContext' ;
2131import { UrlParamsProvider } from '../context/UrlParamsContext' ;
22- import { AlertsContextProvider } from '../../../triggers_actions_ui/public' ;
32+ import { ApmPluginSetupDeps } from '../plugin' ;
33+ import { createCallApmApi } from '../services/rest/createCallApmApi' ;
2334import { createStaticIndexPattern } from '../services/rest/index_pattern' ;
24- import {
25- KibanaContextProvider ,
26- useUiSetting$ ,
27- } from '../../../../../src/plugins/kibana_react/public' ;
28- import { px , units } from '../style/variables' ;
29- import { UpdateBreadcrumbs } from '../components/app/Main/UpdateBreadcrumbs' ;
30- import { ScrollToTopOnPathChange } from '../components/app/Main/ScrollToTopOnPathChange' ;
31- import { routes } from '../components/app/Main/route_config' ;
32- import { history , resetHistory } from '../utils/history' ;
3335import { setHelpExtension } from '../setHelpExtension' ;
36+ import { px , units } from '../style/variables' ;
3437import { setReadonlyBadge } from '../updateBadge' ;
35- import { createCallApmApi } from '../services/rest/createCallApmApi' ;
36- import { ConfigSchema } from '..' ;
37- import 'react-vis/dist/style.css' ;
3838
3939const MainContainer = styled . div `
4040 padding: ${ px ( units . plus ) } ;
@@ -68,12 +68,12 @@ function App() {
6868export function ApmAppRoot ( {
6969 core,
7070 deps,
71- routerHistory ,
71+ history ,
7272 config,
7373} : {
7474 core : CoreStart ;
7575 deps : ApmPluginSetupDeps ;
76- routerHistory : typeof history ;
76+ history : AppMountParameters [ ' history' ] ;
7777 config : ConfigSchema ;
7878} ) {
7979 const i18nCore = core . i18n ;
@@ -84,36 +84,38 @@ export function ApmAppRoot({
8484 plugins,
8585 } ;
8686 return (
87- < ApmPluginContext . Provider value = { apmPluginContextValue } >
88- < AlertsContextProvider
89- value = { {
90- http : core . http ,
91- docLinks : core . docLinks ,
92- capabilities : core . application . capabilities ,
93- toastNotifications : core . notifications . toasts ,
94- actionTypeRegistry : plugins . triggers_actions_ui . actionTypeRegistry ,
95- alertTypeRegistry : plugins . triggers_actions_ui . alertTypeRegistry ,
96- } }
97- >
98- < KibanaContextProvider services = { { ...core , ...plugins } } >
99- < i18nCore . Context >
100- < Router history = { routerHistory } >
101- < LocationProvider >
102- < MatchedRouteProvider routes = { routes } >
103- < UrlParamsProvider >
104- < LoadingIndicatorProvider >
105- < LicenseProvider >
106- < App />
107- </ LicenseProvider >
108- </ LoadingIndicatorProvider >
109- </ UrlParamsProvider >
110- </ MatchedRouteProvider >
111- </ LocationProvider >
112- </ Router >
113- </ i18nCore . Context >
114- </ KibanaContextProvider >
115- </ AlertsContextProvider >
116- </ ApmPluginContext . Provider >
87+ < RedirectAppLinks application = { core . application } >
88+ < ApmPluginContext . Provider value = { apmPluginContextValue } >
89+ < AlertsContextProvider
90+ value = { {
91+ http : core . http ,
92+ docLinks : core . docLinks ,
93+ capabilities : core . application . capabilities ,
94+ toastNotifications : core . notifications . toasts ,
95+ actionTypeRegistry : plugins . triggers_actions_ui . actionTypeRegistry ,
96+ alertTypeRegistry : plugins . triggers_actions_ui . alertTypeRegistry ,
97+ } }
98+ >
99+ < KibanaContextProvider services = { { ...core , ...plugins } } >
100+ < i18nCore . Context >
101+ < Router history = { history } >
102+ < LocationProvider >
103+ < MatchedRouteProvider routes = { routes } >
104+ < UrlParamsProvider >
105+ < LoadingIndicatorProvider >
106+ < LicenseProvider >
107+ < App />
108+ </ LicenseProvider >
109+ </ LoadingIndicatorProvider >
110+ </ UrlParamsProvider >
111+ </ MatchedRouteProvider >
112+ </ LocationProvider >
113+ </ Router >
114+ </ i18nCore . Context >
115+ </ KibanaContextProvider >
116+ </ AlertsContextProvider >
117+ </ ApmPluginContext . Provider >
118+ </ RedirectAppLinks >
117119 ) ;
118120}
119121
@@ -124,7 +126,7 @@ export function ApmAppRoot({
124126export const renderApp = (
125127 core : CoreStart ,
126128 deps : ApmPluginSetupDeps ,
127- { element } : AppMountParameters ,
129+ { element, history } : AppMountParameters ,
128130 config : ConfigSchema
129131) => {
130132 // render APM feedback link in global help menu
@@ -133,21 +135,14 @@ export const renderApp = (
133135
134136 createCallApmApi ( core . http ) ;
135137
136- resetHistory ( ) ;
137-
138138 // Automatically creates static index pattern and stores as saved object
139139 createStaticIndexPattern ( ) . catch ( ( e ) => {
140140 // eslint-disable-next-line no-console
141141 console . log ( 'Error creating static index pattern' , e ) ;
142142 } ) ;
143143
144144 ReactDOM . render (
145- < ApmAppRoot
146- core = { core }
147- deps = { deps }
148- routerHistory = { history }
149- config = { config }
150- /> ,
145+ < ApmAppRoot core = { core } deps = { deps } history = { history } config = { config } /> ,
151146 element
152147 ) ;
153148 return ( ) => {
0 commit comments