| 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 ff71f13466cf8..238424b1df1d5 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 23a72fc3c68b3..4fbcf0981f114 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 551e13faaf154..31dc6ceb91995 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 36ea6103fb352..2462ae17943be 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 eca6a31bd547f..c86ef616de103 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 0406a372c4e9d..b1c75e6dbdf67 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 76d9933a3d567..fd39f28a7673a 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 d3c17d1176c10..ec0913e5fb3e7 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 298dcee12dc35..2a5dedab98151 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 a4fda5eda8a32..540bfcf5aa684 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 76deff201e5ee..ca4b18a37504c 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 31ee7299e1ff1..b9ea49ca4fd44 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 768dc6650595f..4ece5d46358ba 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 e85408dc9bf6b..347f545dea4c9 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 bdb1495a33925..ab7894fd5e730 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 bd605c5393d21..a389a44197baf 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 d1afa2d065194..9ea26f129895c 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 803474b1f7b3f..cbf72339804ce 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 aa8d20fed4828..c19c7818c1fbd 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 365e74e93c4ad..7ef722ee3a277 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 adf7f5dacae9a..ad148801c03a4 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 d851b5a863658..df3898e3410dd 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 3c77a02c608c6..129938ebe0509 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 34b91267bfb32..0000000000000
--- 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 c79969154d05c..54ae975849c29 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 34559ba9f95be..b63a8feeae02b 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}”?",