Breaking changes in 7.6

This page discusses the breaking changes that you need to be aware of when migrating your application to Kibana 7.6.

Breaking changes for users

There are no user-facing breaking changes in 7.6.

Breaking changes for plugin developers

Kibana no longer crashes when a plugin version does not match the server

#54404

Kibana no longer crashes when a plugin is used against an incompatible Kibana version. A warning is now displayed in the console instead of throwing and crashing.

Generate legacy vars when rendering all applications

#54768

Rendering any type of application, even ones for the new platform, should still generate legacy vars injected into the page metadata. This ensures these vars are injected for HTTP route rendering as well.

uiSettings image upload field config

#54522

In uiSettings, the image upload field required specifying maxSize via the options field. This was in conflict with the stated use and type of options, which is a string[] used to populate select fields. uiOptions has been provided instead, accepting Record<string, any> values.

Replaced map.manifestServiceUrl setting in kibana.yml with map.emsTileApiUrl and map.emsFileApiUrl

#54399

The undocumented map.manifestServiceUrl setting in kibana.yml has been replaced by map.emsTileApiUrl and map.emsFileApiUrl. These settings configure the base URL for the tile basemap manifest and vector file manifests used in Elastic Maps and the region map and coordinate map.visualizations.

Don’t expose Elasticsearch client as Observable

#53824

Elasticsearch clients aren’t exposed via the Observable interface anymore. Elasticsearch client provides a static API that handles all Elasticsearch config updates under the hood, transparent to the end-user.

  1. const client = core.elasticsearch.dataClient;
  2. const data = await client.callAsInternalUser('endpoint');

Reduce license plugin API

#53489

License method isOneOf was superseded by hasAtLeast, which checks the current license is not less than passes minimal required license.

  1. //before
  2. license.isOneOf(['platinum', 'enterprise', 'trial'])
  3. // after
  4. license.hasAtLeast('platinum')

State containers

#52384

State containers have now been rewritten and to create state container you use createStateContainer instead of previous createStore. See full documentation.

  1. import { createStateContainer } from 'src/plugins/kibana_utils';
  2. const container = createStateContainer(0, {
  3. increment: (cnt: number) => (by: number) => cnt + by,
  4. double: (cnt: number) => () => cnt * 2,
  5. });
  6. container.transitions.increment(5);
  7. container.transitions.double();
  8. console.log(container.get()); // 10

Add pre-response HTTP interceptor

#52366

HttpService provides onPreResponse interceptor. Interceptor supports extending a response with custom headers.

  1. this.registerOnPreResponse((request, preResponseInfo, t) => {
  2. if(preResponseInfo.statusCode < 300){
  3. return t.next({
  4. headers: {
  5. 'x-foo-header': 'bar'
  6. }
  7. });
  8. }
  9. return t.next()
  10. });

Add server rendering service to enable standalone route rendering

#52161

Render a bootstrapped HTML page from a route handler using the RenderingService from your server plugin:

  1. const router = createRouter();
  2. router.get(
  3. { path: '/', validate: false },
  4. (context, request, response) =>
  5. response.ok({
  6. headers: {
  7. 'content-security-policy': context.core.http.csp.header,
  8. },
  9. body: await context.core.rendering.render(),
  10. })
  11. );

Disabled actions

#51975

Embeddable input now has disabledActions property. Actions with ID listed in disabledActions will not be rendered by embeddable panel in drop down context menu and badge list.

  1. const embeddable = await embeddableFactory.createFromState(
  2. state,
  3. {
  4. // ...
  5. disabledActions: ['CUSTOM_TIME_RANGE', 'CUSTOM_TIME_RANGE_BADGE'],
  6. },
  7. // ...
  8. );

Allow chromeless applications to render via non-/app routes

#51527

Allow applications to routable from paths that do not start with /app. This is first enabled via the appRoute flag during UI application registration.

  1. export class MyPlugin implements Plugin {
  2. setup({ application }) {
  3. application.register({
  4. id: 'my-app',
  5. // App can be accessed via the /my-app route
  6. appRoute: '/my-app',
  7. async mount(context, params) {
  8. const { renderApp } = await import('./application');
  9. return renderApp(context, params);
  10. },
  11. });
  12. }
  13. }

Add compatibility wrapper for Boom errors thrown from route handler

#51157

Added a new handleLegacyErrors method to core HttpService router. The method wraps a RequestHandler to intercept any thrown Boom errors and converts them into proper NP error response.

  1. // plugins/myplugin/server/plugin.ts
  2. import { schema } from '@kbn/config-schema';
  3. import { CoreSetup } from 'src/core/server';
  4. export interface DemoPluginsSetup {};
  5. class Plugin {
  6. public setup(core: CoreSetup, pluginSetup: DemoPluginSetup) {
  7. const router = core.http.createRouter();
  8. router.post(
  9. {
  10. path: '/api/myplugin/endpoint',
  11. validate: false,
  12. },
  13. router.wrapErrors((context, req, res) => {
  14. throw Boom.notFound('not there'); // will be converted into properly interpreted error
  15. })
  16. )
  17. }
  18. }

Move SavedQuery to New Platform

#51024

Saved Query Service

Saved query service is now available on the data plugin’s query start contract.

  1. class MyPlugin {
  2. public start(core: CoreStart, { data }: MyPluginDependencies) {
  3. const allSavedQueries = data.query.savedQueries.getAllSavedQueries()
  4. }
  5. }

Saved Query UI Components

The Saved Query management UI components can be imported from data plugin directly.

  1. import { SavedQueryManagementComponent, SaveQueryForm } from '../../plugins/data/public';

Saved query Management component

Saved Query Management Component

Save query form

Save Query Form

Kibana app migration: Remove old APIs

#50881

The following undocumented APIs for scroll search and index document count have been removed:

  • POST /api/kibana/legacy_scroll_continue
  • POST /api/kibana/legacy_scroll_start
  • POST /api/kibana/{id}/_count

ChromeHelpExtension

#50736

The chrome.helpExtension has been updated to where it no longer just accepts a function to spit out any content. Now, the extension looks like:

  1. export interface ChromeHelpExtension {
  2. appName: string;
  3. links?: HeaderHelpMenuUIExtraLink[];
  4. // You can still pass custom content via the `content` key
  5. content?: (element: HTMLDivElement) => () => void;
  6. }

Allows plugins to define validation schema for “enabled” flag

#50286

If you want your plugin to be disabled by default you can specify it via config:

  1. export const config = {
  2. schema: schema.object({ enabled: schema.boolean({ defaultValue: true }) })
  3. }

Add getStartServices API

#50231

Context is being deprecated on the front-end and replaced by the core.getStartServices() API.

  1. class Plugin {
  2. setup(core, plugins) {
  3. core.application.register({
  4. id: 'myApp',
  5. title: 'My App',
  6. // `mount` functions with just one argument will only receive `params`
  7. async mount(params) {
  8. const [coreStart, depsStart] = await core.getStartServices();
  9. const { renderApp } = await import('./application');
  10. return renderApp(coreStart, depsStart, params);
  11. }
  12. });
  13. }
  14. }

Relocated @kbn/es-query package to data plugin

#50182

The @kbn/es-query package has been moved to src/plugins/data and is available under the esQuery namespace on both the client and the server.

  1. // old
  2. import {
  3. buildEsQuery,
  4. EsQueryConfig,
  5. buildQueryFromFilters,
  6. luceneStringToDsl,
  7. decorateQuery,
  8. getEsQueryConfig,
  9. } from '@kbn/es-query';
  10. // new
  11. import { esQuery } from 'src/plugins/data/public'; // or `src/plugins/data/server`
  12. esQuery.buildEsQuery(...);

Migrate share registry

#50137

The ui/share registry is removed in favor of the share plugin which exposes a register method in the setup contract. The interface of share menu providers does not change except for the removal of angular dependency injection. The function to render the menu also moves into a function exposed by the share plugin in the start phase instead of a function which has to be called with the menu item providers. The following items have also been renamed:

  • ShowPropsShowShareMenuOptions
  • ShareMenuItemPropsShareContext
  • showShareContextMenutoggleShareContextMenu

Ensure chromeless applications hide left navbar link

#50060

Chromeless applications no longer display a navigation link in the left application menu.

Allow registered applications to hide Kibana chrome

#49795

When registering an application, you can now use the chromeless option to hide the Kibana chrome UI when the application is mounted.

  1. application.register({
  2. id: 'my-app',
  3. chromeless: true,
  4. async mount(context, params) {
  5. /* ... */
  6. },
  7. });

Remove react references from core Notifications APIs

#49573

The core NotificationService and ToastsApi methods are now framework agnostic and no longer accept react components as input. Please use kibana_react‘s`toMountPoint` utility to convert a react node to a mountPoint.

Shim dev tools

#49349

The ui/registry/dev_tools is removed in favor of the DevTools plugin, which exposes a register method in the setup contract. Registering app works mostly the same as registering apps in core.application.register. Routing will be handled by the id of the dev tool - your dev tool will be mounted when the URL matches /app/kibana#/dev_tools/<YOUR ID>. This API doesn’t support angular, for registering angular dev tools, bootstrap a local module on mount into the given HTML element.

Kibana app migration: Shim dashboard

#48913

The route flag requireDefaultIndex making sure there are index patterns and the defaultIndex advanced setting is set was removed.

The same functionality can be achieved by using the helper function ensureDefaultIndexPattern from ui/legacy_compat within the resolve object of a route.

Remove react references from core OverlayService apis

#48431

The core OverlayService methods are now framework agnostic and no longer accept react components as input. Please use kibana_react‘s`toMountPoint` utility to convert a react component to a mountPoint.

For exemple:

  1. core.overlays.openModal(<MyComponent/>)

Becomes:

  1. core.overlays.openModal(toMountPoint(<MyComponent/>))

Supply deprecated req and res properties on IHttpFetchError for legacy compatibility

#48430

Expose deprecated req: Request and res: Response properties on `IHttpFetchError`s to help plugins migrated faster by removing an additional migration burden.

Timelion server API

#47813

The server side AOU of Timelion /api/timelion/run used to accept datemath strings (like now) for the time.from and time.to properties. This PR removes support for datemath, from now on only ISO8601 encoded strings are supported.

Pass along request object to all HTTP interceptors

#47258

Make the Request instance available to all HTTP interceptors, which is now in a read-only state. You may now also under-specify the object returned from HTTP response interceptors to only overwrite specific properties.

Expose whitelisted config values to client-side plugin

#50641

New Platform plugins with both a server and client parts can now expose configuration properties to the client-side plugin.

The properties to expose must be whitelisted in the config declaration.

  1. // my_plugin/server/index.ts
  2. const configSchema = schema.object({
  3. secret: schema.string({ defaultValue: 'Not really a secret :/' }),
  4. uiProp: schema.string({ defaultValue: 'Accessible from client' }),
  5. });
  6. type ConfigType = TypeOf<typeof configSchema>;
  7. export const config: PluginConfigDescriptor<ConfigType> = {
  8. exposeToBrowser: {
  9. uiProp: true,
  10. },
  11. schema: configSchema,
  12. };

And can then be accessed in the client-side plugin using the PluginInitializerContext:

  1. // my_plugin/public/index.ts
  2. interface ClientConfigType {
  3. uiProp: string;
  4. }
  5. export class Plugin implements Plugin<PluginSetup, PluginStart> {
  6. constructor(private readonly initializerContext: PluginInitializerContext) {}
  7. public async setup(core: CoreSetup, deps: {}) {
  8. const config = this.initializerContext.config.get<ClientConfigType>();
  9. // ...
  10. }

Allow registering per-app navigation items

#53136

Allow registering per-app TopNavMenuItems—have a plugin register menu items into another application.

New platform plugin

  1. class MyPlugin {
  2. public setup(core: CoreSetup, { navigation }: MyPluginSetupDependencies) {
  3. const customDiscoverExtension = {
  4. id: 'registered-discover-prop',
  5. label: 'Registered Discover Button',
  6. description: 'Registered Discover Demo',
  7. run() {},
  8. testId: 'demoDiscoverRegisteredNewButton',
  9. appName: 'discover',
  10. };
  11. navigation.registerMenuItem(customDiscoverExtension);
  12. }
  13. }

Legacy plugin

  1. const customDiscoverExtension = {
  2. id: 'registered-discover-prop',
  3. label: 'Registered Discover Button',
  4. description: 'Registered Discover Demo',
  5. run() {},
  6. testId: 'demoDiscoverRegisteredNewButton',
  7. appName: 'discover',
  8. };
  9. npSetup.plugins.navigation.registerMenuItem(customDiscoverExtension);

Management API for Kibana Platform

#52579

Management API for Kibana Platform implemented. Demonstration code available at test/plugin_functional/plugins/management_test_plugin/public/plugin.tsx

New platform applications can now prompt user with a message

#54221

New platform applications can now prompt a message when users are trying to leave the app, allowing to notify them if some changes are unsaved.

  1. core.application.register({
  2. id: 'my-app',
  3. title: 'MyApp',
  4. mount: (context, { appBasePath, element, onAppLeave }) => {
  5. onAppLeave(actions => {
  6. if(someUnsavedChanges) {
  7. return actions.confirm(
  8. 'Some changes are unsaved and will be lost. Are you sure you want to leave MyApp?',
  9. 'Leaving application'
  10. );
  11. }
  12. return actions.default();
  13. });
  14. const div = document.createElement('div');
  15. div.innerHTML = '.....';
  16. element.appendChild(div);
  17. return () => div.remove();
  18. },
  19. });

[NP] Add lifecycle timeout

#54129

Kibana platform deprecates async lifecycles by v8 release. Kibana supports async lifecycles for BWC, but limits their time duration to 30 sec.

Migrate config deprecations and ShieldUser functionality to the New Platform

#53768

In the Security Plugin, the Legacy ShieldUser angular service has been removed and replaced with the dedicated method on the Kibana platform plugin setup contract:

Before:

  1. const currentUser = await $injector.get('ShieldUser').getCurrent().$promise;

Now:

Legacy plugin:

  1. import { npSetup } from 'ui/new_platform';
  2. const currentUser = await npSetup.plugins.security.authc.getCurrentUser();

Kibana platform plugin:

  1. // manifest.json
  2. ....
  3. [optional]requiredPlugins: ["security"],
  4. ....
  1. // my_plugin/public/plugin.ts
  2. public setup(core: CoreSetup, { security }: PluginSetupDependencies) {
  3. const currentUser = await security.authc.getCurrentUser();
  4. }

NP Migration: Move doc views registry and existing doc views into discover plugin

#53465

The ui/registry/doc_views registry is removed in favor of the same functionality exposed through the setup contract of the discover plugin in core_plugins/kibana.

Old way of registering a doc view:

  1. import { addDocView } from 'ui/registry/doc_views';
  2. addDocView({
  3. title: '',
  4. order: 10,
  5. component: MyComponent,
  6. });

New way of registering a doc view:

  1. import { setup } from '../src/legacy/core_plugins/kibana/public/discover';
  2. setup.addDocView({
  3. title: '',
  4. order: 10,
  5. component: MyComponent,
  6. });

bfetch

#52888

ajax_stream has been ported to the New Platform. Use fetchStreaming() method of bfetch plugin instead.

  1. import { npStart } from 'ui/new_platform';
  2. const { stream, promise } = npStart.plugins.bfetch.fetchStreaming({ url: 'http://elastic.co' });

Move CSP options to New Platform

#52698

The default options used for managing Kibana’s Content Security Policy have been moved into core for the new platform. Relevant items exposed from src/core/server include:

  • CspConfig: TypeScript class for generating CSP configuration. Will generate default configuration for any properties not specified in initialization.
  • CspConfig.DEFAULT: Default CSP configuration.
  • ICspConfig: Interface representing CSP configuration.

Implements config deprecation in New Platform

#52251

New platform plugin’s configuration now supports deprecation. Use the deprecations key of a plugin’s config descriptor to register them.

  1. // my_plugin/server/index.ts
  2. import { schema, TypeOf } from '@kbn/config-schema';
  3. import { PluginConfigDescriptor } from 'kibana/server';
  4. const configSchema = schema.object({
  5. someNewKey: schema.string({ defaultValue: 'a string' }),
  6. });
  7. type ConfigType = TypeOf<typeof configSchema>;
  8. export const config: PluginConfigDescriptor<ConfigType> = {
  9. schema: configSchema,
  10. deprecations: ({ rename, unused }) => [
  11. rename('someOldKey', 'someNewKey'),
  12. unused('deprecatedProperty'),
  13. ],
  14. };

[Telemetry] Migrate ui_metric plugin to NP under usageCollection

#51972

Migrates ui_metrics to NP under usageCollection.

NP licensing plugin improvements

#51818

Licensing plugin retrieves license data from Elasticsearch and becomes a source of license data for all Kibana plugins on server-side and client-side.

Server-side API

The licensing plugin retrieves license data from Elasticsearch at regular configurable intervals.

  • license$: Observable<ILicense> Provides a steam of license data ILicense. Plugin emits new value whenever it detects changes in license info. If the plugin cannot retrieve a license from Elasticsearch, it will emit an empty license object.
  • refresh: () => Promise<ILicense> allows a plugin to enforce license retrieval.

Client-side API

The licensing plugin retrieves license data from licensing Kibana plugin and does not communicate with Elasticsearch directly.

  • license$: Observable<ILicense> Provides a steam of license data ILicense. Plugin emits new value whenever it detects changes in license info. If the plugin cannot retrieve a license from Kibana, it will emit an empty license object.
  • refresh: () => Promise<ILicense> allows a plugin to enforce license retrieval.

[Cloud] move cloud plugin to New Platform

#51789

Fully migrates cloud plugin over to NP. To use the NP contract exposed by the cloud plugin (ex cloudId or isCloudEnabled) follow this quick guide below. Note that all the plugins are already migrated to use the NP plugin in this very same PR.

  1. // plugin/kibana.json
  2. {
  3. "id": "...",
  4. "optionalPlugins": ["cloud"]
  5. }

Server side: Check for cloud plugin in the setup function.

  1. // server/plugin.ts
  2. import { get } from 'lodash';
  3. class Plugin {
  4. setup(core, plugins) {
  5. const { cloud } = plugins;
  6. // use `lodash.get` as cloud might not be available if set as an optional plugin.
  7. const isCloudEnabled = get<boolean>(cloud, 'isCloudEnabled', false);
  8. // ...
  9. }
  10. }

Client side: Both cloudId and isCloudEnabled are exposed for the the plugins to consume in the plugins. Until fully transitioned to new platform, your plugins can use npSetup to access the cloud plugin.

  1. import { npSetup } from 'ui/new_platform';
  2. import { get } from 'lodash';
  3. // ...
  4. const { cloud } = npSetup.plugins;
  5. const isCloudEnabled = get<boolean>(cloud, 'isCloudEnabled', false);

[Telemetry] Migrate Usage Collector Set to the new Kibana Platform

#51618

Fully migrate (server.usage.collectorSet) to New Platform under (UsageCollection) plugin. To use the UsageCollector plugin to collect server side stats with the NP follow the quick guide below (Note that all the plugins are already migrated to use this new plugin in this very same PR):

Make sure usageCollection is in your optional Plugins:

  1. // plugin/kibana.json
  2. {
  3. "id": "...",
  4. "optionalPlugins": ["usageCollection"]
  5. }

Register Usage collector in the setup function:

  1. // server/plugin.ts
  2. class Plugin {
  3. setup(core, plugins) {
  4. registerMyPluginUsageCollector(plugins.usageCollection);
  5. }
  6. }

Create and register a Usage Collector. Ideally collectors would be defined in a separate directory server/collectors/register.ts.

  1. // server/collectors/register.ts
  2. import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
  3. import { CallCluster } from 'src/legacy/core_plugins/elasticsearch';
  4. export function registerMyPluginUsageCollector(usageCollection?: UsageCollectionSetup): void {
  5. // usageCollection is an optional dependency, so make sure to return if it is not registered.
  6. if (!usageCollection) {
  7. return;
  8. }
  9. // create usage collector
  10. const myCollector = usageCollection.makeUsageCollector({
  11. type: MY_USAGE_TYPE,
  12. fetch: async (callCluster: CallCluster) => {
  13. // query ES and get some data
  14. // summarize the data into a model
  15. // return the modeled object that includes whatever you want to track
  16. return {
  17. my_objects: {
  18. total: SOME_NUMBER
  19. }
  20. };
  21. },
  22. });
  23. // register usage collector
  24. usageCollection.registerCollector(myCollector);
  25. }

Move SearchBar to NP

#51028

The SearchBar component is now available by importing from the data plugin.

  1. import { SearchBar } from '../../../plugins/data/public';

There is also a stateful version available, that requires much fewer dependencies

  1. export class MyPublicPlugin {
  2. public start(
  3. core: CoreStart,
  4. { data }: MyPublicPluginDependencies
  5. ) {
  6. const { SearchBar } = data.ui;
  7. ...
  8. return <SearchBar
  9. ...
  10. ></SearchBar>
  11. }
  12. }

Move QueryBarInput to New Platform

#51023

  • QueryBarInput was renamed to QueryStringInput and moved to src/plugins/data/public
  • The typeahead UI component can now be used independently of QueryStringInput. It can be imported from src/plugins/data/public.
  1. import { QueryStringInput, SuggestionsComponent } from '../../plugins\data\public'

Move ApplyFiltersPopover to New Platform

#51022

The ApplyFiltersPopover component is no longer exported.

If you wish to open the filter selection popover, use the Actions API from within an embeddable:

  1. await uiActions.executeTriggerActions(APPLY_FILTER_TRIGGER, {
  2. embeddable: this,
  3. filters,
  4. });

Deprecated the filter-bar directive

#51020

If you need to render a filter bar from angular, use the kbn-top-nav directive with the following configuration:

  1. <kbn-top-nav
  2. app-name="'my-app'"
  3. show-search-bar="true"
  4. show-filter-bar="true"
  5. show-save-query="false"
  6. show-date-picker="false"
  7. filters="filters"
  8. on-filters-updated="updateFilters"
  9. index-patterns="[indexPattern]"
  10. >
  11. </kbn-top-nav>

Move FilterBar React component to New Platform

The FilterBar component is now available by importing from the data plugin.

  1. import { FilterBar } from '../../../plugins/data/public';

Move filter related utilities to New Platform

  • IDataPluginServices ⇒ import from data
  • getDisplayValueFromFilterdata.utils
  • buildCustomFilteresFilters.buildCustomFilter
  • buildFilteresFilters.buildFilter
  • getFilterParamsesFilters.getFilterParams
  • getIndexPatternFromFilterutils.getIndexPatternFromFilter
  • getQueryDslFromFilter ⇒ replaced with esFilters.cleanFIlter
  • isFilterable ⇒ import from data

NP Kibana plugin home feature catalogue

#50838

The ui/registries/feature_catalogue module has been deprecated for removal in 8.0.

Plugins wishing to migrate may remove their usage of ui/registries/feature_catalogue and rely on either:

  1. // For legacy plugins
  2. import { npSetup } from 'ui/new_platform';
  3. npSetup.plugins.home.featureCatalogue.register(/* same details here */);
  4. // For new plugins: first add 'home` to the list of `optionalPlugins`
  5. // in your kibana.json file. Then access the plugin directly in `setup`:
  6. class MyPlugin {
  7. setup(core, plugins) {
  8. if (plugins.home) {
  9. plugins.home.featureCatalogue.register(/* same details here. */);
  10. }
  11. }
  12. }

Note that the old module supported providing a Angular DI function to receive Angular dependencies. This is no longer supported as we migrate away from Angular.

[NP Kibana Migrations ] Kibana plugin home

#50444

The API to register new tutorials was moved to the new platform. You are now able to add new tutorials by creating a plugin in the new platform, adding a dependency to home in its kibana.json and using the tutorials.registerTutorial method in the setup lifecycle:

  1. class MyPlugin {
  2. setup(core: CoreSetup, plugins: { home: HomeServerPluginSetup }) {
  3. home.tutorials.registerTutorial(() => ({ /* tutorial definition */ }));
  4. }
  5. }

It is still possible to register tutorials from within the legacy platform by calling the same method exposed on the server object:

  1. server.newPlatform.setup.plugins.home.tutorials.registerTutorial(() => ({ /* tutorial definition */ }));

Expressions fully migrated to the New Platform

#50294

The Expressions service has been moved to the New Platform. Moving forward, any expressions-related code should be consumed via the new plugin’s contracts (src/plugins/expressions).

Use it in your New Platform plugin:

  1. class MyPlugin {
  2. setup (core, { expressions }) {
  3. expressions.registerFunction(myFunction);
  4. // ...
  5. }
  6. start (core, { expressions }) {
  7. expressions.execute(myExpression);
  8. // ...
  9. }
  10. }

Or, in your legacy platform plugin, consume it through the ui/new_platform module:

  1. import { npSetup, npStart } from 'ui/new_platform';
  2. npSetup.plugins.expressions.registerFunction(myFunction);
  3. npStart.plugins.expressions.execute(myExpression);
  4. // ...

Move generateFilters to NP

#50118

Filter generator is now available as a utility function in the data plugin.

  1. import { generateFilters } from '../plugins/data/public';
  2. const { filterManager } = plugins.data.query;
  3. const filters = generateFilters(filterManager, field, values, negate, indexString);

Move Query type to NP

#49636

Moved the data Query type, used to represent a query string in a specific querying language to src/plugins/data.

  1. // previously
  2. import { Query } from `src/legacy/core_plugins/data/public`;
  3. // now
  4. import { Query } from `src/plugins/data/public`;

Move Timefilter service to NP

#49491

Moved the timefilter service to New Platform.

Usage in Old Platform:

  1. import { TimeRange } from 'src/plugins/data/public';
  2. import { npSetup, npStart } from 'ui/new_platform';
  3. const { timefilter } = npStart.data.timefilter;
  4. const timeRange: TimeRange = timefilter.getTime();
  5. const refreshInterval: RefreshInterval = timefilter.getRefreshInterval()

Usage in New Platform:

  1. class MyPlugin {
  2. public setup(core: CoreSetup, { data }: MyPluginSetupDependencies) {
  3. const timeRange: TimeRange = data.timefilter.timefilter.getTime();
  4. }
  5. public start(core: CoreStart, { data }: MyPluginStartDependencies) {
  6. const newTimeRange = { from: getYesterday(), to: getNow() }
  7. data.timefilter.timefilter.setTime(newTimeRange);
  8. }
  9. }

Move Storage to New Platform

#49448

Move Storage to kibana_utils.

  • Move Storage class to NP, and introduce the interface IStorageWrapper for when we only pass storage around.
  • Rename places where storage was called store
  • Load the Storage directives only where applicable (not in autoload)

Licensing plugin

#49345

Add x-pack plugin for new platform public licensing information. This will eventually replace the licensing information consumed via xpack_main. Upon setup, this plugin exposes an observable API for inspecting and making checks against the license information.

  1. license$.subscribe(license => {
  2. console.log(license.uid);
  3. console.log(license.isActive);
  4. console.log(license.type);
  5. const { state } = license.check('my-plugin', LICENSE_TYPE.gold);
  6. if (state !== LICENSE_STATUS.Valid) {
  7. disableSomething();
  8. }
  9. });

Migrate ui/registry/feature_catalogue to New Platform plugin

#48818

The ui/registries/feature_catalogue module has been deprecated for removal in 8.0.

Plugins wishing to migrate may remove their usage of ui/registries/feature_catalogue and rely on either:

  1. // For legacy plugins
  2. import { npSetup } from 'ui/new_platform';
  3. npSetup.plugins.feature_catalogue.register(/* same details here */);
  4. // For new plugins: first add 'feature_catalogue` to the list of `optionalPlugins`
  5. // in your kibana.json file. Then access the plugin directly in `setup`:
  6. class MyPlugin {
  7. setup(core, plugins) {
  8. if (plugins.feature_catalogue) {
  9. plugins.feature_catalogue.register(/* same details here. */);
  10. }
  11. }
  12. }

Note that the old module supported providing a Angular DI function to receive Angular dependencies. This is no longer supported as we migrate away from Angular.

Migrate necessary ui/autoload functionality to NP

#48689

The ui/autoload/styles and ui/autoload/settings modules have been removed and are no longer necessary to import in your plugin code. Remove these imports starting in 7.6.

If you still require font awesome, you should import it manually from the npm module:

  1. import 'font-awesome/less/font-awesome';

Provide uiSettings service in NP

#48413

New platform plugins can register custom uiSettings via the uiSettings.register method.

  1. // src/plugins/my-plugin/server/plugin.ts
  2. setup(core: CoreSetup){
  3. core.uiSettings.register({
  4. 'my-plugin:my-setting': {
  5. name: 'just-work',
  6. value: true,
  7. description: 'make it work',
  8. category: ['my-category'],
  9. },
  10. })
  11. }

Access UiSettings client

  • Via RequestHandlerContext on server-side:
  1. (context, req, res) {
  2. const uiSettingsClient = context.core.uiSettings.client;
  3. const value = await uiSettings.get('myPlugin:key');
  4. // ...
  5. }
  • Via core interface in setup/start lifecycles on the client-side:
  1. public start({ uiSettings }) {
  2. const value = uiSettings.get('myPlugin:key');

Move FilterManager to New Platform

#48391

Moved Filter Manager to New Platform.

Usage in Old Platform

  1. import { npSetup, npStart } from 'ui/new_platform';
  2. npStart.data.query.filterManager.getFilters()
  3. ...

Usage in New platform

  1. class MyPlugin {
  2. public setup(core: CoreSetup, { data }: MyPluginSetupDependencies) {
  3. data.query.filterManager.getFilters();
  4. }
  5. public start(core: CoreStart, { data }: MyPluginStartDependencies) {
  6. data.query.filterManager.getFilters();
  7. }
  8. }

Migrate ui/doc_title to New platform

#48121

Migrate chrome.docTitle to new platform. Plugins can now change the page title using this API.

  1. coreStart.docTitle.change('My Title');

Use NP registry instead of ui/registry/field_formats

#48108

The FieldFormats service has been moved to the data plugin in the New Platform. If your plugin has any imports from ui/registry/field_formats, you’ll need to update your imports as follows:

Use it in your New Platform plugin:

  1. class MyPlugin {
  2. setup (core, { data }) {
  3. data.fieldFormats.register(myFieldFormat);
  4. // ...
  5. }
  6. start (core, { data }) {
  7. data.fieldFormats.getType(myFieldFormatId);
  8. // ...
  9. }
  10. }

Or, in your legacy platform plugin, consume it through the ui/new_platform module:

  1. import { npSetup, npStart } from 'ui/new_platform';
  2. npSetup.plugins.data.fieldFormats.register(myFieldFormat);
  3. npStart.plugins.data.fieldFormats.getType(myFieldFormatId);
  4. // ...

ui/management to New Platform

#45747

The following interfaces were previously available under ui/management and are now available via import { setup as managementSetup }` from '${correct path to top dir}src/legacy/core_plugins/management/public/legacy';

  • ui/management/saved_objects_management
  • ui/management/index_pattern_creation
  • ui/management/index_pattern_list

ui/public cleanup

#43511

Removed / moved modules

In preparation for Kibana’s upcoming new platform, we are in the process of migrating awayfrom the ui/public directory. Over time, the contents of this directory will be either deprecated or housed inside a parent plugin.

If your plugin imports the listed items from the following ui/public modules, you will need to either update your import statements as indicated below, so that you are pulling these modules from their new locations, or copy the relevant code into your plugin.

ui/state_management #51835 #52172 #52280 #53582

The hashUrl and unhashUrl functions no longer rely on states being provided as an argument, therefore getUnhashableStates/getUnhashableStatesProvider have been removed.

  1. // old
  2. import {
  3. hashUrl,
  4. unhashUrl,
  5. getUnhashableStatesProvider, // deprecated
  6. } from 'ui/state_management/state_hashing';
  7. const getUnhashableStates = Private(getUnhashableStatesProvider);
  8. unhashUrl(window.location.href, getUnhashableStates());
  9. hashUrl([new AppState(), globalState], myRedirectUrl);
  10. // new
  11. import { hashUrl, unhashUrl } from '../../plugins/kibana_utils/public'
  12. hashUrl(window.location.href);
  13. unhashUrl(myRedirectUrl);

HashedItemStore was also moved to the kibana_utils plugin.

  1. // old
  2. import { HashedItemStoreSingleton } from 'ui/state_management/state_storage'
  3. // new
  4. import { hashedItemStore } from '../../plugins/kibana_utils/public'

Created new state syncing utilities for syncing state between state containers and different type of state storage (e.g. query params in URL or session storage).

Example app: examples/state_containers_examples

This should become a replacement for AppState and GlobalState in NP.

ui/public/utils cleanup

  • base_object and find_by_param utilities have been removed #52500
  • decode_geo_hash and zoom_to_precision utilities have been moved to ui/vis/maphttps://github.com/elastic/kibana/pull/52615\[#52615\]
  • range utility has beed moved to ui/vis/editors/default #52615
  • cidr_mask, date_range, geo_utils, ip_range, ordinal_suffix utilities have been moved to ui/agg_types #52744
  • case_conversion #53819
  • keysToSnakeCaseShallow moved to src/legacy/server/status/lib
  • keysToCamelCaseShallow moved to src/legacy/core_plugins/kibana/public/management
  • collection #53819
  • organizeBy moved to `src/legacy/ui/public/indexed_array
  • pushAll was removed
  • diff_object moved to `ui/state_management #53819
  • function was removed #53819
  • key_map moved to ui/directives #53819
  • math moved to ui/vis #53819
  • numeric moved to src/legacy/core_plugins/kibana/public/management #53819
  • parse_interval moved to`src/legacy/core_plugins/data/common` #53819
  • sort_prefix_first moved to x-pack/legacy/plugins/kuery_autocomplete #53819
  • supports moved to src/legacy/core_plugins/tile_map/public #53819

Index Patterns moved to New Platform

#43438

The indexPatterns service is now available from the data plugin.

  1. class MyPlugin {
  2. start(core, data) {
  3. const indexPatterns = data.indexPatterns.get(indexPatternId);
  4. ...
  5. }
  6. }

Type Definitions

  • The IndexPattern type replaces the legacy StaticIndexPattern type
  • IndexPattern was moved to the new plugin.
  • FieldList was moved to the new plugin and the IFieldList type was added.
  • Field was moved to the new plugin, along side the IFieldType type.
  1. import { IIndexPattern, IFieldType } from 'src/plugins/data/public';
  2. const indexPattern: IIndexPattern = data.indexPatterns.find(indexPatternId);
  3. const field: IFieldType[] = indexPattern.fields;

Helper functions

  1. import { indexPatterns as indexPatternsUtils } from 'src/plugins/data/public';
  2. const indexPattern: IIndexPattern = indexPatterns.getFromSavedObject(savedObject)
  3. const isValid = indexPatterns.validateIndexPattern(indexPatternString)

Deletions

  • IndexPatternAlreadyExists
  • NoDefaultIndexPattern
  • NoDefinedIndexPatterns

Most Popular