| LegacyRequest, requestSpecificBasePath: string) => void;
+```
diff --git a/docs/development/core/server/kibana-plugin-server.irouter.handlelegacyerrors.md b/docs/development/core/server/kibana-plugin-server.irouter.handlelegacyerrors.md
index ff71f13466cf88..238424b1df1d52 100644
--- a/docs/development/core/server/kibana-plugin-server.irouter.handlelegacyerrors.md
+++ b/docs/development/core/server/kibana-plugin-server.irouter.handlelegacyerrors.md
@@ -1,13 +1,13 @@
-
-
-[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [IRouter](./kibana-plugin-server.irouter.md) > [handleLegacyErrors](./kibana-plugin-server.irouter.handlelegacyerrors.md)
-
-## IRouter.handleLegacyErrors property
-
-Wrap a router handler to catch and converts legacy boom errors to proper custom errors.
-
-Signature:
-
-```typescript
-handleLegacyErrors: (handler: RequestHandler
) => RequestHandler
;
-```
+
+
+[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [IRouter](./kibana-plugin-server.irouter.md) > [handleLegacyErrors](./kibana-plugin-server.irouter.handlelegacyerrors.md)
+
+## IRouter.handleLegacyErrors property
+
+Wrap a router handler to catch and converts legacy boom errors to proper custom errors.
+
+Signature:
+
+```typescript
+
(handler: RequestHandler
) => RequestHandler
;
+```
diff --git a/docs/development/core/server/kibana-plugin-server.routeconfig.validate.md b/docs/development/core/server/kibana-plugin-server.routeconfig.validate.md
index 23a72fc3c68b3a..4fbcf0981f1140 100644
--- a/docs/development/core/server/kibana-plugin-server.routeconfig.validate.md
+++ b/docs/development/core/server/kibana-plugin-server.routeconfig.validate.md
@@ -1,62 +1,62 @@
-
-
-[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteConfig](./kibana-plugin-server.routeconfig.md) > [validate](./kibana-plugin-server.routeconfig.validate.md)
-
-## RouteConfig.validate property
-
-A schema created with `@kbn/config-schema` that every request will be validated against.
-
-Signature:
-
-```typescript
-validate: RouteValidatorFullConfig
| false;
-```
-
-## Remarks
-
-You \*must\* specify a validation schema to be able to read: - url path segments - request query - request body To opt out of validating the request, specify `validate: false`. In this case request params, query, and body will be \*\*empty\*\* objects and have no access to raw values. In some cases you may want to use another validation library. To do this, you need to instruct the `@kbn/config-schema` library to output \*\*non-validated values\*\* with setting schema as `schema.object({}, { allowUnknowns: true })`;
-
-## Example
-
-
-```ts
- import { schema } from '@kbn/config-schema';
- router.get({
- path: 'path/{id}',
- validate: {
- params: schema.object({
- id: schema.string(),
- }),
- query: schema.object({...}),
- body: schema.object({...}),
- },
-},
-(context, req, res,) {
- req.params; // type Readonly<{id: string}>
- console.log(req.params.id); // value
-});
-
-router.get({
- path: 'path/{id}',
- validate: false, // handler has no access to params, query, body values.
-},
-(context, req, res,) {
- req.params; // type Readonly<{}>;
- console.log(req.params.id); // undefined
-});
-
-router.get({
- path: 'path/{id}',
- validate: {
- // handler has access to raw non-validated params in runtime
- params: schema.object({}, { allowUnknowns: true })
- },
-},
-(context, req, res,) {
- req.params; // type Readonly<{}>;
- console.log(req.params.id); // value
- myValidationLibrary.validate({ params: req.params });
-});
-
-```
-
+
+
+[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteConfig](./kibana-plugin-server.routeconfig.md) > [validate](./kibana-plugin-server.routeconfig.validate.md)
+
+## RouteConfig.validate property
+
+A schema created with `@kbn/config-schema` that every request will be validated against.
+
+Signature:
+
+```typescript
+RouteValidatorFullConfig
| false;
+```
+
+## Remarks
+
+You \*must\* specify a validation schema to be able to read: - url path segments - request query - request body To opt out of validating the request, specify `validate: false`. In this case request params, query, and body will be \*\*empty\*\* objects and have no access to raw values. In some cases you may want to use another validation library. To do this, you need to instruct the `@kbn/config-schema` library to output \*\*non-validated values\*\* with setting schema as `schema.object({}, { allowUnknowns: true })`;
+
+## Example
+
+
+```ts
+ import { schema } from '@kbn/config-schema';
+ router.get({
+ path: 'path/{id}',
+ validate: {
+ params: schema.object({
+ id: schema.string(),
+ }),
+ query: schema.object({...}),
+ body: schema.object({...}),
+ },
+},
+(context, req, res,) {
+ req.params; // type Readonly<{id: string}>
+ console.log(req.params.id); // value
+});
+
+router.get({
+ path: 'path/{id}',
+ validate: false, // handler has no access to params, query, body values.
+},
+(context, req, res,) {
+ req.params; // type Readonly<{}>;
+ console.log(req.params.id); // undefined
+});
+
+router.get({
+ path: 'path/{id}',
+ validate: {
+ // handler has access to raw non-validated params in runtime
+ params: schema.object({}, { allowUnknowns: true })
+ },
+},
+(context, req, res,) {
+ req.params; // type Readonly<{}>;
+ console.log(req.params.id); // value
+ myValidationLibrary.validate({ params: req.params });
+});
+
+```
+
diff --git a/docs/development/core/server/kibana-plugin-server.routevalidationerror._constructor_.md b/docs/development/core/server/kibana-plugin-server.routevalidationerror._constructor_.md
index 551e13faaf1542..31dc6ceb919952 100644
--- a/docs/development/core/server/kibana-plugin-server.routevalidationerror._constructor_.md
+++ b/docs/development/core/server/kibana-plugin-server.routevalidationerror._constructor_.md
@@ -1,21 +1,21 @@
-
-
-[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidationError](./kibana-plugin-server.routevalidationerror.md) > [(constructor)](./kibana-plugin-server.routevalidationerror._constructor_.md)
-
-## RouteValidationError.(constructor)
-
-Constructs a new instance of the `RouteValidationError` class
-
-Signature:
-
-```typescript
-constructor(error: Error | string, path?: string[]);
-```
-
-## Parameters
-
-| Parameter | Type | Description |
-| --- | --- | --- |
-| error | Error | string
| |
-| path | string[]
| |
-
+
+
+[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidationError](./kibana-plugin-server.routevalidationerror.md) > [(constructor)](./kibana-plugin-server.routevalidationerror._constructor_.md)
+
+## RouteValidationError.(constructor)
+
+Constructs a new instance of the `RouteValidationError` class
+
+Signature:
+
+```typescript
+constructor(error;: Error | string, path?: string[];)
+```
+
+## Parameters
+
+| Parameter | Type | Description |
+| --- | --- | --- |
+| error | Error | string
| |
+| path | string[]
| |
+
diff --git a/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.badrequest.md b/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.badrequest.md
index 36ea6103fb352d..2462ae17943bee 100644
--- a/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.badrequest.md
+++ b/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.badrequest.md
@@ -1,13 +1,13 @@
-
-
-[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidationResultFactory](./kibana-plugin-server.routevalidationresultfactory.md) > [badRequest](./kibana-plugin-server.routevalidationresultfactory.badrequest.md)
-
-## RouteValidationResultFactory.badRequest property
-
-Signature:
-
-```typescript
-badRequest: (error: Error | string, path?: string[]) => {
- error: RouteValidationError;
- };
-```
+
+
+[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidationResultFactory](./kibana-plugin-server.routevalidationresultfactory.md) > [badRequest](./kibana-plugin-server.routevalidationresultfactory.badrequest.md)
+
+## RouteValidationResultFactory.badRequest property
+
+Signature:
+
+```typescript
+(error: Error | string, path?: string[]) => {
+ RouteValidationError;
+ };
+```
diff --git a/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.ok.md b/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.ok.md
index eca6a31bd547f5..c86ef616de1030 100644
--- a/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.ok.md
+++ b/docs/development/core/server/kibana-plugin-server.routevalidationresultfactory.ok.md
@@ -1,13 +1,13 @@
-
-
-[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidationResultFactory](./kibana-plugin-server.routevalidationresultfactory.md) > [ok](./kibana-plugin-server.routevalidationresultfactory.ok.md)
-
-## RouteValidationResultFactory.ok property
-
-Signature:
-
-```typescript
-ok: (value: T) => {
- value: T;
- };
-```
+
+
+[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidationResultFactory](./kibana-plugin-server.routevalidationresultfactory.md) > [ok](./kibana-plugin-server.routevalidationresultfactory.ok.md)
+
+## RouteValidationResultFactory.ok property
+
+Signature:
+
+```typescript
+(value: T) => {
+ T;
+ };
+```
diff --git a/docs/development/core/server/kibana-plugin-server.routevalidatoroptions.unsafe.md b/docs/development/core/server/kibana-plugin-server.routevalidatoroptions.unsafe.md
index 0406a372c4e9d7..b1c75e6dbdf67c 100644
--- a/docs/development/core/server/kibana-plugin-server.routevalidatoroptions.unsafe.md
+++ b/docs/development/core/server/kibana-plugin-server.routevalidatoroptions.unsafe.md
@@ -1,17 +1,18 @@
-
-
-[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidatorOptions](./kibana-plugin-server.routevalidatoroptions.md) > [unsafe](./kibana-plugin-server.routevalidatoroptions.unsafe.md)
-
-## RouteValidatorOptions.unsafe property
-
-Set the `unsafe` config to avoid running some additional internal \*safe\* validations on top of your custom validation
-
-Signature:
-
-```typescript
-unsafe?: {
- params?: boolean;
- query?: boolean;
- body?: boolean;
- };
-```
+
+
+[Home](./index.md) > [kibana-plugin-server](./kibana-plugin-server.md) > [RouteValidatorOptions](./kibana-plugin-server.routevalidatoroptions.md) > [unsafe](./kibana-plugin-server.routevalidatoroptions.unsafe.md)
+
+## RouteValidatorOptions.unsafe property
+
+Set the `unsafe` config to avoid running some additional internal \*safe\* validations on top of your custom validation
+
+Signature:
+
+```typescript
+unsafe?: {
+ params?: boolean;
+ query?: boolean;
+ body?: boolean;
+ }
+
+```
diff --git a/src/legacy/core_plugins/kibana/public/dashboard/index.ts b/src/legacy/core_plugins/kibana/public/dashboard/index.ts
index 76d9933a3d5670..fd39f28a7673a1 100644
--- a/src/legacy/core_plugins/kibana/public/dashboard/index.ts
+++ b/src/legacy/core_plugins/kibana/public/dashboard/index.ts
@@ -17,17 +17,11 @@
* under the License.
*/
-import {
- npSetup,
- npStart,
- SavedObjectRegistryProvider,
- legacyChrome,
- IPrivate,
-} from './legacy_imports';
+import { npSetup, npStart, legacyChrome } from './legacy_imports';
import { DashboardPlugin, LegacyAngularInjectedDependencies } from './plugin';
import { start as data } from '../../../data/public/legacy';
import { start as embeddables } from '../../../embeddable_api/public/np_ready/public/legacy';
-import './saved_dashboard/saved_dashboards';
+import './saved_dashboard/saved_dashboard_register';
import './dashboard_config';
export * from './np_ready/dashboard_constants';
@@ -39,14 +33,8 @@ export * from './np_ready/dashboard_constants';
async function getAngularDependencies(): Promise {
const injector = await legacyChrome.dangerouslyGetActiveInjector();
- const Private = injector.get('Private');
-
- const savedObjectRegistry = Private(SavedObjectRegistryProvider);
-
return {
dashboardConfig: injector.get('dashboardConfig'),
- savedObjectRegistry,
- savedDashboards: injector.get('savedDashboards'),
};
}
diff --git a/src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts b/src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts
index d3c17d1176c104..ec0913e5fb3e77 100644
--- a/src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts
+++ b/src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts
@@ -32,7 +32,6 @@ export { AppState } from 'ui/state_management/app_state';
export { AppStateClass } from 'ui/state_management/app_state';
export { SavedObjectSaveOpts } from 'ui/saved_objects/types';
export { npSetup, npStart } from 'ui/new_platform';
-export { SavedObjectRegistryProvider } from 'ui/saved_objects';
export { IPrivate } from 'ui/private';
export { SavedObjectSaveModal } from 'ui/saved_objects/components/saved_object_save_modal';
export { subscribeWithScope } from 'ui/utils/subscribe_with_scope';
@@ -65,5 +64,6 @@ export { stateMonitorFactory, StateMonitor } from 'ui/state_management/state_mon
export { ensureDefaultIndexPattern } from 'ui/legacy_compat';
export { unhashUrl } from '../../../../../plugins/kibana_utils/public';
export { IInjector } from 'ui/chrome';
+export { SavedObjectLoader } from 'ui/saved_objects';
export { VISUALIZE_EMBEDDABLE_TYPE } from '../visualize_embeddable';
export { registerTimefilterWithGlobalStateFactory } from 'ui/timefilter/setup_router';
diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/application.ts b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/application.ts
index 298dcee12dc35b..2a5dedab981510 100644
--- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/application.ts
+++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/application.ts
@@ -42,6 +42,7 @@ import {
RedirectWhenMissingProvider,
confirmModalFactory,
configureAppAngularModule,
+ SavedObjectLoader,
IPrivate,
} from '../legacy_imports';
@@ -57,9 +58,8 @@ export interface RenderDeps {
npDataStart: NpDataStart;
navigation: NavigationStart;
savedObjectsClient: SavedObjectsClientContract;
- savedObjectRegistry: any;
+ savedDashboards: SavedObjectLoader;
dashboardConfig: any;
- savedDashboards: any;
dashboardCapabilities: any;
uiSettings: IUiSettingsClient;
chrome: ChromeStart;
diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/legacy_app.js b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/legacy_app.js
index a4fda5eda8a321..540bfcf5aa6847 100644
--- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/legacy_app.js
+++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/legacy_app.js
@@ -98,7 +98,8 @@ export function initDashboardApp(app, deps) {
...defaults,
template: dashboardListingTemplate,
controller($injector, $location, $scope) {
- const services = deps.savedObjectRegistry.byLoaderPropertiesName;
+ const service = deps.savedDashboards;
+
const kbnUrl = $injector.get('kbnUrl');
const dashboardConfig = deps.dashboardConfig;
@@ -107,7 +108,7 @@ export function initDashboardApp(app, deps) {
kbnUrl.redirect(DashboardConstants.CREATE_NEW_DASHBOARD_URL);
};
$scope.find = search => {
- return services.dashboards.find(search, $scope.listingLimit);
+ return service.find(search, $scope.listingLimit);
};
$scope.editItem = ({ id }) => {
kbnUrl.redirect(`${createDashboardEditUrl(id)}?_a=(viewMode:edit)`);
@@ -116,7 +117,7 @@ export function initDashboardApp(app, deps) {
return deps.addBasePath(`#${createDashboardEditUrl(id)}`);
};
$scope.delete = dashboards => {
- return services.dashboards.delete(dashboards.map(d => d.id));
+ return service.delete(dashboards.map(d => d.id));
};
$scope.hideWriteControls = dashboardConfig.getHideWriteControls();
$scope.initialFilter = $location.search().filter || EMPTY_FILTER;
diff --git a/src/legacy/core_plugins/kibana/public/dashboard/plugin.ts b/src/legacy/core_plugins/kibana/public/dashboard/plugin.ts
index 76deff201e5ee7..ca4b18a37504c6 100644
--- a/src/legacy/core_plugins/kibana/public/dashboard/plugin.ts
+++ b/src/legacy/core_plugins/kibana/public/dashboard/plugin.ts
@@ -39,11 +39,10 @@ import {
} from '../../../../../plugins/home/public';
import { SharePluginStart } from '../../../../../plugins/share/public';
import { KibanaLegacySetup } from '../../../../../plugins/kibana_legacy/public';
+import { createSavedDashboardLoader } from './saved_dashboard/saved_dashboards';
export interface LegacyAngularInjectedDependencies {
dashboardConfig: any;
- savedObjectRegistry: any;
- savedDashboards: any;
}
export interface DashboardPluginStartDependencies {
@@ -90,6 +89,13 @@ export class DashboardPlugin implements Plugin {
npDataStart,
} = this.startDependencies;
const angularDependencies = await getAngularDependencies();
+ const savedDashboards = createSavedDashboardLoader({
+ savedObjectsClient,
+ indexPatterns: npDataStart.indexPatterns,
+ chrome: contextCore.chrome,
+ overlays: contextCore.overlays,
+ });
+
const deps: RenderDeps = {
core: contextCore as LegacyCoreStart,
...angularDependencies,
@@ -97,6 +103,7 @@ export class DashboardPlugin implements Plugin {
share,
npDataStart,
savedObjectsClient,
+ savedDashboards,
chrome: contextCore.chrome,
addBasePath: contextCore.http.basePath.prepend,
uiSettings: contextCore.uiSettings,
diff --git a/src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboard_register.ts b/src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboard_register.ts
index 31ee7299e1ff16..b9ea49ca4fd441 100644
--- a/src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboard_register.ts
+++ b/src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboard_register.ts
@@ -16,10 +16,31 @@
* specific language governing permissions and limitations
* under the License.
*/
+import { i18n } from '@kbn/i18n';
+import { npStart } from 'ui/new_platform';
+// @ts-ignore
+import { uiModules } from 'ui/modules';
+// @ts-ignore
+import { savedObjectManagementRegistry } from '../../management/saved_object_registry';
+import { createSavedDashboardLoader } from './saved_dashboards';
-import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry';
-import './saved_dashboards';
+const module = uiModules.get('app/dashboard');
-SavedObjectRegistryProvider.register((savedDashboards: any) => {
- return savedDashboards;
+// Register this service with the saved object registry so it can be
+// edited by the object editor.
+savedObjectManagementRegistry.register({
+ service: 'savedDashboards',
+ title: i18n.translate('kbn.dashboard.savedDashboardsTitle', {
+ defaultMessage: 'dashboards',
+ }),
});
+
+// this is no longer used in the conroller, but just here for savedObjectManagementRegistry
+module.service('savedDashboards', () =>
+ createSavedDashboardLoader({
+ savedObjectsClient: npStart.core.savedObjects.client,
+ indexPatterns: npStart.plugins.data.indexPatterns,
+ chrome: npStart.core.chrome,
+ overlays: npStart.core.overlays,
+ })
+);
diff --git a/src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboards.ts b/src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboards.ts
index 768dc6650595f7..4ece5d46358ba5 100644
--- a/src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboards.ts
+++ b/src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboards.ts
@@ -17,36 +17,11 @@
* under the License.
*/
-import { i18n } from '@kbn/i18n';
-import { npStart } from 'ui/new_platform';
-// @ts-ignore
-import { uiModules } from 'ui/modules';
import { SavedObjectLoader } from 'ui/saved_objects';
-// @ts-ignore
-import { savedObjectManagementRegistry } from '../../management/saved_object_registry';
+import { SavedObjectKibanaServices } from 'ui/saved_objects/types';
import { createSavedDashboardClass } from './saved_dashboard';
-const module = uiModules.get('app/dashboard');
-
-// Register this service with the saved object registry so it can be
-// edited by the object editor.
-savedObjectManagementRegistry.register({
- service: 'savedDashboards',
- title: i18n.translate('kbn.dashboard.savedDashboardsTitle', {
- defaultMessage: 'dashboards',
- }),
-});
-
-// This is the only thing that gets injected into controllers
-module.service('savedDashboards', function() {
- const savedObjectsClient = npStart.core.savedObjects.client;
- const services = {
- savedObjectsClient,
- indexPatterns: npStart.plugins.data.indexPatterns,
- chrome: npStart.core.chrome,
- overlays: npStart.core.overlays,
- };
-
+export function createSavedDashboardLoader(services: SavedObjectKibanaServices) {
const SavedDashboard = createSavedDashboardClass(services);
- return new SavedObjectLoader(SavedDashboard, savedObjectsClient, npStart.core.chrome);
-});
+ return new SavedObjectLoader(SavedDashboard, services.savedObjectsClient, services.chrome);
+}
diff --git a/src/legacy/core_plugins/kibana/public/discover/index.ts b/src/legacy/core_plugins/kibana/public/discover/index.ts
index e85408dc9bf6b9..347f545dea4c95 100644
--- a/src/legacy/core_plugins/kibana/public/discover/index.ts
+++ b/src/legacy/core_plugins/kibana/public/discover/index.ts
@@ -18,7 +18,6 @@
*/
import { PluginInitializer, PluginInitializerContext } from 'kibana/public';
import { npSetup, npStart } from 'ui/new_platform';
-import { SavedObjectRegistryProvider } from 'ui/saved_objects';
import { DiscoverPlugin, DiscoverSetup, DiscoverStart } from './plugin';
// Core will be looking for this when loading our plugin in the new platform
@@ -33,8 +32,4 @@ export const pluginInstance = plugin({} as PluginInitializerContext);
pluginInstance.start(npStart.core, npStart.plugins);
})();
-SavedObjectRegistryProvider.register((savedSearches: any) => {
- return savedSearches;
-});
-
export { createSavedSearchesService } from './saved_searches/saved_searches';
diff --git a/src/legacy/core_plugins/kibana/public/discover/saved_searches/saved_searches_register.ts b/src/legacy/core_plugins/kibana/public/discover/saved_searches/saved_searches_register.ts
index bdb1495a33925f..ab7894fd5e730b 100644
--- a/src/legacy/core_plugins/kibana/public/discover/saved_searches/saved_searches_register.ts
+++ b/src/legacy/core_plugins/kibana/public/discover/saved_searches/saved_searches_register.ts
@@ -31,13 +31,13 @@ savedObjectManagementRegistry.register({
service: 'savedSearches',
title: 'searches',
});
+const services = {
+ savedObjectsClient: npStart.core.savedObjects.client,
+ indexPatterns: npStart.plugins.data.indexPatterns,
+ chrome: npStart.core.chrome,
+ overlays: npStart.core.overlays,
+};
+const savedSearches = createSavedSearchesService(services);
+
const module = uiModules.get('discover/saved_searches');
-module.service('savedSearches', () => {
- const services = {
- savedObjectsClient: npStart.core.savedObjects.client,
- indexPatterns: npStart.plugins.data.indexPatterns,
- chrome: npStart.core.chrome,
- overlays: npStart.core.overlays,
- };
- return createSavedSearchesService(services);
-});
+module.service('savedSearches', () => savedSearches);
diff --git a/src/legacy/core_plugins/kibana/public/visualize/index.ts b/src/legacy/core_plugins/kibana/public/visualize/index.ts
index bd605c5393d218..a389a44197baf4 100644
--- a/src/legacy/core_plugins/kibana/public/visualize/index.ts
+++ b/src/legacy/core_plugins/kibana/public/visualize/index.ts
@@ -25,7 +25,6 @@ import {
legacyChrome,
npSetup,
npStart,
- SavedObjectRegistryProvider,
VisEditorTypesRegistryProvider,
} from './legacy_imports';
import { VisualizePlugin, LegacyAngularInjectedDependencies } from './plugin';
@@ -45,13 +44,10 @@ async function getAngularDependencies(): Promise('Private');
const editorTypes = Private(VisEditorTypesRegistryProvider);
- const savedObjectRegistry = Private(SavedObjectRegistryProvider);
return {
legacyChrome,
editorTypes,
- savedObjectRegistry,
- savedVisualizations: injector.get('savedVisualizations'),
};
}
@@ -69,3 +65,5 @@ async function getAngularDependencies(): Promise {
const isLabsEnabled = uiSettings.get('visualize:enableLabs');
- return visualizationService
+ return savedVisualizations
.findListItems(filter, uiSettings.get('savedObjects:listingLimit'))
.then(result => {
this.totalItems = result.total;
diff --git a/src/legacy/core_plugins/kibana/public/visualize/plugin.ts b/src/legacy/core_plugins/kibana/public/visualize/plugin.ts
index d1afa2d0651946..9ea26f129895ce 100644
--- a/src/legacy/core_plugins/kibana/public/visualize/plugin.ts
+++ b/src/legacy/core_plugins/kibana/public/visualize/plugin.ts
@@ -46,14 +46,12 @@ import {
VisualizeEmbeddableFactory,
VISUALIZE_EMBEDDABLE_TYPE,
} from './legacy_imports';
-import { SavedVisualizations } from './np_ready/types';
import { UsageCollectionSetup } from '../../../../../plugins/usage_collection/public';
+import { createSavedVisLoader } from './saved_visualizations/saved_visualizations';
export interface LegacyAngularInjectedDependencies {
legacyChrome: any;
editorTypes: any;
- savedObjectRegistry: any;
- savedVisualizations: SavedVisualizations;
}
export interface VisualizePluginStartDependencies {
@@ -110,6 +108,12 @@ export class VisualizePlugin implements Plugin {
} = this.startDependencies;
const angularDependencies = await getAngularDependencies();
+ const savedVisualizations = createSavedVisLoader({
+ savedObjectsClient,
+ indexPatterns: data.indexPatterns,
+ chrome: contextCore.chrome,
+ overlays: contextCore.overlays,
+ });
const deps: VisualizeKibanaServices = {
...angularDependencies,
addBasePath: contextCore.http.basePath.prepend,
@@ -122,6 +126,7 @@ export class VisualizePlugin implements Plugin {
localStorage: new Storage(localStorage),
navigation,
savedObjectsClient,
+ savedVisualizations,
savedQueryService: data.query.savedQueries,
share,
toastNotifications: contextCore.notifications.toasts,
diff --git a/src/legacy/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualization_register.ts b/src/legacy/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualization_register.ts
index 803474b1f7b3f1..cbf72339804ce9 100644
--- a/src/legacy/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualization_register.ts
+++ b/src/legacy/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualization_register.ts
@@ -16,15 +16,22 @@
* specific language governing permissions and limitations
* under the License.
*/
-
-import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry';
+import { npStart } from 'ui/new_platform';
+// @ts-ignore
+import { uiModules } from 'ui/modules';
// @ts-ignore
import { savedObjectManagementRegistry } from '../../management/saved_object_registry';
import './saved_visualizations';
+import { createSavedVisLoader } from './saved_visualizations';
-SavedObjectRegistryProvider.register((savedVisualizations: any) => {
- return savedVisualizations;
-});
+const services = {
+ savedObjectsClient: npStart.core.savedObjects.client,
+ indexPatterns: npStart.plugins.data.indexPatterns,
+ chrome: npStart.core.chrome,
+ overlays: npStart.core.overlays,
+};
+
+const savedObjectLoaderVisualize = createSavedVisLoader(services);
// Register this service with the saved object registry so it can be
// edited by the object editor.
@@ -32,3 +39,5 @@ savedObjectManagementRegistry.register({
service: 'savedVisualizations',
title: 'visualizations',
});
+
+uiModules.get('app/visualize').service('savedVisualizations', () => savedObjectLoaderVisualize);
diff --git a/src/legacy/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualizations.ts b/src/legacy/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualizations.ts
index aa8d20fed48289..c19c7818c1fbda 100644
--- a/src/legacy/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualizations.ts
+++ b/src/legacy/core_plugins/kibana/public/visualize/saved_visualizations/saved_visualizations.ts
@@ -16,26 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-import { npStart } from 'ui/new_platform';
-// @ts-ignore
-import { uiModules } from 'ui/modules';
import { SavedObjectLoader } from 'ui/saved_objects';
+import { SavedObjectKibanaServices } from 'ui/saved_objects/types';
import { start as visualizations } from '../../../../visualizations/public/np_ready/public/legacy';
// @ts-ignore
import { findListItems } from './find_list_items';
import { createSavedVisClass } from './_saved_vis';
import { createVisualizeEditUrl } from '..';
-const app = uiModules.get('app/visualize');
-app.service('savedVisualizations', function() {
- const savedObjectsClient = npStart.core.savedObjects.client;
- const services = {
- savedObjectsClient,
- indexPatterns: npStart.plugins.data.indexPatterns,
- chrome: npStart.core.chrome,
- overlays: npStart.core.overlays,
- };
+export function createSavedVisLoader(services: SavedObjectKibanaServices) {
+ const { savedObjectsClient } = services;
+
class SavedObjectLoaderVisualize extends SavedObjectLoader {
mapHitSource = (source: Record, id: string) => {
const visTypes = visualizations.types;
@@ -81,6 +73,5 @@ app.service('savedVisualizations', function() {
}
}
const SavedVis = createSavedVisClass(services);
-
- return new SavedObjectLoaderVisualize(SavedVis, savedObjectsClient, npStart.core.chrome);
-});
+ return new SavedObjectLoaderVisualize(SavedVis, savedObjectsClient, services.chrome);
+}
diff --git a/src/legacy/core_plugins/timelion/public/app.js b/src/legacy/core_plugins/timelion/public/app.js
index 365e74e93c4ada..7ef722ee3a277c 100644
--- a/src/legacy/core_plugins/timelion/public/app.js
+++ b/src/legacy/core_plugins/timelion/public/app.js
@@ -23,7 +23,6 @@ import { i18n } from '@kbn/i18n';
import { capabilities } from 'ui/capabilities';
import { docTitle } from 'ui/doc_title';
-import { SavedObjectRegistryProvider } from 'ui/saved_objects/saved_object_registry';
import { fatalError, toastNotifications } from 'ui/notify';
import { timezoneProvider } from 'ui/vis/lib/timezone';
import { timefilter } from 'ui/timefilter';
@@ -36,16 +35,15 @@ require('ui/autoload/all');
// TODO: remove ui imports completely (move to plugins)
import 'ui/directives/input_focus';
-import 'ui/directives/saved_object_finder';
+import './directives/saved_object_finder';
import 'ui/directives/listen';
import 'ui/kbn_top_nav';
import 'ui/saved_objects/ui/saved_object_save_as_checkbox';
import '../../data/public/legacy';
-import './services/saved_sheets';
-import './services/_saved_sheet';
import './services/saved_sheet_register';
import rootTemplate from 'plugins/timelion/index.html';
+import { createSavedVisLoader } from '../../kibana/public/visualize';
require('plugins/timelion/directives/cells/cells');
require('plugins/timelion/directives/fixed_element');
@@ -130,8 +128,12 @@ app.controller('timelion', function(
timefilter.enableAutoRefreshSelector();
timefilter.enableTimeRangeSelector();
- const savedVisualizations = Private(SavedObjectRegistryProvider).byLoaderPropertiesName
- .visualizations;
+ const savedVisualizations = createSavedVisLoader({
+ savedObjectsClient: npStart.core.savedObjects.client,
+ indexPatterns: npStart.plugins.data.indexPatterns,
+ chrome: npStart.core.chrome,
+ overlays: npStart.core.overlays,
+ });
const timezone = Private(timezoneProvider)();
const defaultExpression = '.es(*)';
diff --git a/src/legacy/ui/public/directives/partials/saved_object_finder.html b/src/legacy/core_plugins/timelion/public/directives/saved_object_finder.html
similarity index 86%
rename from src/legacy/ui/public/directives/partials/saved_object_finder.html
rename to src/legacy/core_plugins/timelion/public/directives/saved_object_finder.html
index adf7f5dacae9a6..ad148801c03a4a 100644
--- a/src/legacy/ui/public/directives/partials/saved_object_finder.html
+++ b/src/legacy/core_plugins/timelion/public/directives/saved_object_finder.html
@@ -23,7 +23,7 @@
@@ -33,7 +33,7 @@
ng-if="onAddNew"
ng-click="onAddNew()"
data-test-subj="addNewSavedObjectLink"
- i18n-id="common.ui.savedObjectFinder.addNewItemButtonLabel"
+ i18n-id="timelion.savedObjectFinder.addNewItemButtonLabel"
i18n-default-message="Add new {item}"
i18n-values="{item: finder.properties.noun}"
i18n-description="{item} can be a type of object in Kibana, like 'visualization', 'dashboard', etc"
@@ -43,7 +43,7 @@
class="kuiButton kuiButton--secondary"
ng-if="!useLocalManagement"
ng-click="finder.manageObjects(finder.properties.name)"
- i18n-id="common.ui.savedObjectFinder.manageItemsButtonLabel"
+ i18n-id="timelion.savedObjectFinder.manageItemsButtonLabel"
i18n-default-message="Manage {items}"
i18n-values="{items: finder.properties.nouns}"
i18n-description="{items} can be a type of object in Kibana, like 'visualizations', 'dashboards', etc"
@@ -64,11 +64,11 @@
aria-live="assertive"
>
@@ -108,7 +108,7 @@
class="list-group-item list-group-no-results"
ng-if="finder.hits.length === 0"
>
-
{
- return savedSheets;
-});
diff --git a/src/legacy/core_plugins/timelion/public/services/saved_sheets.ts b/src/legacy/core_plugins/timelion/public/services/saved_sheets.ts
index d851b5a8636581..df3898e3410ddd 100644
--- a/src/legacy/core_plugins/timelion/public/services/saved_sheets.ts
+++ b/src/legacy/core_plugins/timelion/public/services/saved_sheets.ts
@@ -33,29 +33,28 @@ savedObjectManagementRegistry.register({
title: 'sheets',
});
-// This is the only thing that gets injected into controllers
-module.service('savedSheets', function() {
- const savedObjectsClient = npStart.core.savedObjects.client;
- const services = {
- savedObjectsClient,
- indexPatterns: npStart.plugins.data.indexPatterns,
- chrome: npStart.core.chrome,
- overlays: npStart.core.overlays,
- };
+const savedObjectsClient = npStart.core.savedObjects.client;
+const services = {
+ savedObjectsClient,
+ indexPatterns: npStart.plugins.data.indexPatterns,
+ chrome: npStart.core.chrome,
+ overlays: npStart.core.overlays,
+};
- const SavedSheet = createSavedSheetClass(services, npStart.core.uiSettings);
+const SavedSheet = createSavedSheetClass(services, npStart.core.uiSettings);
- const savedSheetLoader = new SavedObjectLoader(
- SavedSheet,
- savedObjectsClient,
- npStart.core.chrome
- );
- savedSheetLoader.urlFor = id => `#/${encodeURIComponent(id)}`;
- // Customize loader properties since adding an 's' on type doesn't work for type 'timelion-sheet'.
- savedSheetLoader.loaderProperties = {
- name: 'timelion-sheet',
- noun: 'Saved Sheets',
- nouns: 'saved sheets',
- };
- return savedSheetLoader;
-});
+export const savedSheetLoader = new SavedObjectLoader(
+ SavedSheet,
+ savedObjectsClient,
+ npStart.core.chrome
+);
+savedSheetLoader.urlFor = id => `#/${encodeURIComponent(id)}`;
+// Customize loader properties since adding an 's' on type doesn't work for type 'timelion-sheet'.
+savedSheetLoader.loaderProperties = {
+ name: 'timelion-sheet',
+ noun: 'Saved Sheets',
+ nouns: 'saved sheets',
+};
+
+// This is the only thing that gets injected into controllers
+module.service('savedSheets', () => savedSheetLoader);
diff --git a/src/legacy/ui/public/saved_objects/index.ts b/src/legacy/ui/public/saved_objects/index.ts
index 3c77a02c608c65..129938ebe05090 100644
--- a/src/legacy/ui/public/saved_objects/index.ts
+++ b/src/legacy/ui/public/saved_objects/index.ts
@@ -17,7 +17,6 @@
* under the License.
*/
-export { SavedObjectRegistryProvider } from './saved_object_registry';
export { SavedObjectsClientProvider } from './saved_objects_client_provider';
export { SavedObjectLoader } from './saved_object_loader';
export { findObjectByTitle } from './helpers/find_object_by_title';
diff --git a/src/legacy/ui/public/saved_objects/saved_object_registry.ts b/src/legacy/ui/public/saved_objects/saved_object_registry.ts
deleted file mode 100644
index 34b91267bfb322..00000000000000
--- a/src/legacy/ui/public/saved_objects/saved_object_registry.ts
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { uiRegistry } from '../registry/_registry';
-
-export const SavedObjectRegistryProvider = uiRegistry({
- name: 'savedObjects',
- index: ['loaderProperties.name'],
- order: ['loaderProperties.name'],
-});
diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json
index c79969154d05c0..54ae975849c29e 100644
--- a/x-pack/plugins/translations/translations/ja-JP.json
+++ b/x-pack/plugins/translations/translations/ja-JP.json
@@ -454,14 +454,14 @@
"common.ui.notify.toaster.unavailableServerErrorMessage": "HTTP リクエストが接続に失敗しました。Kibana サーバーが実行されていて、ご使用のブラウザの接続が正常に動作していることを確認するか、システム管理者にお問い合わせください。",
"common.ui.paginateControls.pageSizeLabel": "ページサイズ",
"common.ui.paginateControls.scrollTopButtonLabel": "最上部に移動",
- "common.ui.savedObjectFinder.addNewItemButtonLabel": "新規 {item} を追加",
- "common.ui.savedObjectFinder.manageItemsButtonLabel": "{items} の管理",
- "common.ui.savedObjectFinder.noMatchesFoundDescription": "一致する {items} が見つかりません。",
- "common.ui.savedObjectFinder.pageItemsFromHitCountDescription": "{hitCount} 件中 {pageFirstItem}-{pageLastItem} 件目",
- "common.ui.savedObjectFinder.sortByButtonLabeAscendingScreenReaderOnly": "昇順",
- "common.ui.savedObjectFinder.sortByButtonLabeDescendingScreenReaderOnly": "降順",
- "common.ui.savedObjectFinder.sortByButtonLabel": "名前",
- "common.ui.savedObjectFinder.sortByButtonLabelScreenReaderOnly": "並べ替え基準",
+ "timelion.savedObjectFinder.addNewItemButtonLabel": "新規 {item} を追加",
+ "timelion.savedObjectFinder.manageItemsButtonLabel": "{items} の管理",
+ "timelion.savedObjectFinder.noMatchesFoundDescription": "一致する {items} が見つかりません。",
+ "timelion.savedObjectFinder.pageItemsFromHitCountDescription": "{hitCount} 件中 {pageFirstItem}-{pageLastItem} 件目",
+ "timelion.savedObjectFinder.sortByButtonLabeAscendingScreenReaderOnly": "昇順",
+ "timelion.savedObjectFinder.sortByButtonLabeDescendingScreenReaderOnly": "降順",
+ "timelion.savedObjectFinder.sortByButtonLabel": "名前",
+ "timelion.savedObjectFinder.sortByButtonLabelScreenReaderOnly": "並べ替え基準",
"common.ui.savedObjects.confirmModal.overwriteButtonLabel": "上書き",
"common.ui.savedObjects.confirmModal.overwriteConfirmationMessage": "{title} を上書きしてよろしいですか?",
"common.ui.savedObjects.confirmModal.overwriteTitle": "{name} を上書きしますか?",
diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json
index 34559ba9f95be2..b63a8feeae02ba 100644
--- a/x-pack/plugins/translations/translations/zh-CN.json
+++ b/x-pack/plugins/translations/translations/zh-CN.json
@@ -454,14 +454,14 @@
"common.ui.notify.toaster.unavailableServerErrorMessage": "HTTP 请求无法连接。请检查 Kibana 服务器是否正在运行以及您的浏览器是否具有有效的连接,或请联系您的系统管理员。",
"common.ui.paginateControls.pageSizeLabel": "页面大小",
"common.ui.paginateControls.scrollTopButtonLabel": "滚动至顶部",
- "common.ui.savedObjectFinder.addNewItemButtonLabel": "添加新的 {item}",
- "common.ui.savedObjectFinder.manageItemsButtonLabel": "管理 {items}",
- "common.ui.savedObjectFinder.noMatchesFoundDescription": "未找到任何匹配的 {items}。",
- "common.ui.savedObjectFinder.pageItemsFromHitCountDescription": "{pageFirstItem}-{pageLastItem} 页,共 {hitCount} 页",
- "common.ui.savedObjectFinder.sortByButtonLabeAscendingScreenReaderOnly": "升序",
- "common.ui.savedObjectFinder.sortByButtonLabeDescendingScreenReaderOnly": "降序",
- "common.ui.savedObjectFinder.sortByButtonLabel": "名称",
- "common.ui.savedObjectFinder.sortByButtonLabelScreenReaderOnly": "排序依据",
+ "timelion.savedObjectFinder.addNewItemButtonLabel": "添加新的 {item}",
+ "timelion.savedObjectFinder.manageItemsButtonLabel": "管理 {items}",
+ "timelion.savedObjectFinder.noMatchesFoundDescription": "未找到任何匹配的 {items}。",
+ "timelion.savedObjectFinder.pageItemsFromHitCountDescription": "{pageFirstItem}-{pageLastItem} 页,共 {hitCount} 页",
+ "timelion.savedObjectFinder.sortByButtonLabeAscendingScreenReaderOnly": "升序",
+ "timelion.savedObjectFinder.sortByButtonLabeDescendingScreenReaderOnly": "降序",
+ "timelion.savedObjectFinder.sortByButtonLabel": "名称",
+ "timelion.savedObjectFinder.sortByButtonLabelScreenReaderOnly": "排序依据",
"common.ui.savedObjects.confirmModal.overwriteButtonLabel": "覆盖",
"common.ui.savedObjects.confirmModal.overwriteConfirmationMessage": "确定要覆盖 “{title}”?",
"common.ui.savedObjects.confirmModal.overwriteTitle": "覆盖“{name}”?",
From 8ee7d873b6f9adf73ba5ab6a645bb417df66b820 Mon Sep 17 00:00:00 2001
From: Maja Grubic
Date: Mon, 23 Dec 2019 11:06:07 +0000
Subject: [PATCH 7/9] [Dashboard] Grid: removing double handler (#53707)
* Fixing double handler
* Adding a comment
Co-authored-by: Elastic Machine
---
.../public/embeddable/grid/_dashboard_grid.scss | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/grid/_dashboard_grid.scss b/src/plugins/dashboard_embeddable_container/public/embeddable/grid/_dashboard_grid.scss
index 9efd36b05095e1..a205e611531b69 100644
--- a/src/plugins/dashboard_embeddable_container/public/embeddable/grid/_dashboard_grid.scss
+++ b/src/plugins/dashboard_embeddable_container/public/embeddable/grid/_dashboard_grid.scss
@@ -74,7 +74,7 @@
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='6' height='6' viewBox='0 0 6 6'%3E%3Cpolygon fill='#{hexToRGB($euiColorDarkShade)}' points='6 6 0 6 0 4.2 4 4.2 4.2 4.2 4.2 0 6 0' /%3E%3C/svg%3E%0A");
&::after {
- border: none;
+ border: none !important; /** overrides library default visual indicator **/
}
&:hover,
From 04ef735cd4730628df3c206f44a5e6cd48dbf281 Mon Sep 17 00:00:00 2001
From: Liza Katz
Date: Mon, 23 Dec 2019 12:49:03 +0000
Subject: [PATCH 8/9] Clean up search servie (#53701)
* ts
* fix import path
---
src/legacy/core_plugins/data/public/plugin.ts | 13 ++++++--
.../data/public/search/expressions/esaggs.ts | 32 +++++++++----------
...d_failure_open_modal_button.test.mocks.tsx | 19 +++++------
.../shard_failure_open_modal_button.tsx | 6 ++--
.../search/fetch/handle_response.test.ts | 26 +++++++--------
.../public/search/fetch/handle_response.tsx | 7 ++--
.../search/search_source/search_source.ts | 2 +-
.../edit_index_pattern/edit_index_pattern.js | 2 +-
src/plugins/data/public/services.ts | 5 +++
.../field_wildcard/field_wildcard.test.ts | 0
.../public/field_wildcard/field_wildcard.ts | 0
.../public/field_wildcard/index.ts | 0
src/plugins/kibana_utils/public/index.ts | 1 +
13 files changed, 62 insertions(+), 51 deletions(-)
rename src/{legacy/ui => plugins/kibana_utils}/public/field_wildcard/field_wildcard.test.ts (100%)
rename src/{legacy/ui => plugins/kibana_utils}/public/field_wildcard/field_wildcard.ts (100%)
rename src/{legacy/ui => plugins/kibana_utils}/public/field_wildcard/index.ts (100%)
diff --git a/src/legacy/core_plugins/data/public/plugin.ts b/src/legacy/core_plugins/data/public/plugin.ts
index 6c67408158b51c..893e477b38583d 100644
--- a/src/legacy/core_plugins/data/public/plugin.ts
+++ b/src/legacy/core_plugins/data/public/plugin.ts
@@ -21,8 +21,13 @@ import { CoreSetup, CoreStart, Plugin } from 'kibana/public';
import { SearchService, SearchStart } from './search';
import { DataPublicPluginStart } from '../../../../plugins/data/public';
-// eslint-disable-next-line @kbn/eslint/no-restricted-paths
-import { setFieldFormats } from '../../../../plugins/data/public/services';
+import {
+ setFieldFormats,
+ setNotifications,
+ setIndexPatterns,
+ setQueryService,
+ // eslint-disable-next-line @kbn/eslint/no-restricted-paths
+} from '../../../../plugins/data/public/services';
export interface DataPluginStartDependencies {
data: DataPublicPluginStart;
@@ -57,6 +62,10 @@ export class DataPlugin implements Plugin {
// Create a new search source that inherits the original search source
@@ -216,7 +216,7 @@ const handleCourierRequest = async ({
}
inspectorAdapters.data.setTabularLoader(
- () => buildTabularInspectorData((searchSource as any).tabifiedResponse, queryFilter),
+ () => buildTabularInspectorData((searchSource as any).tabifiedResponse, filterManager),
{ returnsFormattedValues: true }
);
@@ -259,10 +259,8 @@ export const esaggs = (): ExpressionFunction {
- return {
- npStart: {
- core: {
- overlays: {
- openModal,
- },
- },
- },
- };
-});
+setOverlays(({
+ openModal,
+} as unknown) as OverlayStart);
diff --git a/src/legacy/core_plugins/data/public/search/fetch/components/shard_failure_open_modal_button.tsx b/src/legacy/core_plugins/data/public/search/fetch/components/shard_failure_open_modal_button.tsx
index d81ee70a4611cd..c3ff042083473c 100644
--- a/src/legacy/core_plugins/data/public/search/fetch/components/shard_failure_open_modal_button.tsx
+++ b/src/legacy/core_plugins/data/public/search/fetch/components/shard_failure_open_modal_button.tsx
@@ -17,11 +17,11 @@
* under the License.
*/
import React from 'react';
-// @ts-ignore
-import { npStart } from 'ui/new_platform';
import { FormattedMessage } from '@kbn/i18n/react';
import { EuiButton, EuiTextAlign } from '@elastic/eui';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import { getOverlays } from '../../../../../../../plugins/data/public/services';
import { toMountPoint } from '../../../../../../../plugins/kibana_react/public';
import { ShardFailureModal } from './shard_failure_modal';
import { ResponseWithShardFailure, Request } from './shard_failure_types';
@@ -34,7 +34,7 @@ interface Props {
export function ShardFailureOpenModalButton({ request, response, title }: Props) {
function onClick() {
- const modal = npStart.core.overlays.openModal(
+ const modal = getOverlays().openModal(
toMountPoint(
{
- return {
- toastNotifications: {
- addWarning: jest.fn(),
- },
- };
-});
+// Temporary disable eslint, will be removed after moving to new platform folder
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import { notificationServiceMock } from '../../../../../../core/public/notifications/notifications_service.mock';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import { setNotifications } from '../../../../../../plugins/data/public/services';
jest.mock('@kbn/i18n', () => {
return {
@@ -37,8 +34,11 @@ jest.mock('@kbn/i18n', () => {
});
describe('handleResponse', () => {
+ const notifications = notificationServiceMock.createStartContract();
+
beforeEach(() => {
- (toastNotifications.addWarning as jest.Mock).mockReset();
+ setNotifications(notifications);
+ (notifications.toasts.addWarning as jest.Mock).mockReset();
});
test('should notify if timed out', () => {
@@ -48,8 +48,8 @@ describe('handleResponse', () => {
};
const result = handleResponse(request, response);
expect(result).toBe(response);
- expect(toastNotifications.addWarning).toBeCalled();
- expect((toastNotifications.addWarning as jest.Mock).mock.calls[0][0].title).toMatch(
+ expect(notifications.toasts.addWarning).toBeCalled();
+ expect((notifications.toasts.addWarning as jest.Mock).mock.calls[0][0].title).toMatch(
'request timed out'
);
});
@@ -63,8 +63,8 @@ describe('handleResponse', () => {
};
const result = handleResponse(request, response);
expect(result).toBe(response);
- expect(toastNotifications.addWarning).toBeCalled();
- expect((toastNotifications.addWarning as jest.Mock).mock.calls[0][0].title).toMatch(
+ expect(notifications.toasts.addWarning).toBeCalled();
+ expect((notifications.toasts.addWarning as jest.Mock).mock.calls[0][0].title).toMatch(
'shards failed'
);
});
diff --git a/src/legacy/core_plugins/data/public/search/fetch/handle_response.tsx b/src/legacy/core_plugins/data/public/search/fetch/handle_response.tsx
index e3fd5ad15242d0..a08b7d14fd1c37 100644
--- a/src/legacy/core_plugins/data/public/search/fetch/handle_response.tsx
+++ b/src/legacy/core_plugins/data/public/search/fetch/handle_response.tsx
@@ -20,15 +20,16 @@
import React from 'react';
import { i18n } from '@kbn/i18n';
import { EuiSpacer } from '@elastic/eui';
-import { toastNotifications } from 'ui/notify/toasts';
import { ShardFailureOpenModalButton } from './components/shard_failure_open_modal_button';
import { Request, ResponseWithShardFailure } from './components/shard_failure_types';
import { SearchRequest, SearchResponse } from '../types';
import { toMountPoint } from '../../../../../../plugins/kibana_react/public';
+// eslint-disable-next-line @kbn/eslint/no-restricted-paths
+import { getNotifications } from '../../../../../../plugins/data/public/services';
export function handleResponse(request: SearchRequest, response: SearchResponse) {
if (response.timed_out) {
- toastNotifications.addWarning({
+ getNotifications().toasts.addWarning({
title: i18n.translate('data.search.searchSource.fetch.requestTimedOutNotificationMessage', {
defaultMessage: 'Data might be incomplete because your request timed out',
}),
@@ -62,7 +63,7 @@ export function handleResponse(request: SearchRequest, response: SearchResponse)
>
);
- toastNotifications.addWarning({ title, text });
+ getNotifications().toasts.addWarning({ title, text });
}
return response;
diff --git a/src/legacy/core_plugins/data/public/search/search_source/search_source.ts b/src/legacy/core_plugins/data/public/search/search_source/search_source.ts
index 01fc34e230a316..6efcae4d4b88dc 100644
--- a/src/legacy/core_plugins/data/public/search/search_source/search_source.ts
+++ b/src/legacy/core_plugins/data/public/search/search_source/search_source.ts
@@ -72,9 +72,9 @@
import _ from 'lodash';
import { npSetup } from 'ui/new_platform';
import chrome from 'ui/chrome';
-import { fieldWildcardFilter } from 'ui/field_wildcard';
import { normalizeSortRequest } from './normalize_sort_request';
import { fetchSoon } from '../fetch';
+import { fieldWildcardFilter } from '../../../../../../plugins/kibana_utils/public';
import { getHighlightRequest, esFilters, esQuery } from '../../../../../../plugins/data/public';
import { RequestFailure } from '../fetch/errors';
import { filterDocvalueFields } from './filter_docvalue_fields';
diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.js
index 9d84c033837434..ffc9aed9a27a3b 100644
--- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.js
+++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/edit_index_pattern/edit_index_pattern.js
@@ -27,7 +27,7 @@ import { fatalError, toastNotifications } from 'ui/notify';
import uiRoutes from 'ui/routes';
import { uiModules } from 'ui/modules';
import template from './edit_index_pattern.html';
-import { fieldWildcardMatcher } from 'ui/field_wildcard';
+import { fieldWildcardMatcher } from '../../../../../../../../plugins/kibana_utils/public';
import { setup as managementSetup } from '../../../../../../management/public/legacy';
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
diff --git a/src/plugins/data/public/services.ts b/src/plugins/data/public/services.ts
index 4a832105b69918..76b3283220f673 100644
--- a/src/plugins/data/public/services.ts
+++ b/src/plugins/data/public/services.ts
@@ -22,6 +22,7 @@ import { CoreStart } from 'kibana/public';
import { FieldFormatsStart } from '.';
import { createGetterSetter } from '../../kibana_utils/public';
import { IndexPatternsContract } from './index_patterns';
+import { DataPublicPluginStart } from './types';
export const [getNotifications, setNotifications] = createGetterSetter(
'Notifications'
@@ -36,3 +37,7 @@ export const [getOverlays, setOverlays] = createGetterSetter(
'IndexPatterns'
);
+
+export const [getQueryService, setQueryService] = createGetterSetter<
+ DataPublicPluginStart['query']
+>('Query');
diff --git a/src/legacy/ui/public/field_wildcard/field_wildcard.test.ts b/src/plugins/kibana_utils/public/field_wildcard/field_wildcard.test.ts
similarity index 100%
rename from src/legacy/ui/public/field_wildcard/field_wildcard.test.ts
rename to src/plugins/kibana_utils/public/field_wildcard/field_wildcard.test.ts
diff --git a/src/legacy/ui/public/field_wildcard/field_wildcard.ts b/src/plugins/kibana_utils/public/field_wildcard/field_wildcard.ts
similarity index 100%
rename from src/legacy/ui/public/field_wildcard/field_wildcard.ts
rename to src/plugins/kibana_utils/public/field_wildcard/field_wildcard.ts
diff --git a/src/legacy/ui/public/field_wildcard/index.ts b/src/plugins/kibana_utils/public/field_wildcard/index.ts
similarity index 100%
rename from src/legacy/ui/public/field_wildcard/index.ts
rename to src/plugins/kibana_utils/public/field_wildcard/index.ts
diff --git a/src/plugins/kibana_utils/public/index.ts b/src/plugins/kibana_utils/public/index.ts
index 6e6b5c582b0eb9..af2fc9e31b21bb 100644
--- a/src/plugins/kibana_utils/public/index.ts
+++ b/src/plugins/kibana_utils/public/index.ts
@@ -21,6 +21,7 @@ export { defer } from '../common';
export * from './core';
export * from './errors';
export * from './field_mapping';
+export * from './field_wildcard';
export * from './parse';
export * from './render_complete';
export * from './resize_checker';
From 08ff02426b8ca33241db6a89fd3ac78a69724cea Mon Sep 17 00:00:00 2001
From: Daniil Suleiman <31325372+sulemanof@users.noreply.github.com>
Date: Mon, 23 Dec 2019 17:06:38 +0300
Subject: [PATCH 9/9] Disable inspector for timelion (#53747)
---
.../public/visualize_embeddable/visualize_embeddable.ts | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/legacy/core_plugins/kibana/public/visualize_embeddable/visualize_embeddable.ts b/src/legacy/core_plugins/kibana/public/visualize_embeddable/visualize_embeddable.ts
index 4d45b0d86023ec..fc91742c53cca5 100644
--- a/src/legacy/core_plugins/kibana/public/visualize_embeddable/visualize_embeddable.ts
+++ b/src/legacy/core_plugins/kibana/public/visualize_embeddable/visualize_embeddable.ts
@@ -277,7 +277,13 @@ export class VisualizeEmbeddable extends Embeddable {
- const visTypesWithoutInspector = ['markdown', 'input_control_vis', 'metrics', 'vega'];
+ const visTypesWithoutInspector = [
+ 'markdown',
+ 'input_control_vis',
+ 'metrics',
+ 'vega',
+ 'timelion',
+ ];
if (visTypesWithoutInspector.includes(this.vis.type.name)) {
return false;
}