mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[chore] Make plugin dependencies explicit; point out lifecycle inconsistencies (#173297)
> Changes identified using the script from https://github.com/elastic/kibana/pull/171483 ## Summary The script from https://github.com/elastic/kibana/pull/171483 can identify inconsistencies and untyped dependencies in Kibana plugins. This PR fixes the obvious: - `notifications` - move `actions` and `licensing` to `optionalPlugins`. - `serverless` - move `kibanaReact` to `requiredBundles`. - `serverlessObservability` - delete dead code and `kibanaReact` dependency. - `reporting` - move `esUiShared` and `embeddable` plugins to `requiredBundles`. - `uiActions` - remove `dataViews` dependency, (only a type is being used). - `urlDrilldowns` - move `uiActions` to `requiredBundles`. - Type all plugins using the `Setup` and `Start` generics on the core `Plugin` interface. - Consistently name them. - The exports needed to be named their original names; this will be addressed in follow up work, (to avoid pinging teams) - Add a `_` to unused parameters. ## Remaining Issues ### `licensing` and `licensingApiGuard` Both of these plugins introduce side-effects, rather than dependent logic. These need to be refactored to be consumed instead. <img width="735" alt="Screenshot 2023-12-13 at 10 08 00 AM" src="57916ffd
-299d-4ca8-b796-dea2d06dca4a"> <img width="740" alt="Screenshot 2023-12-13 at 10 08 08 AM" src="a2af254f
-adec-4bf9-869a-8acf34c0c9b4"> ## Resolved issues ### `reporting` ~~The `reporting` plugin requires `embeddable` and `esUiShared`, but it's unclear if these still apply, or if they are required for side-effects. Perhaps @tsullivan can help clarify?~~ Both are being used for static code. Moving to `requiredBundles`, and need to follow-up to create packages. <img width="800" alt="Screenshot 2023-12-13 at 10 08 23 AM" src="7629fb92
-d28e-43de-bfeb-97410cff424e"> ### `uiActions` ~~The `uiActions` plugin requires `dataViews`. We need to determine if this is a side-effect dependency, or a direct dependency, and remove or refactor as necessary.~~ It's only using a type. Removing the dependency entirely, (`requiredBundles` requires actual code be used). <img width="622" alt="Screenshot 2023-12-13 at 10 08 33 AM" src="39916f05
-dafc-4f42-b5d8-1abcb1267b5b"> ### urlDrilldown ~~The `urlDrilldown` plugin requires `uiActions`. We need to determine if this is a side-effect dependency, or a direct dependency, and remove or refactor as necessary.~~ Static code usage-- moving to `requiredBundles`. <img width="732" alt="Screenshot 2023-12-13 at 10 13 13 AM" src="af32f939
-f866-483d-8dd0-aab962397dbb"> --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
b501281195
commit
1c99f40f2c
59 changed files with 435 additions and 198 deletions
|
@ -19,13 +19,20 @@ import type { Context as RpcContext } from './rpc';
|
|||
import {
|
||||
ContentManagementServerSetup,
|
||||
ContentManagementServerStart,
|
||||
SetupDependencies,
|
||||
ContentManagementServerSetupDependencies,
|
||||
ContentManagementServerStartDependencies,
|
||||
} from './types';
|
||||
import { EventStreamService } from './event_stream';
|
||||
import { procedureNames } from '../common/rpc';
|
||||
|
||||
export class ContentManagementPlugin
|
||||
implements Plugin<ContentManagementServerSetup, ContentManagementServerStart, SetupDependencies>
|
||||
implements
|
||||
Plugin<
|
||||
ContentManagementServerSetup,
|
||||
ContentManagementServerStart,
|
||||
ContentManagementServerSetupDependencies,
|
||||
ContentManagementServerStartDependencies
|
||||
>
|
||||
{
|
||||
private readonly logger: Logger;
|
||||
private readonly core: Core;
|
||||
|
|
|
@ -9,7 +9,10 @@
|
|||
import { CoreApi } from './core';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface SetupDependencies {}
|
||||
export interface ContentManagementServerSetupDependencies {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface ContentManagementServerStartDependencies {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface ContentManagementServerSetup extends CoreApi {}
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
*/
|
||||
|
||||
import { FilesPlugin } from './plugin';
|
||||
export type { FilesSetup, FilesStart } from './plugin';
|
||||
|
||||
export type { FilesPublicSetup as FilesSetup, FilesPublicStart as FilesStart } from './plugin';
|
||||
|
||||
export type {
|
||||
FilesClient,
|
||||
ScopedFilesClient,
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { createMockFilesClient as createBaseMocksFilesClient } from '@kbn/shared-ux-file-mocks';
|
||||
import type { DeeplyMockedKeys } from '@kbn/utility-types-jest';
|
||||
import { FilesSetup } from '.';
|
||||
import { FilesPublicSetup } from './plugin';
|
||||
import type { FilesClient, FilesClientFactory } from './types';
|
||||
|
||||
export const createMockFilesClient = (): DeeplyMockedKeys<FilesClient> => ({
|
||||
|
@ -17,7 +17,7 @@ export const createMockFilesClient = (): DeeplyMockedKeys<FilesClient> => ({
|
|||
publicDownload: jest.fn(),
|
||||
});
|
||||
|
||||
export const createMockFilesSetup = (): DeeplyMockedKeys<FilesSetup> => {
|
||||
export const createMockFilesSetup = (): DeeplyMockedKeys<FilesPublicSetup> => {
|
||||
return {
|
||||
filesClientFactory: createMockFilesClientFactory(),
|
||||
registerFileKind: jest.fn(),
|
||||
|
|
|
@ -7,7 +7,12 @@
|
|||
*/
|
||||
|
||||
import type { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import type { FilesClient, FilesClientFactory } from './types';
|
||||
import type {
|
||||
FilesClient,
|
||||
FilesClientFactory,
|
||||
FilesPublicSetupDependencies,
|
||||
FilesPublicStartDependencies,
|
||||
} from './types';
|
||||
import { FileKindsRegistryImpl } from '../common/file_kinds_registry';
|
||||
import { createFilesClient } from './files_client';
|
||||
import { FileKindBrowser } from '../common';
|
||||
|
@ -17,7 +22,7 @@ import * as DefaultImageFileKind from '../common/default_image_file_kind';
|
|||
/**
|
||||
* Public setup-phase contract
|
||||
*/
|
||||
export interface FilesSetup {
|
||||
export interface FilesPublicSetup {
|
||||
/**
|
||||
* A factory for creating an {@link FilesClient} instance. This requires a
|
||||
* registered {@link FileKindBrowser}.
|
||||
|
@ -35,7 +40,7 @@ export interface FilesSetup {
|
|||
registerFileKind(fileKind: FileKindBrowser): void;
|
||||
}
|
||||
|
||||
export type FilesStart = Pick<FilesSetup, 'filesClientFactory'> & {
|
||||
export type FilesPublicStart = Pick<FilesPublicSetup, 'filesClientFactory'> & {
|
||||
getFileKindDefinition: (id: string) => FileKindBrowser;
|
||||
getAllFindKindDefinitions: () => FileKindBrowser[];
|
||||
};
|
||||
|
@ -43,11 +48,19 @@ export type FilesStart = Pick<FilesSetup, 'filesClientFactory'> & {
|
|||
/**
|
||||
* Bringing files to Kibana
|
||||
*/
|
||||
export class FilesPlugin implements Plugin<FilesSetup, FilesStart> {
|
||||
export class FilesPlugin
|
||||
implements
|
||||
Plugin<
|
||||
FilesPublicSetup,
|
||||
FilesPublicStart,
|
||||
FilesPublicSetupDependencies,
|
||||
FilesPublicStartDependencies
|
||||
>
|
||||
{
|
||||
private registry = new FileKindsRegistryImpl<FileKindBrowser>();
|
||||
private filesClientFactory?: FilesClientFactory;
|
||||
|
||||
setup(core: CoreSetup): FilesSetup {
|
||||
setup(core: CoreSetup): FilesPublicSetup {
|
||||
this.registry.register({
|
||||
...DefaultImageFileKind.kind,
|
||||
maxSizeBytes: DefaultImageFileKind.maxSize,
|
||||
|
@ -77,7 +90,7 @@ export class FilesPlugin implements Plugin<FilesSetup, FilesStart> {
|
|||
};
|
||||
}
|
||||
|
||||
start(core: CoreStart): FilesStart {
|
||||
start(core: CoreStart): FilesPublicStart {
|
||||
return {
|
||||
filesClientFactory: this.filesClientFactory!,
|
||||
getFileKindDefinition: (id: string): FileKindBrowser => {
|
||||
|
|
|
@ -12,3 +12,9 @@ export type {
|
|||
FilesClientFactory,
|
||||
FilesClientResponses,
|
||||
} from '../common/files_client';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface FilesPublicSetupDependencies {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface FilesPublicStartDependencies {}
|
||||
|
|
|
@ -23,7 +23,7 @@ export { createEsFileClient } from './file_client';
|
|||
|
||||
export { createFileHashTransform } from './file_client/stream_transforms/file_hash_transform';
|
||||
|
||||
export type { FilesSetup, FilesStart } from './types';
|
||||
export type { FilesServerSetup as FilesSetup, FilesServerStart as FilesStart } from './types';
|
||||
export type {
|
||||
FileShareServiceStart,
|
||||
CreateShareArgs,
|
||||
|
|
|
@ -25,10 +25,10 @@ import {
|
|||
import { BlobStorageService } from './blob_storage_service';
|
||||
import { FileServiceFactory } from './file_service';
|
||||
import type {
|
||||
FilesPluginSetupDependencies,
|
||||
FilesPluginStartDependencies,
|
||||
FilesSetup,
|
||||
FilesStart,
|
||||
FilesServerSetupDependencies,
|
||||
FilesServerStartDependencies,
|
||||
FilesServerSetup,
|
||||
FilesServerStart,
|
||||
} from './types';
|
||||
|
||||
import type { FilesRequestHandlerContext, FilesRouter } from './routes/types';
|
||||
|
@ -36,12 +36,20 @@ import { registerRoutes, registerFileKindRoutes } from './routes';
|
|||
import { Counters, registerUsageCollector } from './usage';
|
||||
import * as DefaultImageKind from '../common/default_image_file_kind';
|
||||
|
||||
export class FilesPlugin implements Plugin<FilesSetup, FilesStart, FilesPluginSetupDependencies> {
|
||||
export class FilesPlugin
|
||||
implements
|
||||
Plugin<
|
||||
FilesServerSetup,
|
||||
FilesServerStart,
|
||||
FilesServerSetupDependencies,
|
||||
FilesServerStartDependencies
|
||||
>
|
||||
{
|
||||
private static analytics?: AnalyticsServiceStart;
|
||||
private readonly logger: Logger;
|
||||
private fileServiceFactory: undefined | FileServiceFactory;
|
||||
private securitySetup: FilesPluginSetupDependencies['security'];
|
||||
private securityStart: FilesPluginStartDependencies['security'];
|
||||
private securitySetup: FilesServerSetupDependencies['security'];
|
||||
private securityStart: FilesServerStartDependencies['security'];
|
||||
|
||||
constructor(initializerContext: PluginInitializerContext) {
|
||||
this.logger = initializerContext.logger.get();
|
||||
|
@ -57,8 +65,8 @@ export class FilesPlugin implements Plugin<FilesSetup, FilesStart, FilesPluginSe
|
|||
|
||||
public setup(
|
||||
core: CoreSetup,
|
||||
{ security, usageCollection }: FilesPluginSetupDependencies
|
||||
): FilesSetup {
|
||||
{ security, usageCollection }: FilesServerSetupDependencies
|
||||
): FilesServerSetup {
|
||||
const usageCounter = usageCollection?.createUsageCounter(PLUGIN_ID);
|
||||
FileServiceFactory.setup(core.savedObjects, usageCounter);
|
||||
this.securitySetup = security;
|
||||
|
@ -101,7 +109,7 @@ export class FilesPlugin implements Plugin<FilesSetup, FilesStart, FilesPluginSe
|
|||
};
|
||||
}
|
||||
|
||||
public start(coreStart: CoreStart, { security }: FilesPluginStartDependencies): FilesStart {
|
||||
public start(coreStart: CoreStart, { security }: FilesServerStartDependencies): FilesServerStart {
|
||||
const { savedObjects, analytics } = coreStart;
|
||||
this.securityStart = security;
|
||||
FilesPlugin.setAnalytics(analytics);
|
||||
|
|
|
@ -13,7 +13,7 @@ import { FileServiceFactory } from './file_service/file_service_factory';
|
|||
/**
|
||||
* Files plugin setup contract
|
||||
*/
|
||||
export interface FilesSetup {
|
||||
export interface FilesServerSetup {
|
||||
/**
|
||||
* Register a {@link FileKind} which allows for specifying details about the files
|
||||
* that will be uploaded.
|
||||
|
@ -25,19 +25,10 @@ export interface FilesSetup {
|
|||
registerFileKind(fileKind: FileKind): void;
|
||||
}
|
||||
|
||||
export interface FilesPluginSetupDependencies {
|
||||
security?: SecurityPluginSetup;
|
||||
usageCollection?: UsageCollectionSetup;
|
||||
}
|
||||
|
||||
export interface FilesPluginStartDependencies {
|
||||
security?: SecurityPluginStart;
|
||||
}
|
||||
|
||||
/**
|
||||
* Files plugin start contract
|
||||
*/
|
||||
export interface FilesStart {
|
||||
export interface FilesServerStart {
|
||||
/**
|
||||
* Create an instance of {@link FileServiceStart}.
|
||||
*
|
||||
|
@ -45,3 +36,12 @@ export interface FilesStart {
|
|||
*/
|
||||
fileServiceFactory: FileServiceFactory;
|
||||
}
|
||||
|
||||
export interface FilesServerSetupDependencies {
|
||||
security?: SecurityPluginSetup;
|
||||
usageCollection?: UsageCollectionSetup;
|
||||
}
|
||||
|
||||
export interface FilesServerStartDependencies {
|
||||
security?: SecurityPluginStart;
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ export {
|
|||
} from './history';
|
||||
export { applyDiff } from './state_management/utils/diff_object';
|
||||
|
||||
export type { KibanaUtilsSetup } from './plugin';
|
||||
export type { KibanaUtilsPublicSetup as KibanaUtilsSetup, KibanaUtilsPublicStart } from './plugin';
|
||||
|
||||
export function plugin(initializerContext: PluginInitializerContext) {
|
||||
return new KibanaUtilsPublicPlugin(initializerContext);
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { KibanaUtilsSetup, KibanaUtilsStart } from './plugin';
|
||||
import { KibanaUtilsPublicSetup, KibanaUtilsPublicStart } from './plugin';
|
||||
|
||||
export type Setup = jest.Mocked<KibanaUtilsSetup>;
|
||||
export type Start = jest.Mocked<KibanaUtilsStart>;
|
||||
export type Setup = jest.Mocked<KibanaUtilsPublicSetup>;
|
||||
export type Start = jest.Mocked<KibanaUtilsPublicStart>;
|
||||
|
||||
const createSetupContract = (): Setup => {
|
||||
return {
|
||||
|
|
|
@ -10,26 +10,40 @@ import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '@kbn/cor
|
|||
import { History } from 'history';
|
||||
import { setVersion } from './set_version';
|
||||
|
||||
export interface KibanaUtilsSetup {
|
||||
export interface KibanaUtilsPublicSetup {
|
||||
setVersion: (history: Pick<History, 'location' | 'replace'>) => void;
|
||||
}
|
||||
|
||||
export type KibanaUtilsStart = undefined;
|
||||
export type KibanaUtilsPublicStart = undefined;
|
||||
|
||||
export class KibanaUtilsPublicPlugin implements Plugin<KibanaUtilsSetup, KibanaUtilsStart> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface KibanaUtilsPublicSetupDependencies {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface KibanaUtilsPublicStartDependencies {}
|
||||
|
||||
export class KibanaUtilsPublicPlugin
|
||||
implements
|
||||
Plugin<
|
||||
KibanaUtilsPublicSetup,
|
||||
KibanaUtilsPublicStart,
|
||||
KibanaUtilsPublicSetupDependencies,
|
||||
KibanaUtilsPublicStartDependencies
|
||||
>
|
||||
{
|
||||
private readonly version: string;
|
||||
|
||||
constructor(initializerContext: PluginInitializerContext) {
|
||||
this.version = initializerContext.env.packageInfo.version;
|
||||
}
|
||||
|
||||
public setup(core: CoreSetup): KibanaUtilsSetup {
|
||||
public setup(_core: CoreSetup): KibanaUtilsPublicSetup {
|
||||
return {
|
||||
setVersion: this.setVersion,
|
||||
};
|
||||
}
|
||||
|
||||
public start(core: CoreStart): KibanaUtilsStart {
|
||||
public start(_core: CoreStart): KibanaUtilsPublicStart {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,10 @@ export function plugin(initializerContext: PluginInitializerContext) {
|
|||
export type { TopNavMenuData, TopNavMenuProps, TopNavMenuBadgeProps } from './top_nav_menu';
|
||||
export { TopNavMenu, TopNavMenuItems, TopNavMenuBadges } from './top_nav_menu';
|
||||
|
||||
export type { NavigationPublicPluginSetup, NavigationPublicPluginStart } from './types';
|
||||
export type {
|
||||
NavigationPublicSetup as NavigationPublicPluginSetup,
|
||||
NavigationPublicStart as NavigationPublicPluginStart,
|
||||
} from './types';
|
||||
|
||||
// Export plugin after all other imports
|
||||
import { NavigationPublicPlugin } from './plugin';
|
||||
|
|
|
@ -9,22 +9,29 @@
|
|||
import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/public';
|
||||
import {
|
||||
NavigationPublicPluginSetup,
|
||||
NavigationPublicPluginStart,
|
||||
NavigationPluginStartDependencies,
|
||||
NavigationPublicSetup,
|
||||
NavigationPublicStart,
|
||||
NavigationPublicSetupDependencies,
|
||||
NavigationPublicStartDependencies,
|
||||
} from './types';
|
||||
import { TopNavMenuExtensionsRegistry, createTopNav } from './top_nav_menu';
|
||||
import { RegisteredTopNavMenuData } from './top_nav_menu/top_nav_menu_data';
|
||||
|
||||
export class NavigationPublicPlugin
|
||||
implements Plugin<NavigationPublicPluginSetup, NavigationPublicPluginStart>
|
||||
implements
|
||||
Plugin<
|
||||
NavigationPublicSetup,
|
||||
NavigationPublicStart,
|
||||
NavigationPublicSetupDependencies,
|
||||
NavigationPublicStartDependencies
|
||||
>
|
||||
{
|
||||
private readonly topNavMenuExtensionsRegistry: TopNavMenuExtensionsRegistry =
|
||||
new TopNavMenuExtensionsRegistry();
|
||||
|
||||
constructor(initializerContext: PluginInitializerContext) {}
|
||||
constructor(_initializerContext: PluginInitializerContext) {}
|
||||
|
||||
public setup(core: CoreSetup): NavigationPublicPluginSetup {
|
||||
public setup(_core: CoreSetup): NavigationPublicSetup {
|
||||
return {
|
||||
registerMenuItem: this.topNavMenuExtensionsRegistry.register.bind(
|
||||
this.topNavMenuExtensionsRegistry
|
||||
|
@ -33,9 +40,9 @@ export class NavigationPublicPlugin
|
|||
}
|
||||
|
||||
public start(
|
||||
core: CoreStart,
|
||||
{ unifiedSearch }: NavigationPluginStartDependencies
|
||||
): NavigationPublicPluginStart {
|
||||
_core: CoreStart,
|
||||
{ unifiedSearch }: NavigationPublicStartDependencies
|
||||
): NavigationPublicStart {
|
||||
const extensions = this.topNavMenuExtensionsRegistry.getAll();
|
||||
|
||||
/*
|
||||
|
|
|
@ -11,11 +11,11 @@ import { UnifiedSearchPublicPluginStart } from '@kbn/unified-search-plugin/publi
|
|||
import { TopNavMenuProps, TopNavMenuExtensionsRegistrySetup, createTopNav } from './top_nav_menu';
|
||||
import { RegisteredTopNavMenuData } from './top_nav_menu/top_nav_menu_data';
|
||||
|
||||
export interface NavigationPublicPluginSetup {
|
||||
export interface NavigationPublicSetup {
|
||||
registerMenuItem: TopNavMenuExtensionsRegistrySetup['register'];
|
||||
}
|
||||
|
||||
export interface NavigationPublicPluginStart {
|
||||
export interface NavigationPublicStart {
|
||||
ui: {
|
||||
TopNavMenu: (props: TopNavMenuProps<Query>) => React.ReactElement;
|
||||
AggregateQueryTopNavMenu: (props: TopNavMenuProps<AggregateQuery>) => React.ReactElement;
|
||||
|
@ -26,6 +26,9 @@ export interface NavigationPublicPluginStart {
|
|||
};
|
||||
}
|
||||
|
||||
export interface NavigationPluginStartDependencies {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface NavigationPublicSetupDependencies {}
|
||||
|
||||
export interface NavigationPublicStartDependencies {
|
||||
unifiedSearch: UnifiedSearchPublicPluginStart;
|
||||
}
|
||||
|
|
|
@ -13,4 +13,7 @@ export function plugin(ctx: PluginInitializerContext) {
|
|||
return new NoDataPagePlugin(ctx);
|
||||
}
|
||||
|
||||
export type { NoDataPagePluginSetup, NoDataPagePluginStart } from './types';
|
||||
export type {
|
||||
NoDataPagePublicSetup as NoDataPagePluginSetup,
|
||||
NoDataPagePublicStart as NoDataPagePluginStart,
|
||||
} from './types';
|
||||
|
|
|
@ -7,13 +7,26 @@
|
|||
*/
|
||||
|
||||
import type { CoreSetup, CoreStart, Plugin, PluginInitializerContext } from '@kbn/core/public';
|
||||
import type { NoDataPagePluginSetup, NoDataPagePluginStart } from './types';
|
||||
import type {
|
||||
NoDataPagePublicSetup,
|
||||
NoDataPagePublicSetupDependencies,
|
||||
NoDataPagePublicStart,
|
||||
NoDataPagePublicStartDependencies,
|
||||
} from './types';
|
||||
import type { NoDataPageConfig } from '../config';
|
||||
|
||||
export class NoDataPagePlugin implements Plugin<NoDataPagePluginSetup> {
|
||||
export class NoDataPagePlugin
|
||||
implements
|
||||
Plugin<
|
||||
NoDataPagePublicSetup,
|
||||
NoDataPagePublicStart,
|
||||
NoDataPagePublicSetupDependencies,
|
||||
NoDataPagePublicStartDependencies
|
||||
>
|
||||
{
|
||||
constructor(private initializerContext: PluginInitializerContext<NoDataPageConfig>) {}
|
||||
|
||||
public setup(core: CoreSetup): NoDataPagePluginSetup {
|
||||
public setup(_core: CoreSetup): NoDataPagePublicSetup {
|
||||
return {
|
||||
getAnalyticsNoDataPageFlavor: () => {
|
||||
return this.initializerContext.config.get().analyticsNoDataPageFlavor;
|
||||
|
@ -21,7 +34,7 @@ export class NoDataPagePlugin implements Plugin<NoDataPagePluginSetup> {
|
|||
};
|
||||
}
|
||||
|
||||
public start(core: CoreStart): NoDataPagePluginStart {
|
||||
public start(_core: CoreStart): NoDataPagePublicStart {
|
||||
return {
|
||||
getAnalyticsNoDataPageFlavor: () => {
|
||||
return this.initializerContext.config.get().analyticsNoDataPageFlavor;
|
||||
|
|
|
@ -6,8 +6,14 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
export interface NoDataPagePluginSetup {
|
||||
export interface NoDataPagePublicSetup {
|
||||
getAnalyticsNoDataPageFlavor: () => 'kibana' | 'serverless_search' | 'serverless_observability';
|
||||
}
|
||||
|
||||
export type NoDataPagePluginStart = NoDataPagePluginSetup;
|
||||
export type NoDataPagePublicStart = NoDataPagePublicSetup;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface NoDataPagePublicSetupDependencies {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface NoDataPagePublicStartDependencies {}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import { ContentManagementPublicStart } from '@kbn/content-management-plugin/public';
|
||||
import { DataViewsPublicPluginStart } from '@kbn/data-views-plugin/public';
|
||||
import { UiActionsStart } from '@kbn/ui-actions-plugin/public/plugin';
|
||||
import { UiActionsStart } from '@kbn/ui-actions-plugin/public';
|
||||
import { registerExpressionsLanguage } from '.';
|
||||
import { PresentationLabsService } from './services/labs/types';
|
||||
|
||||
|
|
|
@ -18,4 +18,7 @@ export {
|
|||
KBN_SCREENSHOT_MODE_ENABLED_KEY,
|
||||
} from '../common';
|
||||
|
||||
export type { ScreenshotModePluginSetup, ScreenshotModePluginStart } from './types';
|
||||
export type {
|
||||
ScreenshotModePublicSetup as ScreenshotModePluginSetup,
|
||||
ScreenshotModePublicStart as ScreenshotModePluginStart,
|
||||
} from './types';
|
||||
|
|
|
@ -7,14 +7,14 @@
|
|||
*/
|
||||
|
||||
import type { DeeplyMockedKeys } from '@kbn/utility-types-jest';
|
||||
import type { ScreenshotModePluginSetup, ScreenshotModePluginStart } from './types';
|
||||
import type { ScreenshotModePublicSetup, ScreenshotModePublicStart } from './types';
|
||||
|
||||
export const screenshotModePluginMock = {
|
||||
createSetupContract: (): DeeplyMockedKeys<ScreenshotModePluginSetup> => ({
|
||||
createSetupContract: (): DeeplyMockedKeys<ScreenshotModePublicSetup> => ({
|
||||
getScreenshotContext: jest.fn(),
|
||||
isScreenshotMode: jest.fn(() => false),
|
||||
}),
|
||||
createStartContract: (): DeeplyMockedKeys<ScreenshotModePluginStart> => ({
|
||||
createStartContract: (): DeeplyMockedKeys<ScreenshotModePublicStart> => ({
|
||||
getScreenshotContext: jest.fn(),
|
||||
isScreenshotMode: jest.fn(() => false),
|
||||
}),
|
||||
|
|
|
@ -8,19 +8,32 @@
|
|||
|
||||
import type { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { getScreenshotContext, getScreenshotMode } from '../common';
|
||||
import type { ScreenshotModePluginSetup, ScreenshotModePluginStart } from './types';
|
||||
import type {
|
||||
ScreenshotModePublicSetup,
|
||||
ScreenshotModePublicSetupDependencies,
|
||||
ScreenshotModePublicStart,
|
||||
ScreenshotModePublicStartDependencies,
|
||||
} from './types';
|
||||
|
||||
export class ScreenshotModePlugin implements Plugin<ScreenshotModePluginSetup> {
|
||||
export class ScreenshotModePlugin
|
||||
implements
|
||||
Plugin<
|
||||
ScreenshotModePublicSetup,
|
||||
ScreenshotModePublicStart,
|
||||
ScreenshotModePublicSetupDependencies,
|
||||
ScreenshotModePublicStartDependencies
|
||||
>
|
||||
{
|
||||
private publicContract = Object.freeze({
|
||||
getScreenshotContext,
|
||||
isScreenshotMode: () => getScreenshotMode() === true,
|
||||
});
|
||||
|
||||
public setup(core: CoreSetup): ScreenshotModePluginSetup {
|
||||
public setup(_core: CoreSetup): ScreenshotModePublicSetup {
|
||||
return this.publicContract;
|
||||
}
|
||||
|
||||
public start(core: CoreStart): ScreenshotModePluginStart {
|
||||
public start(_core: CoreStart): ScreenshotModePublicStart {
|
||||
return this.publicContract;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
export interface ScreenshotModePluginSetup {
|
||||
export interface ScreenshotModePublicSetup {
|
||||
/**
|
||||
* Retrieves a value from the screenshotting context.
|
||||
* @param key Context key to get.
|
||||
|
@ -22,4 +22,10 @@ export interface ScreenshotModePluginSetup {
|
|||
isScreenshotMode(): boolean;
|
||||
}
|
||||
|
||||
export type ScreenshotModePluginStart = ScreenshotModePluginSetup;
|
||||
export type ScreenshotModePublicStart = ScreenshotModePublicSetup;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface ScreenshotModePublicSetupDependencies {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface ScreenshotModePublicStartDependencies {}
|
||||
|
|
|
@ -14,8 +14,8 @@ export {
|
|||
|
||||
export type {
|
||||
ScreenshotModeRequestHandlerContext,
|
||||
ScreenshotModePluginSetup,
|
||||
ScreenshotModePluginStart,
|
||||
ScreenshotModeServerSetup as ScreenshotModePluginSetup,
|
||||
ScreenshotModeServerStart as ScreenshotModePluginStart,
|
||||
} from './types';
|
||||
|
||||
export async function plugin() {
|
||||
|
|
|
@ -9,15 +9,23 @@
|
|||
import type { Plugin, CoreSetup } from '@kbn/core/server';
|
||||
import type {
|
||||
ScreenshotModeRequestHandlerContext,
|
||||
ScreenshotModePluginSetup,
|
||||
ScreenshotModePluginStart,
|
||||
ScreenshotModeServerSetup,
|
||||
ScreenshotModeServerStart,
|
||||
ScreenshotModeServerSetupDependencies,
|
||||
ScreenshotModeServerStartDependencies,
|
||||
} from './types';
|
||||
import { isScreenshotMode } from './is_screenshot_mode';
|
||||
|
||||
export class ScreenshotModePlugin
|
||||
implements Plugin<ScreenshotModePluginSetup, ScreenshotModePluginStart>
|
||||
implements
|
||||
Plugin<
|
||||
ScreenshotModeServerSetup,
|
||||
ScreenshotModeServerStart,
|
||||
ScreenshotModeServerSetupDependencies,
|
||||
ScreenshotModeServerStartDependencies
|
||||
>
|
||||
{
|
||||
public setup(core: CoreSetup): ScreenshotModePluginSetup {
|
||||
public setup(core: CoreSetup): ScreenshotModeServerSetup {
|
||||
core.http.registerRouteHandlerContext<ScreenshotModeRequestHandlerContext, 'screenshotMode'>(
|
||||
'screenshotMode',
|
||||
(ctx, req) => {
|
||||
|
@ -39,7 +47,7 @@ export class ScreenshotModePlugin
|
|||
};
|
||||
}
|
||||
|
||||
public start(): ScreenshotModePluginStart {
|
||||
public start(): ScreenshotModeServerStart {
|
||||
return {
|
||||
isScreenshotMode,
|
||||
};
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
import type { CustomRequestHandlerContext, KibanaRequest } from '@kbn/core/server';
|
||||
|
||||
export interface ScreenshotModePluginStart {
|
||||
export interface ScreenshotModeServerStart {
|
||||
/**
|
||||
* Any context that requires access to the screenshot mode flag but does not have access
|
||||
* to request context {@link ScreenshotModeRequestHandlerContext}, for instance if they are pre-context,
|
||||
|
@ -17,7 +17,7 @@ export interface ScreenshotModePluginStart {
|
|||
isScreenshotMode(request: KibanaRequest): boolean;
|
||||
}
|
||||
|
||||
export interface ScreenshotModePluginSetup extends ScreenshotModePluginStart {
|
||||
export interface ScreenshotModeServerSetup extends ScreenshotModeServerStart {
|
||||
/**
|
||||
* Stores a value in the screenshotting context.
|
||||
* @param key Context key to set.
|
||||
|
@ -32,6 +32,12 @@ export interface ScreenshotModePluginSetup extends ScreenshotModePluginStart {
|
|||
setScreenshotModeEnabled(): void;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface ScreenshotModeServerSetupDependencies {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface ScreenshotModeServerStartDependencies {}
|
||||
|
||||
export type ScreenshotModeRequestHandlerContext = CustomRequestHandlerContext<{
|
||||
screenshotMode: {
|
||||
isScreenshot: boolean;
|
||||
|
|
|
@ -12,7 +12,10 @@ export { CSV_QUOTE_VALUES_SETTING, CSV_SEPARATOR_SETTING } from '../common/const
|
|||
|
||||
export type { LocatorDefinition, LocatorPublic, KibanaLocation } from '../common/url_service';
|
||||
|
||||
export type { SharePluginSetup, SharePluginStart } from './plugin';
|
||||
export type {
|
||||
SharePublicSetup as SharePluginSetup,
|
||||
SharePublicStart as SharePluginStart,
|
||||
} from './plugin';
|
||||
|
||||
export type {
|
||||
ShareContext,
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
*/
|
||||
|
||||
import { SerializableRecord } from '@kbn/utility-types';
|
||||
import { SharePluginSetup, SharePluginStart } from '.';
|
||||
import { SharePublicSetup, SharePublicStart } from './plugin';
|
||||
import { LocatorPublic, UrlService } from '../common/url_service';
|
||||
import { BrowserShortUrlClient } from './url_service/short_urls/short_url_client';
|
||||
import type { BrowserShortUrlClientFactoryCreateParams } from './url_service/short_urls/short_url_client_factory';
|
||||
|
||||
export type Setup = jest.Mocked<SharePluginSetup>;
|
||||
export type Start = jest.Mocked<SharePluginStart>;
|
||||
export type Setup = jest.Mocked<SharePublicSetup>;
|
||||
export type Start = jest.Mocked<SharePublicStart>;
|
||||
|
||||
const url = new UrlService<BrowserShortUrlClientFactoryCreateParams, BrowserShortUrlClient>({
|
||||
navigate: async () => {},
|
||||
|
|
|
@ -26,7 +26,7 @@ import { registrations } from './lib/registrations';
|
|||
import type { BrowserUrlService } from './types';
|
||||
|
||||
/** @public */
|
||||
export type SharePluginSetup = ShareMenuRegistrySetup & {
|
||||
export type SharePublicSetup = ShareMenuRegistrySetup & {
|
||||
/**
|
||||
* Utilities to work with URL locators and short URLs.
|
||||
*/
|
||||
|
@ -45,7 +45,7 @@ export type SharePluginSetup = ShareMenuRegistrySetup & {
|
|||
};
|
||||
|
||||
/** @public */
|
||||
export type SharePluginStart = ShareMenuManagerStart & {
|
||||
export type SharePublicStart = ShareMenuManagerStart & {
|
||||
/**
|
||||
* Utilities to work with URL locators and short URLs.
|
||||
*/
|
||||
|
@ -58,7 +58,21 @@ export type SharePluginStart = ShareMenuManagerStart & {
|
|||
navigate(options: RedirectOptions): void;
|
||||
};
|
||||
|
||||
export class SharePlugin implements Plugin<SharePluginSetup, SharePluginStart> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface SharePublicSetupDependencies {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface SharePublicStartDependencies {}
|
||||
|
||||
export class SharePlugin
|
||||
implements
|
||||
Plugin<
|
||||
SharePublicSetup,
|
||||
SharePublicStart,
|
||||
SharePublicSetupDependencies,
|
||||
SharePublicStartDependencies
|
||||
>
|
||||
{
|
||||
private readonly shareMenuRegistry = new ShareMenuRegistry();
|
||||
private readonly shareContextMenu = new ShareMenuManager();
|
||||
|
||||
|
@ -68,7 +82,7 @@ export class SharePlugin implements Plugin<SharePluginSetup, SharePluginStart> {
|
|||
|
||||
constructor(private readonly initializerContext: PluginInitializerContext) {}
|
||||
|
||||
public setup(core: CoreSetup): SharePluginSetup {
|
||||
public setup(core: CoreSetup): SharePublicSetup {
|
||||
const { analytics, http } = core;
|
||||
const { basePath } = http;
|
||||
|
||||
|
@ -122,7 +136,7 @@ export class SharePlugin implements Plugin<SharePluginSetup, SharePluginStart> {
|
|||
};
|
||||
}
|
||||
|
||||
public start(core: CoreStart): SharePluginStart {
|
||||
public start(core: CoreStart): SharePublicStart {
|
||||
const disableEmbed = this.initializerContext.env.packageInfo.buildFlavor === 'serverless';
|
||||
const sharingContextMenuStart = this.shareContextMenu.start(
|
||||
core,
|
||||
|
|
|
@ -8,7 +8,10 @@
|
|||
|
||||
import { PluginInitializerContext } from '@kbn/core/server';
|
||||
|
||||
export type { SharePluginSetup, SharePluginStart } from './plugin';
|
||||
export type {
|
||||
SharePublicSetup as SharePluginSetup,
|
||||
SharePublicStart as SharePluginStart,
|
||||
} from './plugin';
|
||||
|
||||
export { CSV_QUOTE_VALUES_SETTING, CSV_SEPARATOR_SETTING } from '../common/constants';
|
||||
|
||||
|
|
|
@ -21,16 +21,30 @@ import { LegacyShortUrlLocatorDefinition } from '../common/url_service/locators/
|
|||
import { ShortUrlRedirectLocatorDefinition } from '../common/url_service/locators/short_url_redirect_locator';
|
||||
|
||||
/** @public */
|
||||
export interface SharePluginSetup {
|
||||
export interface SharePublicSetup {
|
||||
url: ServerUrlService;
|
||||
}
|
||||
|
||||
/** @public */
|
||||
export interface SharePluginStart {
|
||||
export interface SharePublicStart {
|
||||
url: ServerUrlService;
|
||||
}
|
||||
|
||||
export class SharePlugin implements Plugin<SharePluginSetup, SharePluginStart> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface SharePublicSetupDependencies {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface SharePublicStartDependencies {}
|
||||
|
||||
export class SharePlugin
|
||||
implements
|
||||
Plugin<
|
||||
SharePublicSetup,
|
||||
SharePublicStart,
|
||||
SharePublicSetupDependencies,
|
||||
SharePublicStartDependencies
|
||||
>
|
||||
{
|
||||
private url?: ServerUrlService;
|
||||
private version: string;
|
||||
|
||||
|
|
|
@ -7,9 +7,7 @@
|
|||
"id": "uiActions",
|
||||
"server": false,
|
||||
"browser": true,
|
||||
"requiredPlugins": [
|
||||
"dataViews"
|
||||
],
|
||||
"requiredPlugins": [],
|
||||
"requiredBundles": [
|
||||
"kibanaUtils",
|
||||
"kibanaReact"
|
||||
|
|
|
@ -13,7 +13,10 @@ export function plugin(initializerContext: PluginInitializerContext) {
|
|||
return new UiActionsPlugin(initializerContext);
|
||||
}
|
||||
|
||||
export type { UiActionsSetup, UiActionsStart } from './plugin';
|
||||
export type {
|
||||
UiActionsPublicSetup as UiActionsSetup,
|
||||
UiActionsPublicStart as UiActionsStart,
|
||||
} from './plugin';
|
||||
export type { UiActionsServiceParams } from './service';
|
||||
export { UiActionsService } from './service';
|
||||
export type { Action, ActionDefinition as UiActionsActionDefinition } from './actions';
|
||||
|
|
|
@ -8,11 +8,12 @@
|
|||
|
||||
import { CoreSetup, CoreStart } from '@kbn/core/public';
|
||||
import { coreMock } from '@kbn/core/public/mocks';
|
||||
import { Action, UiActionsSetup, UiActionsStart } from '.';
|
||||
import { Action } from '.';
|
||||
import { UiActionsPublicSetup, UiActionsPublicStart } from './plugin';
|
||||
import { plugin as pluginInitializer } from '.';
|
||||
|
||||
export type Setup = jest.Mocked<UiActionsSetup>;
|
||||
export type Start = jest.Mocked<UiActionsStart>;
|
||||
export type Setup = jest.Mocked<UiActionsPublicSetup>;
|
||||
export type Start = jest.Mocked<UiActionsPublicStart>;
|
||||
|
||||
const createSetupContract = (): Setup => {
|
||||
const setupContract: Setup = {
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
import { UiActionsService } from './service';
|
||||
import { setTheme } from './services';
|
||||
|
||||
export type UiActionsSetup = Pick<
|
||||
export type UiActionsPublicSetup = Pick<
|
||||
UiActionsService,
|
||||
| 'addTriggerAction'
|
||||
| 'attachAction'
|
||||
|
@ -26,14 +26,28 @@ export type UiActionsSetup = Pick<
|
|||
| 'unregisterAction'
|
||||
>;
|
||||
|
||||
export type UiActionsStart = PublicMethodsOf<UiActionsService>;
|
||||
export type UiActionsPublicStart = PublicMethodsOf<UiActionsService>;
|
||||
|
||||
export class UiActionsPlugin implements Plugin<UiActionsSetup, UiActionsStart> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface UiActionsPublicSetupDependencies {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface UiActionsPublicStartDependencies {}
|
||||
|
||||
export class UiActionsPlugin
|
||||
implements
|
||||
Plugin<
|
||||
UiActionsPublicSetup,
|
||||
UiActionsPublicStart,
|
||||
UiActionsPublicSetupDependencies,
|
||||
UiActionsPublicStartDependencies
|
||||
>
|
||||
{
|
||||
private readonly service = new UiActionsService();
|
||||
|
||||
constructor(initializerContext: PluginInitializerContext) {}
|
||||
constructor(_initializerContext: PluginInitializerContext) {}
|
||||
|
||||
public setup(core: CoreSetup): UiActionsSetup {
|
||||
public setup(core: CoreSetup): UiActionsPublicSetup {
|
||||
setTheme(core.theme);
|
||||
this.service.registerTrigger(rowClickTrigger);
|
||||
this.service.registerTrigger(visualizeFieldTrigger);
|
||||
|
@ -41,7 +55,7 @@ export class UiActionsPlugin implements Plugin<UiActionsSetup, UiActionsStart> {
|
|||
return this.service;
|
||||
}
|
||||
|
||||
public start(core: CoreStart): UiActionsStart {
|
||||
public start(_core: CoreStart): UiActionsPublicStart {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ export async function plugin() {
|
|||
|
||||
export type {
|
||||
AdvancedUiActionsServerPlugin as Plugin,
|
||||
SetupContract as AdvancedUiActionsSetup,
|
||||
StartContract as AdvancedUiActionsStart,
|
||||
UiActionsEnhancedServerSetup as AdvancedUiActionsSetup,
|
||||
UiActionsEnhancedServerStart as AdvancedUiActionsStart,
|
||||
} from './plugin';
|
||||
|
||||
export type {
|
||||
|
|
|
@ -12,24 +12,33 @@ import { EmbeddableSetup } from '@kbn/embeddable-plugin/server';
|
|||
import { dynamicActionEnhancement } from './dynamic_action_enhancement';
|
||||
import { ActionFactoryRegistry, SerializedEvent, ActionFactoryDefinition } from './types';
|
||||
|
||||
export interface SetupContract {
|
||||
export interface UiActionsEnhancedServerSetup {
|
||||
registerActionFactory: (definition: ActionFactoryDefinition) => void;
|
||||
}
|
||||
|
||||
export type StartContract = void;
|
||||
export type UiActionsEnhancedServerStart = void;
|
||||
|
||||
interface SetupDependencies {
|
||||
interface UiActionsEnhancedServerSetupDependencies {
|
||||
embeddable: EmbeddableSetup; // Embeddable are needed because they register basic triggers/actions.
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface UiActionsEnhancedServerStartDependencies {}
|
||||
|
||||
export class AdvancedUiActionsServerPlugin
|
||||
implements Plugin<SetupContract, StartContract, SetupDependencies>
|
||||
implements
|
||||
Plugin<
|
||||
UiActionsEnhancedServerSetup,
|
||||
UiActionsEnhancedServerStart,
|
||||
UiActionsEnhancedServerSetupDependencies,
|
||||
UiActionsEnhancedServerStartDependencies
|
||||
>
|
||||
{
|
||||
protected readonly actionFactories: ActionFactoryRegistry = new Map();
|
||||
|
||||
constructor() {}
|
||||
|
||||
public setup(core: CoreSetup, { embeddable }: SetupDependencies) {
|
||||
public setup(_core: CoreSetup, { embeddable }: UiActionsEnhancedServerSetupDependencies) {
|
||||
const getActionFactory = (actionFactoryId: string) => this.actionFactories.get(actionFactoryId);
|
||||
|
||||
embeddable.registerEnhancement(dynamicActionEnhancement(getActionFactory));
|
||||
|
|
|
@ -5,17 +5,28 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
import { CoreSetup, CoreStart, Plugin } from '@kbn/core/public';
|
||||
import { CustomBrandingPluginSetup, CustomBrandingPluginStart } from './types';
|
||||
import { Plugin } from '@kbn/core/public';
|
||||
import type {
|
||||
CustomBrandingPublicSetup,
|
||||
CustomBrandingPublicStart,
|
||||
CustomBrandingPublicSetupDependencies,
|
||||
CustomBrandingPublicStartDependencies,
|
||||
} from './types';
|
||||
|
||||
export class CustomBrandingPlugin
|
||||
implements Plugin<CustomBrandingPluginSetup, CustomBrandingPluginStart>
|
||||
implements
|
||||
Plugin<
|
||||
CustomBrandingPublicSetup,
|
||||
CustomBrandingPublicStart,
|
||||
CustomBrandingPublicSetupDependencies,
|
||||
CustomBrandingPublicStartDependencies
|
||||
>
|
||||
{
|
||||
public setup(core: CoreSetup): CustomBrandingPluginSetup {
|
||||
public setup(): CustomBrandingPublicSetup {
|
||||
return {};
|
||||
}
|
||||
|
||||
public start(core: CoreStart): CustomBrandingPluginStart {
|
||||
public start(): CustomBrandingPublicStart {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,13 @@
|
|||
* 2.0.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface CustomBrandingPluginSetup {}
|
||||
export interface CustomBrandingPublicSetup {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface CustomBrandingPluginStart {}
|
||||
export interface CustomBrandingPublicStart {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface CustomBrandingPublicSetupDependencies {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface CustomBrandingPublicStartDependencies {}
|
||||
|
|
|
@ -20,7 +20,12 @@ import { License } from '@kbn/license-api-guard-plugin/server';
|
|||
import { CustomBranding } from '@kbn/core-custom-branding-common';
|
||||
import { Subscription } from 'rxjs';
|
||||
import { PLUGIN } from '../common/constants';
|
||||
import { Dependencies } from './types';
|
||||
import type {
|
||||
CustomBrandingServerSetup,
|
||||
CustomBrandingServerStart,
|
||||
CustomBrandingServerStartDependencies,
|
||||
CustomBrandingServerSetupDependencies,
|
||||
} from './types';
|
||||
import { registerUiSettings } from './ui_settings';
|
||||
|
||||
const settingsKeys: Array<keyof CustomBranding> = [
|
||||
|
@ -31,7 +36,15 @@ const settingsKeys: Array<keyof CustomBranding> = [
|
|||
'pageTitle',
|
||||
];
|
||||
|
||||
export class CustomBrandingPlugin implements Plugin {
|
||||
export class CustomBrandingPlugin
|
||||
implements
|
||||
Plugin<
|
||||
CustomBrandingServerSetup,
|
||||
CustomBrandingServerStart,
|
||||
CustomBrandingServerSetupDependencies,
|
||||
CustomBrandingServerStartDependencies
|
||||
>
|
||||
{
|
||||
private readonly license: License;
|
||||
private readonly logger: Logger;
|
||||
private licensingSubscription?: Subscription;
|
||||
|
@ -73,7 +86,7 @@ export class CustomBrandingPlugin implements Plugin {
|
|||
return {};
|
||||
}
|
||||
|
||||
public start(core: CoreStart, { licensing }: Dependencies) {
|
||||
public start(_core: CoreStart, { licensing }: CustomBrandingServerStartDependencies) {
|
||||
this.logger.debug('customBranding: Started');
|
||||
this.license.start({
|
||||
pluginId: PLUGIN.ID,
|
||||
|
|
|
@ -12,7 +12,16 @@ import {
|
|||
import { CustomRequestHandlerContext } from '@kbn/core-http-request-handler-context-server';
|
||||
import { IRouter } from '@kbn/core/server';
|
||||
|
||||
export interface Dependencies {
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface CustomBrandingServerSetup {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface CustomBrandingServerStart {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface CustomBrandingServerSetupDependencies {}
|
||||
|
||||
export interface CustomBrandingServerStartDependencies {
|
||||
licensing: LicensingPluginStart;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,13 +9,13 @@
|
|||
"browser": true,
|
||||
"requiredPlugins": [
|
||||
"embeddable",
|
||||
"uiActions",
|
||||
"uiActionsEnhanced"
|
||||
],
|
||||
"requiredBundles": [
|
||||
"kibanaUtils",
|
||||
"kibanaReact",
|
||||
"imageEmbeddable"
|
||||
"imageEmbeddable",
|
||||
"uiActions"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ export interface GlobalSearchBarPluginStartDeps {
|
|||
usageCollection?: UsageCollectionSetup;
|
||||
}
|
||||
|
||||
export class GlobalSearchBarPlugin implements Plugin<{}, {}> {
|
||||
export class GlobalSearchBarPlugin implements Plugin<{}, {}, {}, GlobalSearchBarPluginStartDeps> {
|
||||
public setup({ analytics }: CoreSetup) {
|
||||
eventTypes.forEach((eventType) => {
|
||||
analytics.registerEventType(eventType);
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
"id": "notifications",
|
||||
"server": true,
|
||||
"browser": false,
|
||||
"requiredPlugins": [
|
||||
"optionalPlugins": [
|
||||
"actions",
|
||||
"licensing"
|
||||
]
|
||||
|
|
|
@ -10,7 +10,7 @@ export { config } from './config';
|
|||
|
||||
// This exports static code and TypeScript types,
|
||||
// as well as, Kibana Platform `plugin()` initializer.
|
||||
export type { NotificationsPluginStart } from './types';
|
||||
export type { NotificationsServerStart as NotificationsPluginStart } from './types';
|
||||
|
||||
export async function plugin(initializerContext: PluginInitializerContext) {
|
||||
const { NotificationsPlugin } = await import('./plugin');
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import type { PublicMethodsOf } from '@kbn/utility-types';
|
||||
import type { EmailService } from './services';
|
||||
import type { NotificationsPluginStart } from './types';
|
||||
import type { NotificationsServerStart } from './types';
|
||||
import type { NotificationsPlugin } from './plugin';
|
||||
|
||||
const emailServiceMock: jest.Mocked<EmailService> = {
|
||||
|
@ -19,7 +19,7 @@ const createEmailServiceMock = () => {
|
|||
return emailServiceMock;
|
||||
};
|
||||
|
||||
const startMock: jest.Mocked<NotificationsPluginStart> = {
|
||||
const startMock: jest.Mocked<NotificationsServerStart> = {
|
||||
isEmailServiceAvailable: jest.fn(),
|
||||
getEmailService: jest.fn(createEmailServiceMock),
|
||||
};
|
||||
|
@ -30,7 +30,7 @@ const createStartMock = () => {
|
|||
|
||||
const notificationsPluginMock: jest.Mocked<PublicMethodsOf<NotificationsPlugin>> = {
|
||||
setup: jest.fn(),
|
||||
start: jest.fn(createStartMock) as jest.Mock<NotificationsPluginStart>,
|
||||
start: jest.fn(createStartMock) as jest.Mock<NotificationsServerStart>,
|
||||
stop: jest.fn(),
|
||||
};
|
||||
|
||||
|
|
|
@ -7,14 +7,23 @@
|
|||
|
||||
import type { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '@kbn/core/server';
|
||||
import type {
|
||||
NotificationsPluginSetupDeps,
|
||||
NotificationsPluginStartDeps,
|
||||
NotificationsPluginStart,
|
||||
NotificationsServerSetupDependencies,
|
||||
NotificationsServerStartDependencies,
|
||||
NotificationsServerStart,
|
||||
NotificationsServerSetup,
|
||||
} from './types';
|
||||
import type { NotificationsConfigType } from './config';
|
||||
import { EmailServiceProvider } from './services/connectors_email_service_provider';
|
||||
|
||||
export class NotificationsPlugin implements Plugin<void, NotificationsPluginStart> {
|
||||
export class NotificationsPlugin
|
||||
implements
|
||||
Plugin<
|
||||
NotificationsServerSetup,
|
||||
NotificationsServerStart,
|
||||
NotificationsServerSetupDependencies,
|
||||
NotificationsServerStartDependencies
|
||||
>
|
||||
{
|
||||
private emailServiceProvider: EmailServiceProvider;
|
||||
|
||||
constructor(initializerContext: PluginInitializerContext<NotificationsConfigType>) {
|
||||
|
@ -24,11 +33,11 @@ export class NotificationsPlugin implements Plugin<void, NotificationsPluginStar
|
|||
);
|
||||
}
|
||||
|
||||
public setup(_core: CoreSetup, plugins: NotificationsPluginSetupDeps) {
|
||||
public setup(_core: CoreSetup, plugins: NotificationsServerSetupDependencies) {
|
||||
this.emailServiceProvider.setup(plugins);
|
||||
}
|
||||
|
||||
public start(_core: CoreStart, plugins: NotificationsPluginStartDeps) {
|
||||
public start(_core: CoreStart, plugins: NotificationsServerStartDependencies) {
|
||||
const emailStartContract = this.emailServiceProvider.start(plugins);
|
||||
|
||||
return {
|
||||
|
|
|
@ -9,6 +9,7 @@ import type { EmailServiceStart, EmailServiceSetupDeps, EmailServiceStartDeps }
|
|||
|
||||
// The 'notifications' plugin is currently only exposing an email service.
|
||||
// If we want to expose other services in the future, we should update these types accordingly
|
||||
export type NotificationsPluginSetupDeps = EmailServiceSetupDeps;
|
||||
export type NotificationsPluginStartDeps = EmailServiceStartDeps;
|
||||
export type NotificationsPluginStart = EmailServiceStart;
|
||||
export type NotificationsServerSetup = void;
|
||||
export type NotificationsServerStart = EmailServiceStart;
|
||||
export type NotificationsServerSetupDependencies = EmailServiceSetupDeps;
|
||||
export type NotificationsServerStartDependencies = EmailServiceStartDeps;
|
||||
|
|
|
@ -15,13 +15,11 @@
|
|||
"data",
|
||||
"discover",
|
||||
"fieldFormats",
|
||||
"esUiShared",
|
||||
"home",
|
||||
"management",
|
||||
"licensing",
|
||||
"uiActions",
|
||||
"taskManager",
|
||||
"embeddable",
|
||||
"screenshotMode",
|
||||
"share",
|
||||
"features"
|
||||
|
@ -33,8 +31,10 @@
|
|||
"screenshotting"
|
||||
],
|
||||
"requiredBundles": [
|
||||
"kibanaReact",
|
||||
"discover"
|
||||
"discover",
|
||||
"embeddable",
|
||||
"esUiShared",
|
||||
"kibanaReact"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,11 @@
|
|||
"plugin",
|
||||
],
|
||||
"requiredPlugins": [
|
||||
"kibanaReact",
|
||||
"cloud"
|
||||
],
|
||||
"optionalPlugins": [],
|
||||
"requiredBundles": []
|
||||
"requiredBundles": [
|
||||
"kibanaReact",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,4 +13,7 @@ export const plugin = async (initializerContext: PluginInitializerContext) => {
|
|||
return new ServerlessPlugin(initializerContext);
|
||||
};
|
||||
|
||||
export type { ServerlessPluginSetup, ServerlessPluginStart } from './types';
|
||||
export type {
|
||||
ServerlessServerSetup as ServerlessPluginSetup,
|
||||
ServerlessServerStart as ServerlessPluginStart,
|
||||
} from './types';
|
||||
|
|
|
@ -14,7 +14,12 @@ import { getConfigDirectory } from '@kbn/utils';
|
|||
import { ProjectType } from '@kbn/serverless-types';
|
||||
|
||||
import { ALL_COMMON_SETTINGS } from '@kbn/serverless-common-settings';
|
||||
import { ServerlessPluginSetup, ServerlessPluginStart } from './types';
|
||||
import type {
|
||||
ServerlessServerSetup,
|
||||
ServerlessServerStart,
|
||||
ServerlessServerSetupDependencies,
|
||||
ServerlessServerStartDependencies,
|
||||
} from './types';
|
||||
import { ServerlessConfig } from './config';
|
||||
import { API_SWITCH_PROJECT } from '../common';
|
||||
|
||||
|
@ -34,7 +39,15 @@ const typeToIdMap: Record<ProjectType, string> = {
|
|||
search: 'es',
|
||||
};
|
||||
|
||||
export class ServerlessPlugin implements Plugin<ServerlessPluginSetup, ServerlessPluginStart> {
|
||||
export class ServerlessPlugin
|
||||
implements
|
||||
Plugin<
|
||||
ServerlessServerSetup,
|
||||
ServerlessServerStart,
|
||||
ServerlessServerSetupDependencies,
|
||||
ServerlessServerStartDependencies
|
||||
>
|
||||
{
|
||||
private readonly config: ServerlessConfig;
|
||||
private projectSettingsAdded: boolean = false;
|
||||
|
||||
|
|
|
@ -5,9 +5,15 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
export interface ServerlessPluginSetup {
|
||||
export interface ServerlessServerSetup {
|
||||
setupProjectSettings(keys: string[]): void;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface ServerlessPluginStart {}
|
||||
export interface ServerlessServerStart {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface ServerlessServerSetupDependencies {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface ServerlessServerStartDependencies {}
|
||||
|
|
|
@ -20,11 +20,10 @@
|
|||
"serverless",
|
||||
"observability",
|
||||
"observabilityShared",
|
||||
"kibanaReact",
|
||||
"management",
|
||||
"cloud"
|
||||
],
|
||||
"optionalPlugins": [],
|
||||
"requiredBundles": []
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,6 +14,6 @@ export function plugin() {
|
|||
}
|
||||
|
||||
export type {
|
||||
ServerlessObservabilityPluginSetup,
|
||||
ServerlessObservabilityPluginStart,
|
||||
ServerlessObservabilityPublicSetup as ServerlessObservabilityPluginSetup,
|
||||
ServerlessObservabilityPublicStart as ServerlessObservabilityPluginStart,
|
||||
} from './types';
|
||||
|
|
|
@ -12,22 +12,28 @@ import { appCategories } from '@kbn/management-cards-navigation/src/types';
|
|||
import { getObservabilitySideNavComponent } from './components/side_navigation';
|
||||
import { createObservabilityDashboardRegistration } from './logs_signal/overview_registration';
|
||||
import {
|
||||
ServerlessObservabilityPluginSetup,
|
||||
ServerlessObservabilityPluginStart,
|
||||
ServerlessObservabilityPluginSetupDependencies,
|
||||
ServerlessObservabilityPluginStartDependencies,
|
||||
ServerlessObservabilityPublicSetup,
|
||||
ServerlessObservabilityPublicStart,
|
||||
ServerlessObservabilityPublicSetupDependencies,
|
||||
ServerlessObservabilityPublicStartDependencies,
|
||||
} from './types';
|
||||
|
||||
export class ServerlessObservabilityPlugin
|
||||
implements Plugin<ServerlessObservabilityPluginSetup, ServerlessObservabilityPluginStart>
|
||||
implements
|
||||
Plugin<
|
||||
ServerlessObservabilityPublicSetup,
|
||||
ServerlessObservabilityPublicStart,
|
||||
ServerlessObservabilityPublicSetupDependencies,
|
||||
ServerlessObservabilityPublicStartDependencies
|
||||
>
|
||||
{
|
||||
public setup(
|
||||
_core: CoreSetup<
|
||||
ServerlessObservabilityPluginStartDependencies,
|
||||
ServerlessObservabilityPluginStart
|
||||
ServerlessObservabilityPublicStartDependencies,
|
||||
ServerlessObservabilityPublicStart
|
||||
>,
|
||||
setupDeps: ServerlessObservabilityPluginSetupDependencies
|
||||
): ServerlessObservabilityPluginSetup {
|
||||
setupDeps: ServerlessObservabilityPublicSetupDependencies
|
||||
): ServerlessObservabilityPublicSetup {
|
||||
setupDeps.observability.dashboard.register(
|
||||
createObservabilityDashboardRegistration({
|
||||
search: _core
|
||||
|
@ -41,8 +47,8 @@ export class ServerlessObservabilityPlugin
|
|||
|
||||
public start(
|
||||
core: CoreStart,
|
||||
setupDeps: ServerlessObservabilityPluginStartDependencies
|
||||
): ServerlessObservabilityPluginStart {
|
||||
setupDeps: ServerlessObservabilityPublicStartDependencies
|
||||
): ServerlessObservabilityPublicStart {
|
||||
const { observabilityShared, serverless, management, cloud } = setupDeps;
|
||||
observabilityShared.setIsSidebarEnabled(false);
|
||||
serverless.setProjectHome('/app/observability/landing');
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0; you may not use this file except in compliance with the Elastic License
|
||||
* 2.0.
|
||||
*/
|
||||
|
||||
import { CoreStart } from '@kbn/core/public';
|
||||
import type { CloudStart } from '@kbn/cloud-plugin/public';
|
||||
import React from 'react';
|
||||
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
|
||||
import type { ServerlessObservabilityPluginStartDependencies } from './types';
|
||||
|
||||
type Services = CoreStart & ServerlessObservabilityPluginStartDependencies;
|
||||
|
||||
export const KibanaServicesProvider: React.FC<{
|
||||
core: CoreStart;
|
||||
pluginsStart: ServerlessObservabilityPluginStartDependencies;
|
||||
cloud: CloudStart;
|
||||
}> = ({ core, pluginsStart, cloud, children }) => {
|
||||
const services: Services = { ...core, ...pluginsStart, cloud };
|
||||
return <KibanaContextProvider services={services}>{children}</KibanaContextProvider>;
|
||||
};
|
|
@ -16,19 +16,19 @@ import {
|
|||
import { ServerlessPluginSetup, ServerlessPluginStart } from '@kbn/serverless/public';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface ServerlessObservabilityPluginSetup {}
|
||||
export interface ServerlessObservabilityPublicSetup {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
||||
export interface ServerlessObservabilityPluginStart {}
|
||||
export interface ServerlessObservabilityPublicStart {}
|
||||
|
||||
export interface ServerlessObservabilityPluginSetupDependencies {
|
||||
export interface ServerlessObservabilityPublicSetupDependencies {
|
||||
observability: ObservabilityPublicSetup;
|
||||
observabilityShared: ObservabilitySharedPluginSetup;
|
||||
serverless: ServerlessPluginSetup;
|
||||
management: ManagementSetup;
|
||||
}
|
||||
|
||||
export interface ServerlessObservabilityPluginStartDependencies {
|
||||
export interface ServerlessObservabilityPublicStartDependencies {
|
||||
observabilityShared: ObservabilitySharedPluginStart;
|
||||
serverless: ServerlessPluginStart;
|
||||
management: ManagementStart;
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
"@kbn/management-plugin",
|
||||
"@kbn/serverless",
|
||||
"@kbn/observability-shared-plugin",
|
||||
"@kbn/kibana-react-plugin",
|
||||
"@kbn/shared-ux-chrome-navigation",
|
||||
"@kbn/i18n",
|
||||
"@kbn/management-cards-navigation",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue