ContextSetup
| [ContextSetup](./kibana-plugin-core-public.contextsetup.md) |
-| [docLinks](./kibana-plugin-core-public.coresetup.doclinks.md) | DocLinksSetup
| [DocLinksSetup](./kibana-plugin-core-public.doclinkssetup.md) |
| [fatalErrors](./kibana-plugin-core-public.coresetup.fatalerrors.md) | FatalErrorsSetup
| [FatalErrorsSetup](./kibana-plugin-core-public.fatalerrorssetup.md) |
| [getStartServices](./kibana-plugin-core-public.coresetup.getstartservices.md) | StartServicesAccessor<TPluginsStart, TStart>
| [StartServicesAccessor](./kibana-plugin-core-public.startservicesaccessor.md) |
| [http](./kibana-plugin-core-public.coresetup.http.md) | HttpSetup
| [HttpSetup](./kibana-plugin-core-public.httpsetup.md) |
diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinkssetup.doc_link_version.md b/docs/development/core/public/kibana-plugin-core-public.doclinkssetup.doc_link_version.md
deleted file mode 100644
index c8d13bab92b05..0000000000000
--- a/docs/development/core/public/kibana-plugin-core-public.doclinkssetup.doc_link_version.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [DocLinksSetup](./kibana-plugin-core-public.doclinkssetup.md) > [DOC\_LINK\_VERSION](./kibana-plugin-core-public.doclinkssetup.doc_link_version.md)
-
-## DocLinksSetup.DOC\_LINK\_VERSION property
-
-Signature:
-
-```typescript
-readonly DOC_LINK_VERSION: string;
-```
diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinkssetup.elastic_website_url.md b/docs/development/core/public/kibana-plugin-core-public.doclinkssetup.elastic_website_url.md
deleted file mode 100644
index d8493148bae10..0000000000000
--- a/docs/development/core/public/kibana-plugin-core-public.doclinkssetup.elastic_website_url.md
+++ /dev/null
@@ -1,11 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [DocLinksSetup](./kibana-plugin-core-public.doclinkssetup.md) > [ELASTIC\_WEBSITE\_URL](./kibana-plugin-core-public.doclinkssetup.elastic_website_url.md)
-
-## DocLinksSetup.ELASTIC\_WEBSITE\_URL property
-
-Signature:
-
-```typescript
-readonly ELASTIC_WEBSITE_URL: string;
-```
diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinkssetup.md b/docs/development/core/public/kibana-plugin-core-public.doclinkssetup.md
deleted file mode 100644
index 9e7938bd9c850..0000000000000
--- a/docs/development/core/public/kibana-plugin-core-public.doclinkssetup.md
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [DocLinksSetup](./kibana-plugin-core-public.doclinkssetup.md)
-
-## DocLinksSetup interface
-
-
-Signature:
-
-```typescript
-export interface DocLinksSetup
-```
-
-## Properties
-
-| Property | Type | Description |
-| --- | --- | --- |
-| [DOC\_LINK\_VERSION](./kibana-plugin-core-public.doclinkssetup.doc_link_version.md) | string
| |
-| [ELASTIC\_WEBSITE\_URL](./kibana-plugin-core-public.doclinkssetup.elastic_website_url.md) | string
| |
-| [links](./kibana-plugin-core-public.doclinkssetup.links.md) | {
readonly dashboard: {
readonly drilldowns: string;
};
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly startup: string;
readonly exportedFields: string;
};
readonly auditbeat: {
readonly base: string;
};
readonly metricbeat: {
readonly base: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly date_histogram: string;
readonly date_range: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessSyntax: string;
readonly luceneExpressions: string;
};
readonly indexPatterns: {
readonly loadingData: string;
readonly introduction: string;
};
readonly kibana: string;
readonly siem: {
readonly guide: string;
readonly gettingStarted: string;
};
readonly query: {
readonly luceneQuerySyntax: string;
readonly queryDsl: string;
readonly kueryQuerySyntax: string;
};
readonly date: {
readonly dateMath: string;
};
readonly management: Record<string, string>;
}
| |
-
diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.doc_link_version.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.doc_link_version.md
new file mode 100644
index 0000000000000..8140b3fcf380f
--- /dev/null
+++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.doc_link_version.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) > [DOC\_LINK\_VERSION](./kibana-plugin-core-public.doclinksstart.doc_link_version.md)
+
+## DocLinksStart.DOC\_LINK\_VERSION property
+
+Signature:
+
+```typescript
+readonly DOC_LINK_VERSION: string;
+```
diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.elastic_website_url.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.elastic_website_url.md
new file mode 100644
index 0000000000000..af770ed3055aa
--- /dev/null
+++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.elastic_website_url.md
@@ -0,0 +1,11 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) > [ELASTIC\_WEBSITE\_URL](./kibana-plugin-core-public.doclinksstart.elastic_website_url.md)
+
+## DocLinksStart.ELASTIC\_WEBSITE\_URL property
+
+Signature:
+
+```typescript
+readonly ELASTIC_WEBSITE_URL: string;
+```
diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinkssetup.links.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md
similarity index 94%
rename from docs/development/core/public/kibana-plugin-core-public.doclinkssetup.links.md
rename to docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md
index 80e2702451d86..a03b1b74fc1ac 100644
--- a/docs/development/core/public/kibana-plugin-core-public.doclinkssetup.links.md
+++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.links.md
@@ -1,8 +1,8 @@
-[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [DocLinksSetup](./kibana-plugin-core-public.doclinkssetup.md) > [links](./kibana-plugin-core-public.doclinkssetup.links.md)
+[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) > [links](./kibana-plugin-core-public.doclinksstart.links.md)
-## DocLinksSetup.links property
+## DocLinksStart.links property
Signature:
diff --git a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md
index af2a41b691727..8f739950d249b 100644
--- a/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md
+++ b/docs/development/core/public/kibana-plugin-core-public.doclinksstart.md
@@ -2,11 +2,20 @@
[Home](./index.md) > [kibana-plugin-core-public](./kibana-plugin-core-public.md) > [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md)
-## DocLinksStart type
+## DocLinksStart interface
Signature:
```typescript
-export declare type DocLinksStart = DocLinksSetup;
+export interface DocLinksStart
```
+
+## Properties
+
+| Property | Type | Description |
+| --- | --- | --- |
+| [DOC\_LINK\_VERSION](./kibana-plugin-core-public.doclinksstart.doc_link_version.md) | string
| |
+| [ELASTIC\_WEBSITE\_URL](./kibana-plugin-core-public.doclinksstart.elastic_website_url.md) | string
| |
+| [links](./kibana-plugin-core-public.doclinksstart.links.md) | {
readonly dashboard: {
readonly drilldowns: string;
};
readonly filebeat: {
readonly base: string;
readonly installation: string;
readonly configuration: string;
readonly elasticsearchOutput: string;
readonly startup: string;
readonly exportedFields: string;
};
readonly auditbeat: {
readonly base: string;
};
readonly metricbeat: {
readonly base: string;
};
readonly heartbeat: {
readonly base: string;
};
readonly logstash: {
readonly base: string;
};
readonly functionbeat: {
readonly base: string;
};
readonly winlogbeat: {
readonly base: string;
};
readonly aggs: {
readonly date_histogram: string;
readonly date_range: string;
readonly filter: string;
readonly filters: string;
readonly geohash_grid: string;
readonly histogram: string;
readonly ip_range: string;
readonly range: string;
readonly significant_terms: string;
readonly terms: string;
readonly avg: string;
readonly avg_bucket: string;
readonly max_bucket: string;
readonly min_bucket: string;
readonly sum_bucket: string;
readonly cardinality: string;
readonly count: string;
readonly cumulative_sum: string;
readonly derivative: string;
readonly geo_bounds: string;
readonly geo_centroid: string;
readonly max: string;
readonly median: string;
readonly min: string;
readonly moving_avg: string;
readonly percentile_ranks: string;
readonly serial_diff: string;
readonly std_dev: string;
readonly sum: string;
readonly top_hits: string;
};
readonly scriptedFields: {
readonly scriptFields: string;
readonly scriptAggs: string;
readonly painless: string;
readonly painlessApi: string;
readonly painlessSyntax: string;
readonly luceneExpressions: string;
};
readonly indexPatterns: {
readonly loadingData: string;
readonly introduction: string;
};
readonly kibana: string;
readonly siem: {
readonly guide: string;
readonly gettingStarted: string;
};
readonly query: {
readonly luceneQuerySyntax: string;
readonly queryDsl: string;
readonly kueryQuerySyntax: string;
};
readonly date: {
readonly dateMath: string;
};
readonly management: Record<string, string>;
}
| |
+
diff --git a/docs/development/core/public/kibana-plugin-core-public.md b/docs/development/core/public/kibana-plugin-core-public.md
index dda6b6ac0c60a..b0612ff4d5b65 100644
--- a/docs/development/core/public/kibana-plugin-core-public.md
+++ b/docs/development/core/public/kibana-plugin-core-public.md
@@ -65,7 +65,7 @@ The plugin integrates with the core system via lifecycle events: `setup`
| [ContextSetup](./kibana-plugin-core-public.contextsetup.md) | An object that handles registration of context providers and configuring handlers with context. |
| [CoreSetup](./kibana-plugin-core-public.coresetup.md) | Core services exposed to the Plugin
setup lifecycle |
| [CoreStart](./kibana-plugin-core-public.corestart.md) | Core services exposed to the Plugin
start lifecycle |
-| [DocLinksSetup](./kibana-plugin-core-public.doclinkssetup.md) | |
+| [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) | |
| [EnvironmentMode](./kibana-plugin-core-public.environmentmode.md) | |
| [ErrorToastOptions](./kibana-plugin-core-public.errortoastoptions.md) | Options available for [IToasts](./kibana-plugin-core-public.itoasts.md) error APIs. |
| [FatalErrorInfo](./kibana-plugin-core-public.fatalerrorinfo.md) | Represents the message
and stack
of a fatal Error |
@@ -157,7 +157,6 @@ The plugin integrates with the core system via lifecycle events: `setup`
| [ChromeHelpExtensionMenuGitHubLink](./kibana-plugin-core-public.chromehelpextensionmenugithublink.md) | |
| [ChromeHelpExtensionMenuLink](./kibana-plugin-core-public.chromehelpextensionmenulink.md) | |
| [ChromeNavLinkUpdateableFields](./kibana-plugin-core-public.chromenavlinkupdateablefields.md) | |
-| [DocLinksStart](./kibana-plugin-core-public.doclinksstart.md) | |
| [FatalErrorsStart](./kibana-plugin-core-public.fatalerrorsstart.md) | FatalErrors stop the Kibana Public Core and displays a fatal error screen with details about the Kibana build and the error. |
| [Freezable](./kibana-plugin-core-public.freezable.md) | |
| [HandlerContextType](./kibana-plugin-core-public.handlercontexttype.md) | Extracts the type of the first argument of a [HandlerFunction](./kibana-plugin-core-public.handlerfunction.md) to represent the type of the context. |
diff --git a/docs/development/core/server/kibana-plugin-core-server.appenderconfigtype.md b/docs/development/core/server/kibana-plugin-core-server.appenderconfigtype.md
new file mode 100644
index 0000000000000..9c70e658014b3
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.appenderconfigtype.md
@@ -0,0 +1,12 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [AppenderConfigType](./kibana-plugin-core-server.appenderconfigtype.md)
+
+## AppenderConfigType type
+
+
+Signature:
+
+```typescript
+export declare type AppenderConfigType = TypeOfStartServicesAccessor<TPluginsStart, TStart>
| [StartServicesAccessor](./kibana-plugin-core-server.startservicesaccessor.md) |
| [http](./kibana-plugin-core-server.coresetup.http.md) | HttpServiceSetup & {
resources: HttpResources;
}
| [HttpServiceSetup](./kibana-plugin-core-server.httpservicesetup.md) |
+| [logging](./kibana-plugin-core-server.coresetup.logging.md) | LoggingServiceSetup
| [LoggingServiceSetup](./kibana-plugin-core-server.loggingservicesetup.md) |
| [metrics](./kibana-plugin-core-server.coresetup.metrics.md) | MetricsServiceSetup
| [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) |
| [savedObjects](./kibana-plugin-core-server.coresetup.savedobjects.md) | SavedObjectsServiceSetup
| [SavedObjectsServiceSetup](./kibana-plugin-core-server.savedobjectsservicesetup.md) |
| [status](./kibana-plugin-core-server.coresetup.status.md) | StatusServiceSetup
| [StatusServiceSetup](./kibana-plugin-core-server.statusservicesetup.md) |
diff --git a/docs/development/core/server/kibana-plugin-core-server.loggerconfigtype.md b/docs/development/core/server/kibana-plugin-core-server.loggerconfigtype.md
new file mode 100644
index 0000000000000..c389b7e627995
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.loggerconfigtype.md
@@ -0,0 +1,12 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LoggerConfigType](./kibana-plugin-core-server.loggerconfigtype.md)
+
+## LoggerConfigType type
+
+
+Signature:
+
+```typescript
+export declare type LoggerConfigType = TypeOfRecord<string, AppenderConfigType> | Map<string, AppenderConfigType>
| |
+| [loggers](./kibana-plugin-core-server.loggercontextconfiginput.loggers.md) | LoggerConfigType[]
| |
+
diff --git a/docs/development/core/server/kibana-plugin-core-server.loggingservicesetup.configure.md b/docs/development/core/server/kibana-plugin-core-server.loggingservicesetup.configure.md
new file mode 100644
index 0000000000000..04a3cf9aff644
--- /dev/null
+++ b/docs/development/core/server/kibana-plugin-core-server.loggingservicesetup.configure.md
@@ -0,0 +1,42 @@
+
+
+[Home](./index.md) > [kibana-plugin-core-server](./kibana-plugin-core-server.md) > [LoggingServiceSetup](./kibana-plugin-core-server.loggingservicesetup.md) > [configure](./kibana-plugin-core-server.loggingservicesetup.configure.md)
+
+## LoggingServiceSetup.configure() method
+
+Customizes the logging config for the plugin's context.
+
+Signature:
+
+```typescript
+configure(config$: ObservableObservable<LoggerContextConfigInput>
| |
+
+Returns:
+
+`void`
+
+## Remarks
+
+Assumes that that the `context` property of the individual `logger` items emitted by `config$` are relative to the plugin's logging context (defaults to `plugins.LoggerFactory
interface is to define a way to retrieve a context-based logger instance. |
+| [LoggingServiceSetup](./kibana-plugin-core-server.loggingservicesetup.md) | Provides APIs to plugins for customizing the plugin's logger. |
| [LogMeta](./kibana-plugin-core-server.logmeta.md) | Contextual metadata |
| [MetricsServiceSetup](./kibana-plugin-core-server.metricsservicesetup.md) | APIs to retrieves metrics gathered and exposed by the core platform. |
| [NodesVersionCompatibility](./kibana-plugin-core-server.nodesversioncompatibility.md) | |
@@ -209,6 +211,7 @@ The plugin integrates with the core system via lifecycle events: `setup`
| Type Alias | Description |
| --- | --- |
+| [AppenderConfigType](./kibana-plugin-core-server.appenderconfigtype.md) | |
| [AuthenticationHandler](./kibana-plugin-core-server.authenticationhandler.md) | See [AuthToolkit](./kibana-plugin-core-server.authtoolkit.md). |
| [AuthHeaders](./kibana-plugin-core-server.authheaders.md) | Auth Headers map |
| [AuthResult](./kibana-plugin-core-server.authresult.md) | |
@@ -242,6 +245,7 @@ The plugin integrates with the core system via lifecycle events: `setup`
| [KibanaResponseFactory](./kibana-plugin-core-server.kibanaresponsefactory.md) | Creates an object containing request response payload, HTTP headers, error details, and other data transmitted to the client. |
| [KnownHeaders](./kibana-plugin-core-server.knownheaders.md) | Set of well-known HTTP headers. |
| [LifecycleResponseFactory](./kibana-plugin-core-server.lifecycleresponsefactory.md) | Creates an object containing redirection or error response with error details, HTTP headers, and other data transmitted to the client. |
+| [LoggerConfigType](./kibana-plugin-core-server.loggerconfigtype.md) | |
| [MIGRATION\_ASSISTANCE\_INDEX\_ACTION](./kibana-plugin-core-server.migration_assistance_index_action.md) | |
| [MIGRATION\_DEPRECATION\_LEVEL](./kibana-plugin-core-server.migration_deprecation_level.md) | |
| [MutatingOperationRefreshSetting](./kibana-plugin-core-server.mutatingoperationrefreshsetting.md) | Elasticsearch Refresh setting for mutating operation |
diff --git a/packages/kbn-storybook/lib/webpack.dll.config.js b/packages/kbn-storybook/lib/webpack.dll.config.js
index bc871fab471b2..534f503e2956a 100644
--- a/packages/kbn-storybook/lib/webpack.dll.config.js
+++ b/packages/kbn-storybook/lib/webpack.dll.config.js
@@ -73,7 +73,6 @@ module.exports = {
'rxjs',
'sinon',
'tinycolor2',
- './src/legacy/ui/public/styles/font_awesome.less',
'./src/legacy/ui/public/styles/bootstrap/bootstrap_light.less',
],
plugins: [
diff --git a/src/core/MIGRATION.md b/src/core/MIGRATION.md
index ce2d652257e1f..90b1bb4fd5320 100644
--- a/src/core/MIGRATION.md
+++ b/src/core/MIGRATION.md
@@ -15,15 +15,15 @@
- [Switch to new platform services](#switch-to-new-platform-services)
- [Migrate to the new plugin system](#migrate-to-the-new-plugin-system)
- [Browser-side plan of action](#browser-side-plan-of-action)
- - [1. Create a plugin definition file](#1-create-a-plugin-definition-file)
- - [2. Export all static code and types from `public/index.ts`](#2-export-all-static-code-and-types-from-publicindexts)
- - [3. Export your runtime contract](#3-export-your-runtime-contract)
- - [4. Move "owned" UI modules into your plugin and expose them from your public contract](#4-move-owned-ui-modules-into-your-plugin-and-expose-them-from-your-public-contract)
- - [5. Provide plugin extension points decoupled from angular.js](#5-provide-plugin-extension-points-decoupled-from-angularjs)
- - [6. Move all webpack alias imports into uiExport entry files](#6-move-all-webpack-alias-imports-into-uiexport-entry-files)
- - [7. Switch to new platform services](#7-switch-to-new-platform-services)
- - [8. Migrate to the new plugin system](#8-migrate-to-the-new-plugin-system)
- - [Bonus: Tips for complex migration scenarios](#bonus-tips-for-complex-migration-scenarios)
+ - [1. Create a plugin definition file](#1-create-a-plugin-definition-file)
+ - [2. Export all static code and types from `public/index.ts`](#2-export-all-static-code-and-types-from-publicindexts)
+ - [3. Export your runtime contract](#3-export-your-runtime-contract)
+ - [4. Move "owned" UI modules into your plugin and expose them from your public contract](#4-move-owned-ui-modules-into-your-plugin-and-expose-them-from-your-public-contract)
+ - [5. Provide plugin extension points decoupled from angular.js](#5-provide-plugin-extension-points-decoupled-from-angularjs)
+ - [6. Move all webpack alias imports into uiExport entry files](#6-move-all-webpack-alias-imports-into-uiexport-entry-files)
+ - [7. Switch to new platform services](#7-switch-to-new-platform-services)
+ - [8. Migrate to the new plugin system](#8-migrate-to-the-new-plugin-system)
+ - [Bonus: Tips for complex migration scenarios](#bonus-tips-for-complex-migration-scenarios)
- [Keep Kibana fast](#keep-kibana-fast)
- [Frequently asked questions](#frequently-asked-questions)
- [Is migrating a plugin an all-or-nothing thing?](#is-migrating-a-plugin-an-all-or-nothing-thing)
@@ -59,6 +59,7 @@
- [On the client side](#on-the-client-side)
- [Updates an application navlink at runtime](#updates-an-application-navlink-at-runtime)
- [Logging config migration](#logging-config-migration)
+ - [Use HashRouter in migrated apps](#use-react-hashrouter-in-migrated-apps)
Make no mistake, it is going to take a lot of work to move certain plugins to the new platform. Our target is to migrate the entire repo over to the new platform throughout 7.x and to remove the legacy plugin system no later than 8.0, and this is only possible if teams start on the effort now.
@@ -100,6 +101,7 @@ src/plugins
"ui": true
}
```
+
More details about[manifest file format](/docs/development/core/server/kibana-plugin-core-server.pluginmanifest.md)
Note that `package.json` files are irrelevant to and ignored by the new platform.
@@ -121,8 +123,7 @@ export function plugin(initializerContext: PluginInitializerContext) {
import { PluginInitializerContext, CoreSetup, CoreStart } from 'kibana/server';
export class Plugin {
- constructor(initializerContext: PluginInitializerContext) {
- }
+ constructor(initializerContext: PluginInitializerContext) {}
public setup(core: CoreSetup) {
// called when plugin is setting up
@@ -155,8 +156,7 @@ export function plugin(initializerContext: PluginInitializerContext) {
import { PluginInitializerContext, CoreSetup, CoreStart } from 'kibana/server';
export class Plugin {
- constructor(initializerContext: PluginInitializerContext) {
- }
+ constructor(initializerContext: PluginInitializerContext) {}
public setup(core: CoreSetup) {
// called when plugin is setting up during Kibana's startup sequence
@@ -234,7 +234,7 @@ export class Plugin {
return {
getFoo() {
return 'foo';
- }
+ },
};
}
@@ -242,8 +242,8 @@ export class Plugin {
return {
getBar() {
return 'bar';
- }
- }
+ },
+ };
}
}
```
@@ -255,9 +255,7 @@ Unlike core, capabilities exposed by plugins are _not_ automatically injected in
```json
{
"id": "demo",
- "requiredPlugins": [
- "foobar"
- ],
+ "requiredPlugins": ["foobar"],
"server": true,
"ui": true
}
@@ -376,15 +374,15 @@ export default (kibana) => {
method: 'POST',
async handler(request) {
search(server, request); // target acquired
- }
+ },
});
server.expose('getDemoBar', () => {
return `Demo ${server.plugins.foo.getBar()}`;
});
- }
+ },
});
-}
+};
```
This example legacy plugin uses hapi's `server` object directly inside of its `init` function, which is something we can address in a later step. What we need to address in this step is when we pass the raw `server` and `request` objects into our custom `search` function.
@@ -397,11 +395,10 @@ Instead, we identify which functionality we actually need from those objects and
import { ElasticsearchPlugin, Request } from '../elasticsearch';
export interface ServerFacade {
plugins: {
- elasticsearch: ElasticsearchPlugin
- }
-}
-export interface RequestFacade extends Request {
+ elasticsearch: ElasticsearchPlugin;
+ };
}
+export interface RequestFacade extends Request {}
// likely imported from another file
function search(server: ServerFacade, request: RequestFacade) {
@@ -416,27 +413,27 @@ export default (kibana) => {
init(server) {
const serverFacade: ServerFacade = {
plugins: {
- elasticsearch: server.plugins.elasticsearch
- }
- }
+ elasticsearch: server.plugins.elasticsearch,
+ },
+ };
server.route({
path: '/api/demo_plugin/search',
method: 'POST',
async handler(request) {
const requestFacade: RequestFacade = {
- headers: request.headers
+ headers: request.headers,
};
search(serverFacade, requestFacade);
- }
+ },
});
server.expose('getDemoBar', () => {
return `Demo ${server.plugins.foo.getBar()}`;
});
- }
+ },
});
-}
+};
```
This change might seem trivial, but it's important for two reasons.
@@ -459,9 +456,9 @@ export default (kibana) => {
init(server) {
const serverFacade: ServerFacade = {
plugins: {
- elasticsearch: server.plugins.elasticsearch
- }
- }
+ elasticsearch: server.plugins.elasticsearch,
+ },
+ };
// HTTP functionality from legacy
server.route({
@@ -469,19 +466,19 @@ export default (kibana) => {
method: 'POST',
async handler(request) {
const requestFacade: RequestFacade = {
- headers: request.headers
+ headers: request.headers,
};
search(serverFacade, requestFacade);
- }
+ },
});
// Exposing functionality for other plugins
server.expose('getDemoBar', () => {
return `Demo ${server.plugins.foo.getBar()}`; // Accessing functionality from another plugin
});
- }
+ },
});
-}
+};
```
We now move this logic into a new plugin definition, which is based off of the conventions used in real new platform plugins. While the legacy plugin definition is in the root of the plugin, this new plugin definition will be under the plugin's `server/` directory since it is only the server-side plugin definition.
@@ -492,18 +489,18 @@ import { CoreSetup, Plugin } from 'src/core/server';
import { ElasticsearchPlugin } from '../elasticsearch';
interface FooSetup {
- getBar(): string
+ getBar(): string;
}
// We inject the miminal legacy dependencies into our plugin including dependencies on other legacy
// plugins. Take care to only expose the legacy functionality you need e.g. don't inject the whole
// `Legacy.Server` if you only depend on `Legacy.Server['route']`.
interface LegacySetup {
- route: Legacy.Server['route']
+ route: Legacy.Server['route'];
plugins: {
- elasticsearch: ElasticsearchPlugin, // note: Elasticsearch is in CoreSetup in NP, rather than a plugin
- foo: FooSetup
- }
+ elasticsearch: ElasticsearchPlugin; // note: Elasticsearch is in CoreSetup in NP, rather than a plugin
+ foo: FooSetup;
+ };
}
// Define the public API's for our plugins setup and start lifecycle
@@ -524,26 +521,26 @@ export class DemoPlugin implements Plugin