Fix outstanding NP issues in SIEM frontend (#53735) (#53739)

* 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).
This commit is contained in:
Ryland Herrick 2019-12-20 18:37:50 -06:00 committed by GitHub
parent 2bef93fb1f
commit a7b7a24b45
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View file

@ -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);

View file

@ -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';
@ -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 = () => {

View file

@ -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()} />