Skip to content

Commit

Permalink
[AO] Add eui error boundary to observability pages (elastic#152786)
Browse files Browse the repository at this point in the history
  • Loading branch information
maryam-saeidi authored and bmorelli25 committed Mar 10, 2023
1 parent a868ed5 commit a5d88e9
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 43 deletions.
73 changes: 38 additions & 35 deletions x-pack/plugins/observability/public/application/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import { EuiErrorBoundary } from '@elastic/eui';
import React from 'react';
import ReactDOM from 'react-dom';
import { Router, Switch } from 'react-router-dom';
Expand Down Expand Up @@ -87,43 +88,45 @@ export const renderApp = ({
const ApplicationUsageTrackingProvider =
usageCollection?.components.ApplicationUsageTrackingProvider ?? React.Fragment;
ReactDOM.render(
<ApplicationUsageTrackingProvider>
<KibanaThemeProvider theme$={theme$}>
<KibanaContextProvider
services={{
...core,
...plugins,
storage: new Storage(localStorage),
isDev,
kibanaVersion,
}}
>
<PluginContext.Provider
value={{
config,
appMountParameters,
observabilityRuleTypeRegistry,
ObservabilityPageTemplate,
<EuiErrorBoundary>
<ApplicationUsageTrackingProvider>
<KibanaThemeProvider theme$={theme$}>
<KibanaContextProvider
services={{
...core,
...plugins,
storage: new Storage(localStorage),
isDev,
kibanaVersion,
}}
>
<Router history={history}>
<EuiThemeProvider darkMode={isDarkMode}>
<i18nCore.Context>
<RedirectAppLinks application={core.application} className={APP_WRAPPER_CLASS}>
<QueryClientProvider client={queryClient}>
<HasDataContextProvider>
<App />
</HasDataContextProvider>
<ReactQueryDevtools />
</QueryClientProvider>
</RedirectAppLinks>
</i18nCore.Context>
</EuiThemeProvider>
</Router>
</PluginContext.Provider>
</KibanaContextProvider>
</KibanaThemeProvider>
</ApplicationUsageTrackingProvider>,
<PluginContext.Provider
value={{
config,
appMountParameters,
observabilityRuleTypeRegistry,
ObservabilityPageTemplate,
}}
>
<Router history={history}>
<EuiThemeProvider darkMode={isDarkMode}>
<i18nCore.Context>
<RedirectAppLinks application={core.application} className={APP_WRAPPER_CLASS}>
<QueryClientProvider client={queryClient}>
<HasDataContextProvider>
<App />
</HasDataContextProvider>
<ReactQueryDevtools />
</QueryClientProvider>
</RedirectAppLinks>
</i18nCore.Context>
</EuiThemeProvider>
</Router>
</PluginContext.Provider>
</KibanaContextProvider>
</KibanaThemeProvider>
</ApplicationUsageTrackingProvider>
</EuiErrorBoundary>,
element
);
return () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { EuiSideNavItemType, EuiPageSectionProps } from '@elastic/eui';
import { EuiSideNavItemType, EuiPageSectionProps, EuiErrorBoundary } from '@elastic/eui';
import { _EuiPageBottomBarProps } from '@elastic/eui/src/components/page_template/bottom_bar/page_bottom_bar';
import { i18n } from '@kbn/i18n';
import React, { useMemo } from 'react';
Expand Down Expand Up @@ -178,13 +178,15 @@ export function ObservabilityPageTemplate({
: undefined
}
>
<KibanaPageTemplate.Section
component="div"
alignment={pageTemplateProps.isEmptyState ? 'center' : 'top'}
{...pageSectionProps}
>
{children}
</KibanaPageTemplate.Section>
<EuiErrorBoundary>
<KibanaPageTemplate.Section
component="div"
alignment={pageTemplateProps.isEmptyState ? 'center' : 'top'}
{...pageSectionProps}
>
{children}
</KibanaPageTemplate.Section>
</EuiErrorBoundary>
{bottomBar && (
<KibanaPageTemplate.BottomBar {...bottomBarProps}>
{bottomBar}
Expand Down

0 comments on commit a5d88e9

Please sign in to comment.