Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Alerting][UI] Fixes missing EUI theme in context #121796

Merged
merged 1 commit into from
Dec 21, 2021
Merged
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
21 changes: 13 additions & 8 deletions x-pack/plugins/triggers_actions_ui/public/application/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { Switch, Route, Redirect, Router } from 'react-router-dom';
import { ChromeBreadcrumb, CoreStart, CoreTheme, ScopedHistory } from 'kibana/public';
import { render, unmountComponentAtNode } from 'react-dom';
import { I18nProvider } from '@kbn/i18n-react';
import useObservable from 'react-use/lib/useObservable';
import { Observable } from 'rxjs';
import { KibanaFeature } from '../../../features/common';
import { KibanaThemeProvider } from '../../../../../src/plugins/kibana_react/public';
Expand All @@ -22,6 +23,7 @@ import type { SpacesPluginStart } from '../../../spaces/public';

import { suspendedComponentWithProps } from './lib/suspended_component_with_props';
import { Storage } from '../../../../../src/plugins/kibana_utils/public';
import { EuiThemeProvider } from '../../../../../src/plugins/kibana_react/common';

import { setSavedObjectsClient } from '../common/lib/data_apis';
import { KibanaContextProvider } from '../common/lib/kibana';
Expand Down Expand Up @@ -56,20 +58,23 @@ export const renderApp = (deps: TriggersAndActionsUiServices) => {
};

export const App = ({ deps }: { deps: TriggersAndActionsUiServices }) => {
const { savedObjects, theme$ } = deps;
const { savedObjects, uiSettings, theme$ } = deps;
const sections: Section[] = ['rules', 'connectors'];
const isDarkMode = useObservable<boolean>(uiSettings.get$('theme:darkMode'));

const sectionsRegex = sections.join('|');
setSavedObjectsClient(savedObjects.client);
return (
<I18nProvider>
<KibanaThemeProvider theme$={theme$}>
<KibanaContextProvider services={{ ...deps }}>
<Router history={deps.history}>
<AppWithoutRouter sectionsRegex={sectionsRegex} />
</Router>
</KibanaContextProvider>
</KibanaThemeProvider>
<EuiThemeProvider darkMode={isDarkMode}>
<KibanaThemeProvider theme$={theme$}>
<KibanaContextProvider services={{ ...deps }}>
<Router history={deps.history}>
<AppWithoutRouter sectionsRegex={sectionsRegex} />
</Router>
</KibanaContextProvider>
</KibanaThemeProvider>
</EuiThemeProvider>
</I18nProvider>
);
};
Expand Down