Skip to content

Commit

Permalink
[APM] Wrap APM/UX apps in KibanaThemeProvider (elastic#123910)
Browse files Browse the repository at this point in the history
  • Loading branch information
dgieselaar authored and awahab07 committed Jan 31, 2022
1 parent 6ff4172 commit 69de24f
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions x-pack/plugins/apm/public/application/application.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ describe('renderApp (APM)', () => {
element: document.createElement('div'),
history: createMemoryHistory(),
setHeaderActionMenu: () => {},
theme$: new Observable(),
};

const data = dataPluginMock.createStartContract();
Expand Down
13 changes: 8 additions & 5 deletions x-pack/plugins/apm/public/application/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { createStaticDataView } from '../services/rest/data_view';
import { setHelpExtension } from '../setHelpExtension';
import { setReadonlyBadge } from '../updateBadge';
import { ApmAppRoot } from '../components/routing/app_root';
import { KibanaThemeProvider } from '../../../../../src/plugins/kibana_react/public';

/**
* This module is rendered asynchronously in the Kibana platform.
Expand All @@ -41,7 +42,7 @@ export const renderApp = ({
pluginsStart: ApmPluginStartDeps;
observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry;
}) => {
const { element } = appMountParameters;
const { element, theme$ } = appMountParameters;
const apmPluginContextValue = {
appMountParameters,
config,
Expand All @@ -68,10 +69,12 @@ export const renderApp = ({
element.classList.add(APP_WRAPPER_CLASS);

ReactDOM.render(
<ApmAppRoot
apmPluginContextValue={apmPluginContextValue}
pluginsStart={pluginsStart}
/>,
<KibanaThemeProvider theme$={theme$}>
<ApmAppRoot
apmPluginContextValue={apmPluginContextValue}
pluginsStart={pluginsStart}
/>
</KibanaThemeProvider>,
element
);
return () => {
Expand Down
21 changes: 12 additions & 9 deletions x-pack/plugins/apm/public/application/uxApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import {
} from '../../../observability/public';
import { useApmPluginContext } from '../context/apm_plugin/use_apm_plugin_context';
import { APP_WRAPPER_CLASS } from '../../../../../src/core/public';
import { KibanaThemeProvider } from '../../../../../src/plugins/kibana_react/public';

export const uxRoutes: APMRouteDefinition[] = [
{
Expand Down Expand Up @@ -166,7 +167,7 @@ export const renderApp = ({
corePlugins: ApmPluginStartDeps;
observabilityRuleTypeRegistry: ObservabilityRuleTypeRegistry;
}) => {
const { element } = appMountParameters;
const { element, theme$ } = appMountParameters;

createCallApmApi(core);

Expand All @@ -177,14 +178,16 @@ export const renderApp = ({
});

ReactDOM.render(
<UXAppRoot
appMountParameters={appMountParameters}
core={core}
deps={deps}
config={config}
corePlugins={corePlugins}
observabilityRuleTypeRegistry={observabilityRuleTypeRegistry}
/>,
<KibanaThemeProvider theme$={theme$}>
<UXAppRoot
appMountParameters={appMountParameters}
core={core}
deps={deps}
config={config}
corePlugins={corePlugins}
observabilityRuleTypeRegistry={observabilityRuleTypeRegistry}
/>
</KibanaThemeProvider>,
element
);
return () => {
Expand Down

0 comments on commit 69de24f

Please sign in to comment.