Skip to content

Commit

Permalink
Fix outstanding NP issues in SIEM frontend (#53735)
Browse files Browse the repository at this point in the history
* Injects all required plugins into our context provider (not just data)
* Sets defaults for two UI settings that the client doesn't know about
(and blow up when trying to retrieve).
  • Loading branch information
rylnd authored Dec 20, 2019
1 parent e08e28b commit 24c75e5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion x-pack/legacy/plugins/siem/public/apps/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ import chrome from 'ui/chrome';
import { npStart } from 'ui/new_platform';
import { Plugin } from './plugin';

const { data, embeddable, inspector, uiActions } = npStart.plugins;
const startPlugins = { data, embeddable, inspector, uiActions };

new Plugin(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
{ opaqueId: Symbol('siem'), env: {} as any, config: { get: () => ({} as any) } },
chrome
).start(npStart.core, npStart.plugins);
).start(npStart.core, startPlugins);
5 changes: 5 additions & 0 deletions x-pack/legacy/plugins/siem/public/apps/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { LegacyCoreStart, PluginInitializerContext } from 'src/core/public';
import { PluginsStart } from 'ui/new_platform/new_platform';
import { Chrome } from 'ui/chrome';

import { DEFAULT_KBN_VERSION, DEFAULT_TIMEZONE_BROWSER } from '../../common/constants';
import { SiemApp } from './start_app';
import template from './template.html';

Expand All @@ -32,6 +33,10 @@ export class Plugin {
}

public start(core: StartCore, plugins: StartPlugins) {
// TODO(rylnd): These are unknown by uiSettings by default
core.uiSettings.set(DEFAULT_KBN_VERSION, '8.0.0');
core.uiSettings.set(DEFAULT_TIMEZONE_BROWSER, 'UTC');

// @ts-ignore improper type description
this.chrome.setRootTemplate(template);
const checkForRoot = () => {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/siem/public/apps/start_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ export const SiemApp = memo<{ core: StartCore; plugins: StartPlugins }>(({ core,
<KibanaContextProvider
services={{
appName: 'siem',
data: plugins.data,
storage: new Storage(localStorage),
...core,
...plugins,
}}
>
<StartApp {...compose()} />
Expand Down

0 comments on commit 24c75e5

Please sign in to comment.