From 7a40d99c58d8963b27a876d17dd668ba39b338d8 Mon Sep 17 00:00:00 2001 From: Clint Andrew Hall Date: Sun, 26 Feb 2023 00:56:54 -0500 Subject: [PATCH] Add Serverless as dependency to existing plugins; wire up navigation replacement --- config/serverless.yml | 2 ++ .../plugins/serverless_observability/kibana.jsonc | 1 + .../public/{plugin.ts => plugin.tsx} | 12 +++++++++--- .../serverless_observability/public/types.ts | 15 +++++++++++---- .../serverless_observability/tsconfig.json | 1 + x-pack/plugins/serverless_security/kibana.jsonc | 1 + .../public/{plugin.ts => plugin.tsx} | 4 +++- .../plugins/serverless_security/public/types.ts | 3 +++ x-pack/plugins/serverless_security/tsconfig.json | 2 ++ 9 files changed, 33 insertions(+), 8 deletions(-) rename x-pack/plugins/serverless_observability/public/{plugin.ts => plugin.tsx} (66%) rename x-pack/plugins/serverless_security/public/{plugin.ts => plugin.tsx} (85%) diff --git a/config/serverless.yml b/config/serverless.yml index e69de29bb2d1d..a4dfeaea49267 100644 --- a/config/serverless.yml +++ b/config/serverless.yml @@ -0,0 +1,2 @@ + +xpack.serverless.plugin.enabled: true diff --git a/x-pack/plugins/serverless_observability/kibana.jsonc b/x-pack/plugins/serverless_observability/kibana.jsonc index 0f0e911e6807f..abce6cd9e8350 100644 --- a/x-pack/plugins/serverless_observability/kibana.jsonc +++ b/x-pack/plugins/serverless_observability/kibana.jsonc @@ -13,6 +13,7 @@ "observability" ], "requiredPlugins": [ + "serverless", "observability" ], "optionalPlugins": [], diff --git a/x-pack/plugins/serverless_observability/public/plugin.ts b/x-pack/plugins/serverless_observability/public/plugin.tsx similarity index 66% rename from x-pack/plugins/serverless_observability/public/plugin.ts rename to x-pack/plugins/serverless_observability/public/plugin.tsx index dd1c5bfbc39c7..e6438ee8feff6 100644 --- a/x-pack/plugins/serverless_observability/public/plugin.ts +++ b/x-pack/plugins/serverless_observability/public/plugin.tsx @@ -5,11 +5,13 @@ * 2.0. */ +import React from 'react'; import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public'; import { ServerlessObservabilityPluginSetup, ServerlessObservabilityPluginStart, - AppPluginSetupDependencies, + ServerlessObservabilityPluginSetupDependencies, + ServerlessObservabilityPluginStartDependencies, } from './types'; export class ServerlessObservabilityPlugin @@ -17,7 +19,7 @@ export class ServerlessObservabilityPlugin { public setup( _core: CoreSetup, - setupDeps: AppPluginSetupDependencies + setupDeps: ServerlessObservabilityPluginSetupDependencies ): ServerlessObservabilityPluginSetup { setupDeps.observability.navigation.setIsSidebarEnabled(false); @@ -25,7 +27,11 @@ export class ServerlessObservabilityPlugin return {}; } - public start(_core: CoreStart): ServerlessObservabilityPluginStart { + public start( + _core: CoreStart, + { serverless }: ServerlessObservabilityPluginStartDependencies + ): ServerlessObservabilityPluginStart { + serverless.setServerlessNavigation(

Observability

); return {}; } diff --git a/x-pack/plugins/serverless_observability/public/types.ts b/x-pack/plugins/serverless_observability/public/types.ts index 73ab40e9257f7..e0fca61302ad7 100644 --- a/x-pack/plugins/serverless_observability/public/types.ts +++ b/x-pack/plugins/serverless_observability/public/types.ts @@ -5,7 +5,11 @@ * 2.0. */ -import { ObservabilityPublicSetup } from '@kbn/observability-plugin/public'; +import { ServerlessPluginSetup, ServerlessPluginStart } from '@kbn/serverless/public'; +import { + ObservabilityPublicSetup, + ObservabilityPublicStart, +} from '@kbn/observability-plugin/public'; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface ServerlessObservabilityPluginSetup {} @@ -13,9 +17,12 @@ export interface ServerlessObservabilityPluginSetup {} // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface ServerlessObservabilityPluginStart {} -export interface AppPluginSetupDependencies { +export interface ServerlessObservabilityPluginSetupDependencies { observability: ObservabilityPublicSetup; + serverless: ServerlessPluginSetup; } -// eslint-disable-next-line @typescript-eslint/no-empty-interface -export interface AppPluginStartDependencies {} +export interface ServerlessObservabilityPluginStartDependencies { + observability: ObservabilityPublicStart; + serverless: ServerlessPluginStart; +} diff --git a/x-pack/plugins/serverless_observability/tsconfig.json b/x-pack/plugins/serverless_observability/tsconfig.json index 4c9f7b818b430..8c9ec19e4736a 100644 --- a/x-pack/plugins/serverless_observability/tsconfig.json +++ b/x-pack/plugins/serverless_observability/tsconfig.json @@ -18,5 +18,6 @@ "@kbn/core", "@kbn/config-schema", "@kbn/observability-plugin", + "@kbn/serverless", ] } diff --git a/x-pack/plugins/serverless_security/kibana.jsonc b/x-pack/plugins/serverless_security/kibana.jsonc index c94c93513209f..71405b0e47707 100644 --- a/x-pack/plugins/serverless_security/kibana.jsonc +++ b/x-pack/plugins/serverless_security/kibana.jsonc @@ -13,6 +13,7 @@ "security" ], "requiredPlugins": [ + "serverless", "security", "securitySolution" ], diff --git a/x-pack/plugins/serverless_security/public/plugin.ts b/x-pack/plugins/serverless_security/public/plugin.tsx similarity index 85% rename from x-pack/plugins/serverless_security/public/plugin.ts rename to x-pack/plugins/serverless_security/public/plugin.tsx index 4af166c8cf804..f0f1fd2e0e9f0 100644 --- a/x-pack/plugins/serverless_security/public/plugin.ts +++ b/x-pack/plugins/serverless_security/public/plugin.tsx @@ -5,6 +5,7 @@ * 2.0. */ +import React from 'react'; import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public'; import { ServerlessSecurityPluginSetup, @@ -32,8 +33,9 @@ export class ServerlessSecurityPlugin public start( _core: CoreStart, - _startDeps: ServerlessSecurityPluginStartDependencies + startDeps: ServerlessSecurityPluginStartDependencies ): ServerlessSecurityPluginStart { + startDeps.serverless.setServerlessNavigation(

Security

); return {}; } diff --git a/x-pack/plugins/serverless_security/public/types.ts b/x-pack/plugins/serverless_security/public/types.ts index 58ac0b112abcf..1fc18893ce1fd 100644 --- a/x-pack/plugins/serverless_security/public/types.ts +++ b/x-pack/plugins/serverless_security/public/types.ts @@ -10,6 +10,7 @@ import { PluginSetup as SecuritySolutionPluginSetup, PluginStart as SecuritySolutionPluginStart, } from '@kbn/security-solution-plugin/public'; +import { ServerlessPluginSetup, ServerlessPluginStart } from '@kbn/serverless/public'; // eslint-disable-next-line @typescript-eslint/no-empty-interface export interface ServerlessSecurityPluginSetup {} @@ -20,9 +21,11 @@ export interface ServerlessSecurityPluginStart {} export interface ServerlessSecurityPluginSetupDependencies { security: SecurityPluginSetup; securitySolution: SecuritySolutionPluginSetup; + serverless: ServerlessPluginSetup; } export interface ServerlessSecurityPluginStartDependencies { security: SecurityPluginStart; securitySolution: SecuritySolutionPluginStart; + serverless: ServerlessPluginStart; } diff --git a/x-pack/plugins/serverless_security/tsconfig.json b/x-pack/plugins/serverless_security/tsconfig.json index 86d85593b598f..ddf77b288e628 100644 --- a/x-pack/plugins/serverless_security/tsconfig.json +++ b/x-pack/plugins/serverless_security/tsconfig.json @@ -7,6 +7,7 @@ "index.ts", "common/**/*.ts", "public/**/*.ts", + "public/**/*.tsx", "server/**/*.ts", "../../../typings/**/*" ], @@ -18,5 +19,6 @@ "@kbn/config-schema", "@kbn/security-plugin", "@kbn/security-solution-plugin", + "@kbn/serverless", ] }