Skip to content

Commit

Permalink
Add Serverless as dependency to existing plugins; wire up navigation …
Browse files Browse the repository at this point in the history
…replacement
  • Loading branch information
clintandrewhall committed Mar 1, 2023
1 parent b51482a commit 7a40d99
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 8 deletions.
2 changes: 2 additions & 0 deletions config/serverless.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

xpack.serverless.plugin.enabled: true
1 change: 1 addition & 0 deletions x-pack/plugins/serverless_observability/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"observability"
],
"requiredPlugins": [
"serverless",
"observability"
],
"optionalPlugins": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,33 @@
* 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
implements Plugin<ServerlessObservabilityPluginSetup, ServerlessObservabilityPluginStart>
{
public setup(
_core: CoreSetup,
setupDeps: AppPluginSetupDependencies
setupDeps: ServerlessObservabilityPluginSetupDependencies
): ServerlessObservabilityPluginSetup {
setupDeps.observability.navigation.setIsSidebarEnabled(false);

// Return methods that should be available to other plugins
return {};
}

public start(_core: CoreStart): ServerlessObservabilityPluginStart {
public start(
_core: CoreStart,
{ serverless }: ServerlessObservabilityPluginStartDependencies
): ServerlessObservabilityPluginStart {
serverless.setServerlessNavigation(<h1 style={{ color: '#fff' }}>Observability</h1>);
return {};
}

Expand Down
15 changes: 11 additions & 4 deletions x-pack/plugins/serverless_observability/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,24 @@
* 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 {}

// 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;
}
1 change: 1 addition & 0 deletions x-pack/plugins/serverless_observability/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
"@kbn/core",
"@kbn/config-schema",
"@kbn/observability-plugin",
"@kbn/serverless",
]
}
1 change: 1 addition & 0 deletions x-pack/plugins/serverless_security/kibana.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"security"
],
"requiredPlugins": [
"serverless",
"security",
"securitySolution"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* 2.0.
*/

import React from 'react';
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
import {
ServerlessSecurityPluginSetup,
Expand Down Expand Up @@ -32,8 +33,9 @@ export class ServerlessSecurityPlugin

public start(
_core: CoreStart,
_startDeps: ServerlessSecurityPluginStartDependencies
startDeps: ServerlessSecurityPluginStartDependencies
): ServerlessSecurityPluginStart {
startDeps.serverless.setServerlessNavigation(<h1 style={{ color: '#fff' }}>Security</h1>);
return {};
}

Expand Down
3 changes: 3 additions & 0 deletions x-pack/plugins/serverless_security/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}
Expand All @@ -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;
}
2 changes: 2 additions & 0 deletions x-pack/plugins/serverless_security/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"index.ts",
"common/**/*.ts",
"public/**/*.ts",
"public/**/*.tsx",
"server/**/*.ts",
"../../../typings/**/*"
],
Expand All @@ -18,5 +19,6 @@
"@kbn/config-schema",
"@kbn/security-plugin",
"@kbn/security-solution-plugin",
"@kbn/serverless",
]
}

0 comments on commit 7a40d99

Please sign in to comment.