diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/index.ts b/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/index.ts index 3138008f3e3a0..d3133739ebcd8 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/index.ts +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/index.ts @@ -19,4 +19,3 @@ export * from './types'; export * from './search_embeddable_factory'; -export * from './search_embeddable'; diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable_factory.ts b/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable_factory.ts index ad61984a52536..37e1ac8dc525c 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable_factory.ts +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/search_embeddable_factory.ts @@ -28,8 +28,7 @@ import { } from '../../../../../../../plugins/embeddable/public'; import { TimeRange } from '../../../../../../../plugins/data/public'; -import { SearchEmbeddable } from './search_embeddable'; -import { SearchInput, SearchOutput } from './types'; +import { SearchInput, SearchOutput, SearchEmbeddable } from './types'; import { SEARCH_EMBEDDABLE_TYPE } from './constants'; interface StartServices { @@ -92,7 +91,8 @@ export class SearchEmbeddableFactory const savedObject = await getServices().getSavedSearchById(savedObjectId); const indexPattern = savedObject.searchSource.getField('index'); const { executeTriggerActions } = await this.getStartServices(); - return new SearchEmbeddable( + const { SearchEmbeddable: SearchEmbeddableClass } = await import('./search_embeddable'); + return new SearchEmbeddableClass( { savedSearch: savedObject, $rootScope, diff --git a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/types.ts b/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/types.ts index b20e9b2faf7c4..85413f2ba685f 100644 --- a/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/types.ts +++ b/src/legacy/core_plugins/kibana/public/discover/np_ready/embeddable/types.ts @@ -17,7 +17,12 @@ * under the License. */ -import { EmbeddableInput, EmbeddableOutput, IEmbeddable } from 'src/plugins/embeddable/public'; +import { + EmbeddableInput, + EmbeddableOutput, + IEmbeddable, + Embeddable, +} from 'src/plugins/embeddable/public'; import { SortOrder } from '../angular/doc_table/components/table_header/helpers'; import { Filter, IIndexPattern, TimeRange, Query } from '../../../../../../../plugins/data/public'; import { SavedSearch } from '../../../../../../../plugins/discover/public'; @@ -40,3 +45,7 @@ export interface SearchOutput extends EmbeddableOutput { export interface ISearchEmbeddable extends IEmbeddable { getSavedSearch(): SavedSearch; } + +export interface SearchEmbeddable extends Embeddable { + type: string; +} diff --git a/src/legacy/core_plugins/kibana/public/discover/plugin.ts b/src/legacy/core_plugins/kibana/public/discover/plugin.ts index 702331529b879..10cd1612b90a1 100644 --- a/src/legacy/core_plugins/kibana/public/discover/plugin.ts +++ b/src/legacy/core_plugins/kibana/public/discover/plugin.ts @@ -47,6 +47,7 @@ import { VisualizationsSetup, } from '../../../../../plugins/visualizations/public'; import { createKbnUrlTracker } from '../../../../../plugins/kibana_utils/public'; +import { SearchEmbeddableFactory } from './np_ready/embeddable'; export interface DiscoverSetupPlugins { uiActions: UiActionsSetup; @@ -202,8 +203,6 @@ export class DiscoverPlugin implements Plugin { core: CoreSetup, plugins: DiscoverSetupPlugins ) { - const { SearchEmbeddableFactory } = await import('./np_ready/embeddable'); - if (!this.getEmbeddableInjector) { throw Error('Discover plugin method getEmbeddableInjector is undefined'); }