diff --git a/src/core/MIGRATION.md b/src/core/MIGRATION.md index 9e57fc4c36876..19f62a7d48923 100644 --- a/src/core/MIGRATION.md +++ b/src/core/MIGRATION.md @@ -1170,7 +1170,7 @@ import { setup, start } from '../core_plugins/visualizations/public/legacy'; | `import 'ui/query_bar'` | `import { QueryStringInput } from '../data/public'` | Directives are deprecated. | | `import 'ui/search_bar'` | `import { SearchBar } from '../data/public'` | Directive is deprecated. | | `import 'ui/kbn_top_nav'` | `import { TopNavMenu } from '../navigation/public'` | Directive is still available in `ui/kbn_top_nav`. | -| `ui/saved_objects/components/saved_object_finder` | `import { SavedObjectFinder } from '../kibana_react/public'` | | +| `ui/saved_objects/components/saved_object_finder` | `import { SavedObjectFinder } from '../saved_objects/public'` | | | `core_plugins/interpreter` | `data.expressions` | still in progress | | `ui/courier` | `data.search` | still in progress | | `ui/embeddable` | `embeddables` | still in progress | diff --git a/src/legacy/ui/public/saved_objects/__tests__/simple_saved_object.js b/src/core/public/saved_objects/simple_saved_object.test.ts similarity index 67% rename from src/legacy/ui/public/saved_objects/__tests__/simple_saved_object.js rename to src/core/public/saved_objects/simple_saved_object.test.ts index f2fc9bfe232e2..99676f6b78d42 100644 --- a/src/legacy/ui/public/saved_objects/__tests__/simple_saved_object.js +++ b/src/core/public/saved_objects/simple_saved_object.test.ts @@ -17,36 +17,43 @@ * under the License. */ -import sinon from 'sinon'; -import expect from '@kbn/expect'; -import { SimpleSavedObject } from '../../../../../core/public'; +import { SavedObject } from '../../server'; +import { SimpleSavedObject } from './simple_saved_object'; +import { SavedObjectsClientContract } from './saved_objects_client'; describe('SimpleSavedObject', () => { + let client: SavedObjectsClientContract; + + beforeEach(() => { + client = { + update: jest.fn(), + create: jest.fn(), + delete: jest.fn(), + } as any; + }); + it('persists type and id', () => { const id = 'logstash-*'; const type = 'index-pattern'; - const client = sinon.stub(); - const savedObject = new SimpleSavedObject(client, { id, type }); + const savedObject = new SimpleSavedObject(client, { id, type } as SavedObject); - expect(savedObject.id).to.be(id); - expect(savedObject.type).to.be(type); + expect(savedObject.id).toEqual(id); + expect(savedObject.type).toEqual(type); }); it('persists attributes', () => { const attributes = { title: 'My title' }; - const client = sinon.stub(); - const savedObject = new SimpleSavedObject(client, { attributes }); + const savedObject = new SimpleSavedObject(client, { attributes } as SavedObject); - expect(savedObject.attributes).to.be(attributes); + expect(savedObject.attributes).toEqual(attributes); }); it('persists version', () => { - const version = 2; + const version = '2'; - const client = sinon.stub(); - const savedObject = new SimpleSavedObject(client, { version }); - expect(savedObject._version).to.be(version); + const savedObject = new SimpleSavedObject(client, { version } as SavedObject); + expect(savedObject._version).toEqual(version); }); }); 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 d5198dc557f04..c1f679e9eb7ac 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts @@ -24,7 +24,6 @@ * directly where they are needed. */ -export { SavedObjectSaveOpts } from 'ui/saved_objects/types'; export { npSetup, npStart } from 'ui/new_platform'; export { subscribeWithScope } from 'ui/utils/subscribe_with_scope'; export { KbnUrl } from 'ui/url/kbn_url'; @@ -33,7 +32,6 @@ export { createTopNavDirective, createTopNavHelper } from 'ui/kbn_top_nav/kbn_to // @ts-ignore export { KbnUrlProvider, RedirectWhenMissingProvider } from 'ui/url/index'; export { IInjector } from 'ui/chrome'; -export { SavedObjectLoader } from 'ui/saved_objects'; export { absoluteToParsedUrl } from 'ui/url/absolute_to_parsed_url'; export { configureAppAngularModule, 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 cc104c1a931d0..7239d8f2258a7 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 @@ -38,7 +38,6 @@ import { PrivateProvider, PromiseServiceCreator, RedirectWhenMissingProvider, - SavedObjectLoader, } from '../legacy_imports'; // @ts-ignore import { initDashboardApp } from './legacy_app'; @@ -47,6 +46,7 @@ import { NavigationPublicPluginStart as NavigationStart } from '../../../../../. import { DataPublicPluginStart } from '../../../../../../plugins/data/public'; import { SharePluginStart } from '../../../../../../plugins/share/public'; import { KibanaLegacyStart } from '../../../../../../plugins/kibana_legacy/public'; +import { SavedObjectLoader } from '../../../../../../plugins/saved_objects/public'; export interface RenderDeps { pluginInitializerContext: PluginInitializerContext; diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx index 465203be0d34c..075516d52bab6 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx +++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/dashboard_app_controller.tsx @@ -26,9 +26,10 @@ import angular from 'angular'; import { Subscription } from 'rxjs'; import { map } from 'rxjs/operators'; import { History } from 'history'; +import { SavedObjectSaveOpts } from 'src/plugins/saved_objects/public'; import { DashboardEmptyScreen, DashboardEmptyScreenProps } from './dashboard_empty_screen'; -import { migrateLegacyQuery, SavedObjectSaveOpts, subscribeWithScope } from '../legacy_imports'; +import { migrateLegacyQuery, subscribeWithScope } from '../legacy_imports'; import { esFilters, IndexPattern, diff --git a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/lib/save_dashboard.ts b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/lib/save_dashboard.ts index d80208ce27ffe..db2b1f15247de 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/np_ready/lib/save_dashboard.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/np_ready/lib/save_dashboard.ts @@ -18,7 +18,7 @@ */ import { TimefilterContract } from 'src/plugins/data/public'; -import { SavedObjectSaveOpts } from '../../legacy_imports'; +import { SavedObjectSaveOpts } from '../../../../../../../plugins/saved_objects/public'; import { updateSavedDashboard } from './update_saved_dashboard'; import { DashboardStateManager } from '../dashboard_state_manager'; diff --git a/src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboard.ts b/src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboard.ts index 5babaf8061de9..c5ac05b5a77eb 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboard.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/saved_dashboard/saved_dashboard.ts @@ -16,8 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -import { SavedObject, SavedObjectKibanaServices } from 'ui/saved_objects/types'; -import { createSavedObjectClass } from 'ui/saved_objects/saved_object'; +import { + createSavedObjectClass, + SavedObject, + SavedObjectKibanaServices, +} from '../../../../../../plugins/saved_objects/public'; import { extractReferences, injectReferences } from './saved_dashboard_references'; import { 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 4ece5d46358ba..2ff76da9c5ca6 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,8 +17,10 @@ * under the License. */ -import { SavedObjectLoader } from 'ui/saved_objects'; -import { SavedObjectKibanaServices } from 'ui/saved_objects/types'; +import { + SavedObjectLoader, + SavedObjectKibanaServices, +} from '../../../../../../plugins/saved_objects/public'; import { createSavedDashboardClass } from './saved_dashboard'; export function createSavedDashboardLoader(services: SavedObjectKibanaServices) { diff --git a/src/legacy/core_plugins/kibana/public/discover/saved_searches/_saved_search.ts b/src/legacy/core_plugins/kibana/public/discover/saved_searches/_saved_search.ts index 113d13287bd12..7bd0eef8c19af 100644 --- a/src/legacy/core_plugins/kibana/public/discover/saved_searches/_saved_search.ts +++ b/src/legacy/core_plugins/kibana/public/discover/saved_searches/_saved_search.ts @@ -16,8 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -import { SavedObjectKibanaServices } from 'ui/saved_objects/types'; -import { createSavedObjectClass } from 'ui/saved_objects/saved_object'; + +import { + createSavedObjectClass, + SavedObjectKibanaServices, +} from '../../../../../../plugins/saved_objects/public'; export function createSavedSearchClass(services: SavedObjectKibanaServices) { const SavedObjectClass = createSavedObjectClass(services); diff --git a/src/legacy/core_plugins/kibana/public/discover/saved_searches/saved_searches.ts b/src/legacy/core_plugins/kibana/public/discover/saved_searches/saved_searches.ts index 0b34652461026..ebd341eba99fd 100644 --- a/src/legacy/core_plugins/kibana/public/discover/saved_searches/saved_searches.ts +++ b/src/legacy/core_plugins/kibana/public/discover/saved_searches/saved_searches.ts @@ -16,8 +16,11 @@ * specific language governing permissions and limitations * under the License. */ -import { SavedObjectLoader } from 'ui/saved_objects'; -import { SavedObjectKibanaServices } from 'ui/saved_objects/types'; + +import { + SavedObjectLoader, + SavedObjectKibanaServices, +} from '../../../../../../plugins/saved_objects/public'; import { createSavedSearchClass } from './_saved_search'; export function createSavedSearchesLoader(services: SavedObjectKibanaServices) { diff --git a/src/legacy/core_plugins/kibana/public/management/saved_object_registry.ts b/src/legacy/core_plugins/kibana/public/management/saved_object_registry.ts index 0a6ac20502669..e0756b2e78e25 100644 --- a/src/legacy/core_plugins/kibana/public/management/saved_object_registry.ts +++ b/src/legacy/core_plugins/kibana/public/management/saved_object_registry.ts @@ -20,7 +20,7 @@ import _ from 'lodash'; import { i18n } from '@kbn/i18n'; import { npStart } from 'ui/new_platform'; -import { SavedObjectLoader } from 'ui/saved_objects'; +import { SavedObjectLoader } from '../../../../../plugins/saved_objects/public'; import { createSavedDashboardLoader } from '../dashboard'; import { createSavedSearchesLoader } from '../discover'; import { TypesService, createSavedVisLoader } from '../../../visualizations/public'; diff --git a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/render.test.js b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/render.test.js index af580547b11ed..1b9dafb6daf23 100644 --- a/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/render.test.js +++ b/src/legacy/core_plugins/kibana/public/management/sections/index_patterns/create_index_pattern_wizard/render.test.js @@ -50,6 +50,7 @@ describe('CreateIndexPatternWizardRender', () => { config: {}, changeUrl: () => {}, indexPatternCreationType: {}, + openConfirm: jest.fn(), }); expect(render.mock.calls.length).toBe(1); diff --git a/src/legacy/core_plugins/timelion/public/directives/saved_object_save_as_checkbox.html b/src/legacy/core_plugins/timelion/public/directives/saved_object_save_as_checkbox.html index 3e4a1526113c3..5adce4286010a 100644 --- a/src/legacy/core_plugins/timelion/public/directives/saved_object_save_as_checkbox.html +++ b/src/legacy/core_plugins/timelion/public/directives/saved_object_save_as_checkbox.html @@ -5,7 +5,7 @@ i18n-id="timelion.savedObjects.howToSaveAsNewDescription" i18n-default-message="In previous versions of Kibana, changing the name of a {savedObjectName} would make a copy with the new name. Use the 'Save as a new {savedObjectName}' checkbox to do this now." i18n-values="{ savedObjectName: savedObject.getDisplayName() }" - i18n-description="'Save as a new {savedObjectName}' refers to common.ui.savedObjects.saveAsNewLabel and should be the same text." + i18n-description="'Save as a new {savedObjectName}' refers to timelion.savedObjects.saveAsNewLabel and should be the same text." >