Skip to content

Commit 6762b3d

Browse files
committed
use proper theme$ for devtool's mount
1 parent 22719be commit 6762b3d

2 files changed

Lines changed: 9 additions & 7 deletions

File tree

src/plugins/dev_tools/public/application.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,23 @@
77
*/
88

99
import React, { useEffect, useRef } from 'react';
10-
import { EMPTY } from 'rxjs';
10+
import { Observable } from 'rxjs';
1111
import ReactDOM from 'react-dom';
1212
import { HashRouter as Router, Switch, Route, Redirect } from 'react-router-dom';
1313
import { EuiTab, EuiTabs, EuiToolTip } from '@elastic/eui';
1414
import { I18nProvider } from '@kbn/i18n/react';
1515
import { i18n } from '@kbn/i18n';
1616
import { euiThemeVars } from '@kbn/ui-shared-deps-src/theme';
1717

18-
import { ApplicationStart, ChromeStart, ScopedHistory } from 'src/core/public';
18+
import { ApplicationStart, ChromeStart, ScopedHistory, CoreTheme } from 'src/core/public';
1919

2020
import { DevToolApp } from './dev_tool';
2121

2222
interface DevToolsWrapperProps {
2323
devTools: readonly DevToolApp[];
2424
activeDevTool: DevToolApp;
2525
updateRoute: (newRoute: string) => void;
26+
theme$: Observable<CoreTheme>;
2627
}
2728

2829
interface MountedDevToolDescriptor {
@@ -31,7 +32,7 @@ interface MountedDevToolDescriptor {
3132
unmountHandler: () => void;
3233
}
3334

34-
function DevToolsWrapper({ devTools, activeDevTool, updateRoute }: DevToolsWrapperProps) {
35+
function DevToolsWrapper({ devTools, activeDevTool, updateRoute, theme$ }: DevToolsWrapperProps) {
3536
const mountedTool = useRef<MountedDevToolDescriptor | null>(null);
3637

3738
useEffect(
@@ -85,8 +86,7 @@ function DevToolsWrapper({ devTools, activeDevTool, updateRoute }: DevToolsWrapp
8586
setHeaderActionMenu: () => undefined,
8687
// TODO: adapt to use Core's ScopedHistory
8788
history: {} as any,
88-
// TODO: adapt to use Core's theme
89-
theme$: EMPTY,
89+
theme$,
9090
};
9191

9292
const unmountHandler = await activeDevTool.mount(params);
@@ -151,6 +151,7 @@ export function renderApp(
151151
application: ApplicationStart,
152152
chrome: ChromeStart,
153153
history: ScopedHistory,
154+
theme$: Observable<CoreTheme>,
154155
devTools: readonly DevToolApp[]
155156
) {
156157
if (redirectOnMissingCapabilities(application)) {
@@ -178,6 +179,7 @@ export function renderApp(
178179
updateRoute={props.history.push}
179180
activeDevTool={devTool}
180181
devTools={devTools}
182+
theme$={theme$}
181183
/>
182184
)}
183185
/>

src/plugins/dev_tools/public/plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ export class DevToolsPlugin implements Plugin<DevToolsSetup, void> {
5353
order: 9010,
5454
category: DEFAULT_APP_CATEGORIES.management,
5555
mount: async (params: AppMountParameters) => {
56-
const { element, history } = params;
56+
const { element, history, theme$ } = params;
5757
element.classList.add('devAppWrapper');
5858

5959
const [core] = await getStartServices();
6060
const { application, chrome } = core;
6161

6262
const { renderApp } = await import('./application');
63-
return renderApp(element, application, chrome, history, this.getSortedDevTools());
63+
return renderApp(element, application, chrome, history, theme$, this.getSortedDevTools());
6464
},
6565
});
6666

0 commit comments

Comments
 (0)