From 24c75e545bf6f7a7d2c68e3d465a1be84b8cf1f4 Mon Sep 17 00:00:00 2001 From: Ryland Herrick Date: Fri, 20 Dec 2019 17:11:47 -0600 Subject: [PATCH] Fix outstanding NP issues in SIEM frontend (#53735) * 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). --- x-pack/legacy/plugins/siem/public/apps/index.ts | 5 ++++- x-pack/legacy/plugins/siem/public/apps/plugin.tsx | 5 +++++ x-pack/legacy/plugins/siem/public/apps/start_app.tsx | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/x-pack/legacy/plugins/siem/public/apps/index.ts b/x-pack/legacy/plugins/siem/public/apps/index.ts index 73f9b65ba3546..0cc5c5584e1b7 100644 --- a/x-pack/legacy/plugins/siem/public/apps/index.ts +++ b/x-pack/legacy/plugins/siem/public/apps/index.ts @@ -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); diff --git a/x-pack/legacy/plugins/siem/public/apps/plugin.tsx b/x-pack/legacy/plugins/siem/public/apps/plugin.tsx index 700fec2557b1b..aa42504e07635 100644 --- a/x-pack/legacy/plugins/siem/public/apps/plugin.tsx +++ b/x-pack/legacy/plugins/siem/public/apps/plugin.tsx @@ -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 = () => { diff --git a/x-pack/legacy/plugins/siem/public/apps/start_app.tsx b/x-pack/legacy/plugins/siem/public/apps/start_app.tsx index 6b7e3a7b8084f..54180b51fe039 100644 --- a/x-pack/legacy/plugins/siem/public/apps/start_app.tsx +++ b/x-pack/legacy/plugins/siem/public/apps/start_app.tsx @@ -77,9 +77,9 @@ export const SiemApp = memo<{ core: StartCore; plugins: StartPlugins }>(({ core,