diff --git a/.i18nrc.json b/.i18nrc.json index 818b0bf38afc2..4a43d0a87a036 100644 --- a/.i18nrc.json +++ b/.i18nrc.json @@ -13,7 +13,7 @@ "dashboardEmbeddableContainer": "src/legacy/core_plugins/dashboard_embeddable_container", "kbn": "src/legacy/core_plugins/kibana", "kbnDocViews": "src/legacy/core_plugins/kbn_doc_views", - "embeddableApi": "src/legacy/core_plugins/embeddable_api", + "embeddableApi": "src/plugins/embeddable", "kbnVislibVisTypes": "src/legacy/core_plugins/kbn_vislib_vis_types", "visTypeMarkdown": "src/legacy/core_plugins/vis_type_markdown", "visTypeMetric": "src/legacy/core_plugins/vis_type_metric", diff --git a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/actions/expand_panel_action.test.tsx b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/actions/expand_panel_action.test.tsx index 611b37dd7d54e..0fa34817bee86 100644 --- a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/actions/expand_panel_action.test.tsx +++ b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/actions/expand_panel_action.test.tsx @@ -24,12 +24,10 @@ import { getSampleDashboardInput, getSampleDashboardPanel } from '../test_helper import { CONTACT_CARD_EMBEDDABLE, ContactCardEmbeddableFactory, -} from '../../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory'; -import { ContactCardEmbeddable, ContactCardEmbeddableInput, ContactCardEmbeddableOutput, -} from '../../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable'; +} from '../../../../../../embeddable_api/public/np_ready/public/lib/test_samples'; import { DashboardOptions } from '../embeddable/dashboard_container_factory'; const embeddableFactories = new Map(); diff --git a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/dashboard_container.test.tsx b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/dashboard_container.test.tsx index 8529f8944cbab..06bc696b95193 100644 --- a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/dashboard_container.test.tsx +++ b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/dashboard_container.test.tsx @@ -26,12 +26,10 @@ import { getSampleDashboardInput, getSampleDashboardPanel } from '../test_helper import { CONTACT_CARD_EMBEDDABLE, ContactCardEmbeddableFactory, -} from '../../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory'; -import { ContactCardEmbeddableInput, ContactCardEmbeddable, ContactCardEmbeddableOutput, -} from '../../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable'; +} from '../../../../../../embeddable_api/public/np_ready/public/lib/test_samples'; const options: DashboardContainerOptions = { application: {} as any, diff --git a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/grid/dashboard_grid.test.tsx b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/grid/dashboard_grid.test.tsx index 641d55aea6c58..386aae9ddcf78 100644 --- a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/grid/dashboard_grid.test.tsx +++ b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/grid/dashboard_grid.test.tsx @@ -30,7 +30,7 @@ import { getSampleDashboardInput } from '../../test_helpers'; import { CONTACT_CARD_EMBEDDABLE, ContactCardEmbeddableFactory, -} from '../../../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory'; +} from '../../../../../../../embeddable_api/public/np_ready/public/lib/test_samples'; import { KibanaContextProvider } from '../../../../../../../../../plugins/kibana_react/public'; let dashboardContainer: DashboardContainer | undefined; diff --git a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/panel/create_panel_state.test.ts b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/panel/create_panel_state.test.ts index 45eb4056a4ffc..e66a25831577c 100644 --- a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/panel/create_panel_state.test.ts +++ b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/panel/create_panel_state.test.ts @@ -21,7 +21,8 @@ import { DEFAULT_PANEL_HEIGHT, DEFAULT_PANEL_WIDTH } from '../dashboard_constant import { DashboardPanelState } from '../types'; import { createPanelState } from './create_panel_state'; import { EmbeddableInput } from '../../embeddable_api'; -import { CONTACT_CARD_EMBEDDABLE } from '../../../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory'; +// eslint-disable-next-line @kbn/eslint/no-restricted-paths +import { CONTACT_CARD_EMBEDDABLE } from '../../../../../../../embeddable_api/public/np_ready/public/lib/test_samples'; interface TestInput extends EmbeddableInput { test: string; diff --git a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/viewport/dashboard_viewport.test.tsx b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/viewport/dashboard_viewport.test.tsx index 2a28e187fad64..01bde21f91d3b 100644 --- a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/viewport/dashboard_viewport.test.tsx +++ b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/embeddable/viewport/dashboard_viewport.test.tsx @@ -31,7 +31,7 @@ import { getSampleDashboardInput } from '../../test_helpers'; import { CONTACT_CARD_EMBEDDABLE, ContactCardEmbeddableFactory, -} from '../../../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory'; +} from '../../../../../../../embeddable_api/public/np_ready/public/lib/test_samples'; import { KibanaContextProvider } from '../../../../../../../../../plugins/kibana_react/public'; let dashboardContainer: DashboardContainer | undefined; diff --git a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/tests/dashboard_container.test.tsx b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/tests/dashboard_container.test.tsx index e9b84eca594ae..6cf409581b76d 100644 --- a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/tests/dashboard_container.test.tsx +++ b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/tests/dashboard_container.test.tsx @@ -32,14 +32,14 @@ import { getSampleDashboardInput } from '../lib/test_helpers'; import { CONTACT_CARD_EMBEDDABLE, ContactCardEmbeddableFactory, -} from '../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory'; +} from '../../../../../embeddable_api/public/np_ready/public/lib/test_samples'; import { ContactCardEmbeddableInput, ContactCardEmbeddable, ContactCardEmbeddableOutput, -} from '../../../../../embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable'; +} from '../../../../../embeddable_api/public/np_ready/public/lib/test_samples'; import { embeddablePluginMock } from '../../../../../embeddable_api/public/np_ready/public/mocks'; -import { createEditModeAction } from '../../../../../embeddable_api/public/np_ready/public/lib/test_samples/actions/edit_mode_action'; +import { createEditModeAction } from '../../../../../embeddable_api/public/np_ready/public/lib/test_samples'; // eslint-disable-next-line import { inspectorPluginMock } from '../../../../../../../plugins/inspector/public/mocks'; import { KibanaContextProvider } from '../../../../../../../plugins/kibana_react/public'; diff --git a/src/legacy/core_plugins/embeddable_api/README.md b/src/legacy/core_plugins/embeddable_api/README.md index 1fe91f426f43f..c2f67572df873 100644 --- a/src/legacy/core_plugins/embeddable_api/README.md +++ b/src/legacy/core_plugins/embeddable_api/README.md @@ -1,39 +1,2 @@ -# The Embeddable API V2 - -The Embeddable API's main goal is to have documented and standardized ways to share and exchange information and functionality across applications and plugins. - -There are three main pieces of this infrastructure: - - Embeddables & Containers - - Actions - - Triggers - -## Embeddables & Containers - -Embeddables are isolated, serializable, renderable widgets. A developer can hard code an embeddable inside their -application, or they can use some built in actions to allow users to dynamically add them to *containers*. - -Containers are a special type of embeddable that can contain nested embeddables. - -## Actions - -Actions are pluggable pieces of functionality exposed to the user that take an embeddable as context, plus an optional action context. - -## Triggers - -Triggers are the way actions are connected to a user action. We ship with two default triggers, `CONTEXT_MENU_TRIGGER` and `APPLY_FILTER`. - -Actions attached to the `CONTEXT_MENU_TRIGGER` will be displayed in supported embeddables context menu to the user. Actions attached to the `APPLY_FILTER` trigger will show up when any embeddable emits this trigger. - -A developer can register new triggers that their embeddables, or external components, can emit (as long as they have an embeddable to pass along as context). - -## Examples - -Many examples can be viewed in the functionally tested `kbn_tp_embeddable_explorer` plugin, as well as the jest tested classes inside the `embeddable_api/public/test_samples` folder. - -## Testing - -Run unit tests - -```shell -node scripts/jest embeddable_api -``` +- Embeddables have been moved to `/src/plugins/embeddable` NP plugin. +- This legacy plugin is still there to make necessary CSS working, but soon will be completely deleted. diff --git a/src/legacy/core_plugins/embeddable_api/public/index.scss b/src/legacy/core_plugins/embeddable_api/public/index.scss index a9995ab11ad9e..b4e170e6cb65c 100644 --- a/src/legacy/core_plugins/embeddable_api/public/index.scss +++ b/src/legacy/core_plugins/embeddable_api/public/index.scss @@ -1,5 +1,5 @@ @import 'src/legacy/ui/public/styles/styling_constants'; @import './variables'; -@import './np_ready/public/lib/panel/index'; -@import './np_ready/public/lib/panel/panel_header/index'; +@import '../../../../plugins/embeddable/public/lib/panel/index'; +@import '../../../../plugins/embeddable/public/lib/panel/panel_header/index'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/index.ts b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/index.ts index 33855b07df7a1..4b69616a777e9 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/index.ts +++ b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/index.ts @@ -17,49 +17,4 @@ * under the License. */ -import { PluginInitializerContext } from 'src/core/public'; -import { EmbeddablePublicPlugin } from './plugin'; - -export { - ADD_PANEL_ACTION_ID, - APPLY_FILTER_ACTION, - APPLY_FILTER_TRIGGER, - PANEL_BADGE_TRIGGER, - Adapters, - AddPanelAction, - CONTEXT_MENU_TRIGGER, - Container, - ContainerInput, - ContainerOutput, - EDIT_PANEL_ACTION_ID, - EditPanelAction, - Embeddable, - EmbeddableChildPanel, - EmbeddableChildPanelProps, - EmbeddableFactory, - EmbeddableFactoryNotFoundError, - EmbeddableInput, - EmbeddableInstanceConfiguration, - EmbeddableOutput, - EmbeddablePanel, - ErrorEmbeddable, - GetEmbeddableFactories, - GetEmbeddableFactory, - IContainer, - IEmbeddable, - OutputSpec, - PanelNotFoundError, - PanelState, - PropertySpec, - SavedObjectMetaData, - ViewMode, - isErrorEmbeddable, - openAddPanelFlyout, -} from './lib'; - -export function plugin(initializerContext: PluginInitializerContext) { - return new EmbeddablePublicPlugin(initializerContext); -} - -export { EmbeddablePublicPlugin as Plugin }; -export * from './plugin'; +export * from '../../../../../../plugins/embeddable/public'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/legacy.ts b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/legacy.ts index 00672edc20500..5357c2458e3b0 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/legacy.ts +++ b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/legacy.ts @@ -17,12 +17,8 @@ * under the License. */ -/* eslint-disable @kbn/eslint/no-restricted-paths */ +// eslint-disable-next-line import { npSetup, npStart } from 'ui/new_platform'; -/* eslint-enable @kbn/eslint/no-restricted-paths */ -import { plugin } from '.'; - -const pluginInstance = plugin({} as any); -export const setup = pluginInstance.setup(npSetup.core, { uiActions: npSetup.plugins.uiActions }); -export const start = pluginInstance.start(npStart.core); +export const setup = npSetup.plugins.embeddable; +export const start = npStart.plugins.embeddable; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/index.ts b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/index.ts index 0b1b24cf4c972..4f0537aff5dc2 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/index.ts +++ b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/index.ts @@ -17,5 +17,5 @@ * under the License. */ -export * from './actions'; -export * from './embeddables'; +// eslint-disable-next-line +export * from '../../../../../../../../plugins/embeddable/public/lib/test_samples'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/mocks.ts b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/mocks.ts index c24f310665ae1..10510bff0c97e 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/mocks.ts +++ b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/mocks.ts @@ -17,46 +17,5 @@ * under the License. */ -import { Plugin } from '.'; -import { coreMock } from '../../../../../../core/public/mocks'; - // eslint-disable-next-line -import { uiActionsPluginMock } from '../../../../../../plugins/ui_actions/public/mocks'; - -export type Setup = jest.Mocked>; -export type Start = jest.Mocked>; - -const createSetupContract = (): Setup => { - const setupContract: Setup = { - registerEmbeddableFactory: jest.fn(), - }; - return setupContract; -}; - -const createStartContract = (): Start => { - const startContract: Start = { - registerEmbeddableFactory: jest.fn(), - getEmbeddableFactories: jest.fn(), - getEmbeddableFactory: jest.fn(), - }; - return startContract; -}; - -const createInstance = () => { - const plugin = new Plugin({} as any); - const setup = plugin.setup(coreMock.createSetup(), { - uiActions: uiActionsPluginMock.createSetupContract(), - }); - const doStart = () => plugin.start(coreMock.createStart()); - return { - plugin, - setup, - doStart, - }; -}; - -export const embeddablePluginMock = { - createSetupContract, - createStartContract, - createInstance, -}; +export * from '../../../../../../plugins/embeddable/public/mocks'; diff --git a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_state.test.ts b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_state.test.ts index d7847c8338cd2..a25ce1e607f9a 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_state.test.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_state.test.ts @@ -24,7 +24,7 @@ import { getAppStateMock, getSavedDashboardMock } from './__tests__'; import { AppStateClass } from 'ui/state_management/app_state'; import { DashboardAppState } from './types'; import { TimeRange } from 'src/plugins/data/public'; -import { ViewMode } from '../../../embeddable_api/public/np_ready/public'; +import { ViewMode } from 'src/plugins/embeddable/public'; import { InputTimeRange } from 'ui/timefilter'; jest.mock('ui/registry/field_formats', () => ({ diff --git a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_state_manager.ts b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_state_manager.ts index 358c434b327e1..c1ce5b764f2f6 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_state_manager.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_state_manager.ts @@ -28,7 +28,7 @@ import { migrateLegacyQuery } from 'ui/utils/migrate_legacy_query'; import { Moment } from 'moment'; import { DashboardContainer } from 'src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public'; -import { ViewMode } from '../../../embeddable_api/public/np_ready/public'; +import { ViewMode } from '../../../../../../src/plugins/embeddable/public'; import { Query } from '../../../data/public'; import { getAppStateDefaults, migrateAppState } from './lib'; diff --git a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_strings.ts b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_strings.ts index 40393fb08cb10..b7f9293539abd 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_strings.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_strings.ts @@ -18,7 +18,7 @@ */ import { i18n } from '@kbn/i18n'; -import { ViewMode } from '../../../embeddable_api/public/np_ready/public'; +import { ViewMode } from '../../../../../../src/plugins/embeddable/public'; /** * @param title {string} the current title of the dashboard diff --git a/src/legacy/core_plugins/kibana/public/dashboard/lib/get_app_state_defaults.ts b/src/legacy/core_plugins/kibana/public/dashboard/lib/get_app_state_defaults.ts index 8fc26a3f53d06..eb4a4356fb27a 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/lib/get_app_state_defaults.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/lib/get_app_state_defaults.ts @@ -17,7 +17,7 @@ * under the License. */ -import { ViewMode } from '../../../../embeddable_api/public/np_ready/public'; +import { ViewMode } from '../../../../../../../src/plugins/embeddable/public'; import { SavedObjectDashboard } from '../saved_dashboard/saved_dashboard'; import { DashboardAppStateDefaults } from '../types'; diff --git a/src/legacy/core_plugins/kibana/public/dashboard/top_nav/get_top_nav_config.ts b/src/legacy/core_plugins/kibana/public/dashboard/top_nav/get_top_nav_config.ts index 05b7fcce07afa..0606cc4f7bdad 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/top_nav/get_top_nav_config.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/top_nav/get_top_nav_config.ts @@ -18,7 +18,7 @@ */ import { i18n } from '@kbn/i18n'; -import { ViewMode } from '../../../../embeddable_api/public/np_ready/public'; +import { ViewMode } from '../../../../../../plugins/embeddable/public'; import { TopNavIds } from './top_nav_ids'; import { NavAction } from '../types'; diff --git a/src/legacy/core_plugins/kibana/public/dashboard/types.ts b/src/legacy/core_plugins/kibana/public/dashboard/types.ts index ef7192bf30025..ccccc89004e36 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/types.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/types.ts @@ -21,7 +21,7 @@ import { AppState } from 'ui/state_management/app_state'; import { Filter } from '@kbn/es-query'; import { Query } from 'src/legacy/core_plugins/data/public'; import { AppState as TAppState } from 'ui/state_management/app_state'; -import { ViewMode } from 'src/legacy/core_plugins/embeddable_api/public/np_ready/public'; +import { ViewMode } from 'src/plugins/embeddable/public'; import { RawSavedDashboardPanelTo60, RawSavedDashboardPanel610, diff --git a/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable_factory.ts b/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable_factory.ts index ca106711e3c07..d7b51b39e2a16 100644 --- a/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable_factory.ts +++ b/src/legacy/core_plugins/kibana/public/discover/embeddable/search_embeddable_factory.ts @@ -19,7 +19,7 @@ import '../doc_table'; import { capabilities } from 'ui/capabilities'; -import { npStart } from 'ui/new_platform'; +import { npStart, npSetup } from 'ui/new_platform'; import { i18n } from '@kbn/i18n'; import chrome from 'ui/chrome'; import { IPrivate } from 'ui/private'; @@ -30,8 +30,7 @@ import { EmbeddableFactory, ErrorEmbeddable, Container, -} from '../../../../embeddable_api/public/np_ready/public'; -import { setup } from '../../../../embeddable_api/public/np_ready/public/legacy'; +} from '../../../../../../plugins/embeddable/public'; import { SavedSearchLoader } from '../types'; import { SearchEmbeddable, SEARCH_EMBEDDABLE_TYPE } from './search_embeddable'; import { SearchInput, SearchOutput } from './types'; @@ -112,4 +111,4 @@ export class SearchEmbeddableFactory extends EmbeddableFactory< } const factory = new SearchEmbeddableFactory(npStart.plugins.uiActions.executeTriggerActions); -setup.registerEmbeddableFactory(factory.type, factory); +npSetup.plugins.embeddable.registerEmbeddableFactory(factory.type, factory); diff --git a/src/legacy/core_plugins/kibana/public/discover/embeddable/types.ts b/src/legacy/core_plugins/kibana/public/discover/embeddable/types.ts index a0e15e99b742d..bc46cdbe82981 100644 --- a/src/legacy/core_plugins/kibana/public/discover/embeddable/types.ts +++ b/src/legacy/core_plugins/kibana/public/discover/embeddable/types.ts @@ -21,12 +21,8 @@ import { StaticIndexPattern } from 'ui/index_patterns'; import { TimeRange } from 'src/plugins/data/public'; import { Query } from 'src/legacy/core_plugins/data/public'; import { Filter } from '@kbn/es-query'; +import { EmbeddableInput, EmbeddableOutput, IEmbeddable } from 'src/plugins/embeddable/public'; import { SavedSearch } from '../types'; -import { - EmbeddableInput, - EmbeddableOutput, - IEmbeddable, -} from '../../../../embeddable_api/public/np_ready/public'; import { SortOrder } from '../doc_table/components/table_header/helpers'; export interface SearchInput extends EmbeddableInput { diff --git a/src/legacy/core_plugins/kibana/public/visualize/embeddable/disabled_lab_embeddable.tsx b/src/legacy/core_plugins/kibana/public/visualize/embeddable/disabled_lab_embeddable.tsx index 63c4661f4acf2..92bd0fa345fa0 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/embeddable/disabled_lab_embeddable.tsx +++ b/src/legacy/core_plugins/kibana/public/visualize/embeddable/disabled_lab_embeddable.tsx @@ -19,7 +19,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import { Embeddable, EmbeddableOutput } from '../../../../embeddable_api/public/np_ready/public'; +import { Embeddable, EmbeddableOutput } from '../../../../../../plugins/embeddable/public'; import { DisabledLabVisualization } from './disabled_lab_visualization'; import { VisualizeInput } from './visualize_embeddable'; import { VISUALIZE_EMBEDDABLE_TYPE } from './constants'; 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 147cbed6b1ea1..b9febc3af54ea 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 @@ -29,14 +29,14 @@ import { } from 'ui/visualize/loader/types'; import { Subscription } from 'rxjs'; import * as Rx from 'rxjs'; -import { TimeRange } from 'src/plugins/data/public'; import { Filter } from '@kbn/es-query'; +import { TimeRange } from '../../../../../../plugins/data/public'; import { EmbeddableInput, EmbeddableOutput, Embeddable, Container, -} from '../../../../embeddable_api/public/np_ready/public'; +} from '../../../../../../plugins/embeddable/public'; import { Query, onlyDisabledFiltersChanged } from '../../../../data/public'; import { VISUALIZE_EMBEDDABLE_TYPE } from './constants'; diff --git a/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable_factory.tsx b/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable_factory.tsx index d8ebef9a60413..21897cb6c0d15 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable_factory.tsx +++ b/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable_factory.tsx @@ -47,13 +47,13 @@ import { VisTypesRegistry, VisTypesRegistryProvider } from 'ui/registry/vis_type import { IPrivate } from 'ui/private'; import { SavedObjectAttributes } from 'kibana/server'; +import { npSetup } from 'ui/new_platform'; import { EmbeddableFactory, ErrorEmbeddable, Container, EmbeddableOutput, -} from '../../../../embeddable_api/public/np_ready/public'; -import { setup } from '../../../../embeddable_api/public/np_ready/public/legacy'; +} from '../../../../../../plugins/embeddable/public'; import { showNewVisModal } from '../wizard'; import { SavedVisualizations } from '../types'; import { DisabledLabEmbeddable } from './disabled_lab_embeddable'; @@ -184,5 +184,8 @@ export class VisualizeEmbeddableFactory extends EmbeddableFactory< } VisualizeEmbeddableFactory.createVisualizeEmbeddableFactory().then(embeddableFactory => { - setup.registerEmbeddableFactory(VISUALIZE_EMBEDDABLE_TYPE, embeddableFactory); + npSetup.plugins.embeddable.registerEmbeddableFactory( + VISUALIZE_EMBEDDABLE_TYPE, + embeddableFactory + ); }); diff --git a/src/legacy/ui/public/new_platform/__mocks__/helpers.ts b/src/legacy/ui/public/new_platform/__mocks__/helpers.ts index 2705d71b026f8..5c7f7be060374 100644 --- a/src/legacy/ui/public/new_platform/__mocks__/helpers.ts +++ b/src/legacy/ui/public/new_platform/__mocks__/helpers.ts @@ -20,6 +20,7 @@ /* eslint-disable @kbn/eslint/no-restricted-paths */ import { coreMock } from '../../../../../core/public/mocks'; import { dataPluginMock } from '../../../../../plugins/data/public/mocks'; +import { embeddablePluginMock } from '../../../../../plugins/embeddable/public/mocks'; import { expressionsPluginMock } from '../../../../../plugins/expressions/public/mocks'; import { inspectorPluginMock } from '../../../../../plugins/inspector/public/mocks'; import { uiActionsPluginMock } from '../../../../../plugins/ui_actions/public/mocks'; @@ -28,12 +29,14 @@ import { uiActionsPluginMock } from '../../../../../plugins/ui_actions/public/mo export const pluginsMock = { createSetup: () => ({ data: dataPluginMock.createSetupContract(), + embeddable: embeddablePluginMock.createSetupContract(), inspector: inspectorPluginMock.createSetupContract(), expressions: expressionsPluginMock.createSetupContract(), uiActions: uiActionsPluginMock.createSetupContract(), }), createStart: () => ({ data: dataPluginMock.createStartContract(), + embeddable: embeddablePluginMock.createStartContract(), inspector: inspectorPluginMock.createStartContract(), expressions: expressionsPluginMock.createStartContract(), uiActions: uiActionsPluginMock.createStartContract(), diff --git a/src/legacy/ui/public/new_platform/new_platform.karma_mock.js b/src/legacy/ui/public/new_platform/new_platform.karma_mock.js index b8a6a44f9624e..29868dc9767dc 100644 --- a/src/legacy/ui/public/new_platform/new_platform.karma_mock.js +++ b/src/legacy/ui/public/new_platform/new_platform.karma_mock.js @@ -24,6 +24,9 @@ export const npSetup = { chrome: {} }, plugins: { + embeddable: { + registerEmbeddableFactory: sinon.fake(), + }, expressions: { registerFunction: sinon.fake(), registerRenderer: sinon.fake(), @@ -52,6 +55,11 @@ export const npStart = { chrome: {} }, plugins: { + embeddable: { + getEmbeddableFactory: sinon.fake(), + getEmbeddableFactories: sinon.fake(), + registerEmbeddableFactory: sinon.fake(), + }, expressions: { registerFunction: sinon.fake(), registerRenderer: sinon.fake(), diff --git a/src/legacy/ui/public/new_platform/new_platform.ts b/src/legacy/ui/public/new_platform/new_platform.ts index 2b46b0e304ba3..ed13af591525c 100644 --- a/src/legacy/ui/public/new_platform/new_platform.ts +++ b/src/legacy/ui/public/new_platform/new_platform.ts @@ -17,6 +17,7 @@ * under the License. */ import { IUiActionsStart, IUiActionsSetup } from 'src/plugins/ui_actions/public'; +import { Start as EmbeddableStart, Setup as EmbeddableSetup } from 'src/plugins/embeddable/public'; import { LegacyCoreSetup, LegacyCoreStart } from '../../../../core/public'; import { Plugin as DataPlugin } from '../../../../plugins/data/public'; import { Plugin as ExpressionsPlugin } from '../../../../plugins/expressions/public'; @@ -28,6 +29,7 @@ import { EuiUtilsStart } from '../../../../plugins/eui_utils/public'; export interface PluginsSetup { data: ReturnType; + embeddable: EmbeddableSetup; expressions: ReturnType; inspector: InspectorSetup; uiActions: IUiActionsSetup; @@ -35,6 +37,7 @@ export interface PluginsSetup { export interface PluginsStart { data: ReturnType; + embeddable: EmbeddableStart; eui_utils: EuiUtilsStart; expressions: ReturnType; inspector: InspectorStart; diff --git a/src/plugins/embeddable/README.md b/src/plugins/embeddable/README.md new file mode 100644 index 0000000000000..1fe91f426f43f --- /dev/null +++ b/src/plugins/embeddable/README.md @@ -0,0 +1,39 @@ +# The Embeddable API V2 + +The Embeddable API's main goal is to have documented and standardized ways to share and exchange information and functionality across applications and plugins. + +There are three main pieces of this infrastructure: + - Embeddables & Containers + - Actions + - Triggers + +## Embeddables & Containers + +Embeddables are isolated, serializable, renderable widgets. A developer can hard code an embeddable inside their +application, or they can use some built in actions to allow users to dynamically add them to *containers*. + +Containers are a special type of embeddable that can contain nested embeddables. + +## Actions + +Actions are pluggable pieces of functionality exposed to the user that take an embeddable as context, plus an optional action context. + +## Triggers + +Triggers are the way actions are connected to a user action. We ship with two default triggers, `CONTEXT_MENU_TRIGGER` and `APPLY_FILTER`. + +Actions attached to the `CONTEXT_MENU_TRIGGER` will be displayed in supported embeddables context menu to the user. Actions attached to the `APPLY_FILTER` trigger will show up when any embeddable emits this trigger. + +A developer can register new triggers that their embeddables, or external components, can emit (as long as they have an embeddable to pass along as context). + +## Examples + +Many examples can be viewed in the functionally tested `kbn_tp_embeddable_explorer` plugin, as well as the jest tested classes inside the `embeddable_api/public/test_samples` folder. + +## Testing + +Run unit tests + +```shell +node scripts/jest embeddable_api +``` diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/kibana.json b/src/plugins/embeddable/kibana.json similarity index 76% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/kibana.json rename to src/plugins/embeddable/kibana.json index 54c1d1b640c98..535527b4d09db 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/kibana.json +++ b/src/plugins/embeddable/kibana.json @@ -4,7 +4,7 @@ "server": false, "ui": true, "requiredPlugins": [ - "embeddable", - "inspector" + "inspector", + "uiActions" ] } diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/api/get_embeddable_factories.ts b/src/plugins/embeddable/public/api/get_embeddable_factories.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/api/get_embeddable_factories.ts rename to src/plugins/embeddable/public/api/get_embeddable_factories.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/api/get_embeddable_factory.ts b/src/plugins/embeddable/public/api/get_embeddable_factory.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/api/get_embeddable_factory.ts rename to src/plugins/embeddable/public/api/get_embeddable_factory.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/api/index.ts b/src/plugins/embeddable/public/api/index.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/api/index.ts rename to src/plugins/embeddable/public/api/index.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/api/register_embeddable_factory.ts b/src/plugins/embeddable/public/api/register_embeddable_factory.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/api/register_embeddable_factory.ts rename to src/plugins/embeddable/public/api/register_embeddable_factory.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/api/tests/helpers.ts b/src/plugins/embeddable/public/api/tests/helpers.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/api/tests/helpers.ts rename to src/plugins/embeddable/public/api/tests/helpers.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/api/tests/registry.test.ts b/src/plugins/embeddable/public/api/tests/registry.test.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/api/tests/registry.test.ts rename to src/plugins/embeddable/public/api/tests/registry.test.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/api/types.ts b/src/plugins/embeddable/public/api/types.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/api/types.ts rename to src/plugins/embeddable/public/api/types.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/bootstrap.ts b/src/plugins/embeddable/public/bootstrap.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/bootstrap.ts rename to src/plugins/embeddable/public/bootstrap.ts diff --git a/src/plugins/embeddable/public/index.ts b/src/plugins/embeddable/public/index.ts new file mode 100644 index 0000000000000..33855b07df7a1 --- /dev/null +++ b/src/plugins/embeddable/public/index.ts @@ -0,0 +1,65 @@ +/* + * 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 { PluginInitializerContext } from 'src/core/public'; +import { EmbeddablePublicPlugin } from './plugin'; + +export { + ADD_PANEL_ACTION_ID, + APPLY_FILTER_ACTION, + APPLY_FILTER_TRIGGER, + PANEL_BADGE_TRIGGER, + Adapters, + AddPanelAction, + CONTEXT_MENU_TRIGGER, + Container, + ContainerInput, + ContainerOutput, + EDIT_PANEL_ACTION_ID, + EditPanelAction, + Embeddable, + EmbeddableChildPanel, + EmbeddableChildPanelProps, + EmbeddableFactory, + EmbeddableFactoryNotFoundError, + EmbeddableInput, + EmbeddableInstanceConfiguration, + EmbeddableOutput, + EmbeddablePanel, + ErrorEmbeddable, + GetEmbeddableFactories, + GetEmbeddableFactory, + IContainer, + IEmbeddable, + OutputSpec, + PanelNotFoundError, + PanelState, + PropertySpec, + SavedObjectMetaData, + ViewMode, + isErrorEmbeddable, + openAddPanelFlyout, +} from './lib'; + +export function plugin(initializerContext: PluginInitializerContext) { + return new EmbeddablePublicPlugin(initializerContext); +} + +export { EmbeddablePublicPlugin as Plugin }; +export * from './plugin'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/apply_filter_action.test.ts b/src/plugins/embeddable/public/lib/actions/apply_filter_action.test.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/apply_filter_action.test.ts rename to src/plugins/embeddable/public/lib/actions/apply_filter_action.test.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/apply_filter_action.ts b/src/plugins/embeddable/public/lib/actions/apply_filter_action.ts similarity index 94% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/apply_filter_action.ts rename to src/plugins/embeddable/public/lib/actions/apply_filter_action.ts index 8ca5b25703a4e..99cfb2ea13d07 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/apply_filter_action.ts +++ b/src/plugins/embeddable/public/lib/actions/apply_filter_action.ts @@ -19,11 +19,7 @@ import { i18n } from '@kbn/i18n'; import { Filter } from '@kbn/es-query'; -import { - IAction, - createAction, - IncompatibleActionError, -} from '../../../../../../../../plugins/ui_actions/public'; +import { IAction, createAction, IncompatibleActionError } from '../ui_actions'; import { IEmbeddable, EmbeddableInput } from '../embeddables'; export const APPLY_FILTER_ACTION = 'APPLY_FILTER_ACTION'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/edit_panel_action.test.tsx b/src/plugins/embeddable/public/lib/actions/edit_panel_action.test.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/edit_panel_action.test.tsx rename to src/plugins/embeddable/public/lib/actions/edit_panel_action.test.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/edit_panel_action.ts b/src/plugins/embeddable/public/lib/actions/edit_panel_action.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/edit_panel_action.ts rename to src/plugins/embeddable/public/lib/actions/edit_panel_action.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/index.ts b/src/plugins/embeddable/public/lib/actions/index.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/index.ts rename to src/plugins/embeddable/public/lib/actions/index.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/containers/container.ts b/src/plugins/embeddable/public/lib/containers/container.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/containers/container.ts rename to src/plugins/embeddable/public/lib/containers/container.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/containers/embeddable_child_panel.test.tsx b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx similarity index 97% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/containers/embeddable_child_panel.test.tsx rename to src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx index 4b0803a890781..3c9e6e31220b2 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/containers/embeddable_child_panel.test.tsx +++ b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx @@ -31,7 +31,7 @@ import { ContactCardEmbeddable, } from '../test_samples/embeddables/contact_card/contact_card_embeddable'; // eslint-disable-next-line -import { inspectorPluginMock } from '../../../../../../../../plugins/inspector/public/mocks'; +import { inspectorPluginMock } from 'src/plugins/inspector/public/mocks'; import { mount } from 'enzyme'; test('EmbeddableChildPanel renders an embeddable when it is done loading', async () => { diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/containers/embeddable_child_panel.tsx b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx similarity index 97% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/containers/embeddable_child_panel.tsx rename to src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx index f441d84cfce85..adc4f2eb7da0d 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/containers/embeddable_child_panel.tsx +++ b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx @@ -25,11 +25,11 @@ import { Subscription } from 'rxjs'; import { CoreStart } from 'src/core/public'; import { TGetActionsCompatibleWithTrigger } from 'src/plugins/ui_actions/public'; +import { Start as InspectorStartContract } from 'src/plugins/inspector/public'; import { ErrorEmbeddable, IEmbeddable } from '../embeddables'; import { EmbeddablePanel } from '../panel'; import { IContainer } from './i_container'; import { GetEmbeddableFactory, GetEmbeddableFactories } from '../types'; -import { Start as InspectorStartContract } from '../../../../../../../../plugins/inspector/public'; export interface EmbeddableChildPanelProps { embeddableId: string; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/containers/i_container.ts b/src/plugins/embeddable/public/lib/containers/i_container.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/containers/i_container.ts rename to src/plugins/embeddable/public/lib/containers/i_container.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/containers/index.ts b/src/plugins/embeddable/public/lib/containers/index.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/containers/index.ts rename to src/plugins/embeddable/public/lib/containers/index.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/embeddables/embeddable.test.tsx b/src/plugins/embeddable/public/lib/embeddables/embeddable.test.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/embeddables/embeddable.test.tsx rename to src/plugins/embeddable/public/lib/embeddables/embeddable.test.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/embeddables/embeddable.tsx b/src/plugins/embeddable/public/lib/embeddables/embeddable.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/embeddables/embeddable.tsx rename to src/plugins/embeddable/public/lib/embeddables/embeddable.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/embeddables/embeddable_factory.ts b/src/plugins/embeddable/public/lib/embeddables/embeddable_factory.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/embeddables/embeddable_factory.ts rename to src/plugins/embeddable/public/lib/embeddables/embeddable_factory.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/embeddables/error_embeddable.tsx b/src/plugins/embeddable/public/lib/embeddables/error_embeddable.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/embeddables/error_embeddable.tsx rename to src/plugins/embeddable/public/lib/embeddables/error_embeddable.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/embeddables/i_embeddable.ts b/src/plugins/embeddable/public/lib/embeddables/i_embeddable.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/embeddables/i_embeddable.ts rename to src/plugins/embeddable/public/lib/embeddables/i_embeddable.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/embeddables/index.ts b/src/plugins/embeddable/public/lib/embeddables/index.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/embeddables/index.ts rename to src/plugins/embeddable/public/lib/embeddables/index.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/errors.test.ts b/src/plugins/embeddable/public/lib/errors.test.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/errors.test.ts rename to src/plugins/embeddable/public/lib/errors.test.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/errors.ts b/src/plugins/embeddable/public/lib/errors.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/errors.ts rename to src/plugins/embeddable/public/lib/errors.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/index.ts b/src/plugins/embeddable/public/lib/index.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/index.ts rename to src/plugins/embeddable/public/lib/index.ts diff --git a/src/plugins/embeddable/public/lib/inspector.ts b/src/plugins/embeddable/public/lib/inspector.ts new file mode 100644 index 0000000000000..9ac75a51b2cae --- /dev/null +++ b/src/plugins/embeddable/public/lib/inspector.ts @@ -0,0 +1,20 @@ +/* + * 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. + */ + +export * from '../../../inspector/public'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/_embeddable_panel.scss b/src/plugins/embeddable/public/lib/panel/_embeddable_panel.scss similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/_embeddable_panel.scss rename to src/plugins/embeddable/public/lib/panel/_embeddable_panel.scss diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/_index.scss b/src/plugins/embeddable/public/lib/panel/_index.scss similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/_index.scss rename to src/plugins/embeddable/public/lib/panel/_index.scss diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/embeddable_panel.test.tsx b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx similarity index 99% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/embeddable_panel.test.tsx rename to src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx index ed3e4b2ccff30..a00fd53d5c24b 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/embeddable_panel.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx @@ -41,7 +41,7 @@ import { ContactCardEmbeddableOutput, } from '../test_samples/embeddables/contact_card/contact_card_embeddable'; // eslint-disable-next-line -import { inspectorPluginMock } from '../../../../../../../../plugins/inspector/public/mocks'; +import { inspectorPluginMock } from 'src/plugins/inspector/public/mocks'; const actionRegistry = new Map(); const triggerRegistry = new Map(); diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/embeddable_panel.tsx b/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx similarity index 97% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/embeddable_panel.tsx rename to src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx index 708d3e9695b07..3f3729645b7e2 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/embeddable_panel.tsx +++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx @@ -24,9 +24,10 @@ import { buildContextMenuForActions, TGetActionsCompatibleWithTrigger, IAction, -} from '../../../../../../../../plugins/ui_actions/public'; -import { CoreStart } from '../../../../../../../../core/public'; +} from '../ui_actions'; +import { CoreStart } from '../../../../../core/public'; +import { Start as InspectorStartContract } from '../inspector'; import { CONTEXT_MENU_TRIGGER, PANEL_BADGE_TRIGGER } from '../triggers'; import { IEmbeddable } from '../embeddables/i_embeddable'; import { ViewMode, GetEmbeddableFactory, GetEmbeddableFactories } from '../types'; @@ -38,7 +39,6 @@ import { PanelHeader } from './panel_header/panel_header'; import { InspectPanelAction } from './panel_header/panel_actions/inspect_panel_action'; import { EditPanelAction } from '../actions'; import { CustomizePanelModal } from './panel_header/panel_actions/customize_title/customize_panel_modal'; -import { Start as InspectorStartContract } from '../../../../../../../../plugins/inspector/public'; interface Props { embeddable: IEmbeddable; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/index.ts b/src/plugins/embeddable/public/lib/panel/index.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/index.ts rename to src/plugins/embeddable/public/lib/panel/index.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/_index.scss b/src/plugins/embeddable/public/lib/panel/panel_header/_index.scss similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/_index.scss rename to src/plugins/embeddable/public/lib/panel/panel_header/_index.scss diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/_panel_options_menu_form.scss b/src/plugins/embeddable/public/lib/panel/panel_header/_panel_options_menu_form.scss similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/_panel_options_menu_form.scss rename to src/plugins/embeddable/public/lib/panel/panel_header/_panel_options_menu_form.scss diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/index.ts b/src/plugins/embeddable/public/lib/panel/panel_header/index.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/index.ts rename to src/plugins/embeddable/public/lib/panel/panel_header/index.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.test.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.test.tsx similarity index 97% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.test.tsx rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.test.tsx index 9799155f42d28..802be5bf1282e 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.test.tsx @@ -29,7 +29,8 @@ import { import { FilterableEmbeddableFactory } from '../../../../test_samples/embeddables/filterable_embeddable_factory'; import { FilterableContainer } from '../../../../test_samples/embeddables/filterable_container'; import { GetEmbeddableFactory } from '../../../../types'; -import { coreMock } from '../../../../../../../../../../../core/public/mocks'; +// eslint-disable-next-line +import { coreMock } from '../../../../../../../../core/public/mocks'; import { ContactCardEmbeddable } from '../../../../test_samples'; const embeddableFactories = new Map(); diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.ts b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.ts similarity index 93% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.ts rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.ts index e6db1a05ca238..3ca3a0864d9f1 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.ts +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.ts @@ -18,10 +18,10 @@ */ import { i18n } from '@kbn/i18n'; import { IAction } from 'src/plugins/ui_actions/public'; +import { NotificationsStart } from 'src/core/public'; +import { KibanaReactOverlays } from 'src/plugins/kibana_react/public'; import { ViewMode, GetEmbeddableFactory, GetEmbeddableFactories } from '../../../../types'; import { openAddPanelFlyout } from './open_add_panel_flyout'; -import { NotificationsStart } from '../../../../../../../../../../../core/public'; -import { KibanaReactOverlays } from '../../../../../../../../../../../plugins/kibana_react/public'; import { IContainer } from '../../../../containers'; export const ADD_PANEL_ACTION_ID = 'ADD_PANEL_ACTION_ID'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx similarity index 98% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx index cfc26418fbdb6..dd55cd1eacdc2 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.test.tsx @@ -33,7 +33,7 @@ import { mount } from 'enzyme'; import { findTestSubject } from '@elastic/eui/lib/test'; // eslint-disable-next-line -import { coreMock } from '../../../../../../../../../../../core/public/mocks'; +import { coreMock } from '../../../../../../../../core/public/mocks'; test('createNewEmbeddable() add embeddable to container', async () => { const core = coreMock.createStart(); diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.tsx rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_flyout.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/index.ts b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/index.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/index.ts rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/index.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/open_add_panel_flyout.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/open_add_panel_flyout.tsx similarity index 90% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/open_add_panel_flyout.tsx rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/open_add_panel_flyout.tsx index f439e34f6b283..bfa4f6e31d84e 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/open_add_panel_flyout.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/open_add_panel_flyout.tsx @@ -17,11 +17,11 @@ * under the License. */ import React from 'react'; +import { NotificationsStart } from 'src/core/public'; +import { KibanaReactOverlays } from 'src/plugins/kibana_react/public'; import { IContainer } from '../../../../containers'; import { AddPanelFlyout } from './add_panel_flyout'; import { GetEmbeddableFactory, GetEmbeddableFactories } from '../../../../types'; -import { NotificationsStart } from '../../../../../../../../../../../core/public'; -import { KibanaReactOverlays } from '../../../../../../../../../../../plugins/kibana_react/public'; export async function openAddPanelFlyout(options: { embeddable: IContainer; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.test.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.ts b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.ts rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_modal.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_modal.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_modal.tsx rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_modal.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/customize_title/customize_title_form.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_title_form.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/customize_title/customize_title_form.tsx rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/customize_title/customize_title_form.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/index.ts b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/index.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/index.ts rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/index.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/inspect_panel_action.test.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/inspect_panel_action.test.tsx similarity index 98% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/inspect_panel_action.test.tsx rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/inspect_panel_action.test.tsx index 362b7e5fe5443..550f9706a634b 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/inspect_panel_action.test.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/inspect_panel_action.test.tsx @@ -27,7 +27,7 @@ import { ContactCardEmbeddable, } from '../../../test_samples'; // eslint-disable-next-line -import { inspectorPluginMock } from '../../../../../../../../../../plugins/inspector/public/mocks'; +import { inspectorPluginMock } from 'src/plugins/inspector/public/mocks'; import { FilterStateStore } from '@kbn/es-query'; import { EmbeddableFactory, diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/inspect_panel_action.ts b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/inspect_panel_action.ts similarity index 92% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/inspect_panel_action.ts rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/inspect_panel_action.ts index f951ad01cbf78..8e4a43a01fc17 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/inspect_panel_action.ts +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/inspect_panel_action.ts @@ -18,8 +18,8 @@ */ import { i18n } from '@kbn/i18n'; -import { IAction } from '../../../../../../../../../../plugins/ui_actions/public'; -import { Start as InspectorStartContract } from '../../../../../../../../../../plugins/inspector/public'; +import { IAction } from 'src/plugins/ui_actions/public'; +import { Start as InspectorStartContract } from 'src/plugins/inspector/public'; import { IEmbeddable } from '../../../embeddables'; export const INSPECT_PANEL_ACTION_ID = 'openInspector'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/remove_panel_action.test.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/remove_panel_action.test.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/remove_panel_action.test.tsx rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/remove_panel_action.test.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/remove_panel_action.ts b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/remove_panel_action.ts similarity index 95% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/remove_panel_action.ts rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/remove_panel_action.ts index 36322e684d58c..498cd8d7136c6 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/remove_panel_action.ts +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/remove_panel_action.ts @@ -17,10 +17,7 @@ * under the License. */ import { i18n } from '@kbn/i18n'; -import { - IAction, - IncompatibleActionError, -} from '../../../../../../../../../../plugins/ui_actions/public'; +import { IAction, IncompatibleActionError } from '../../../ui_actions'; import { ContainerInput, IContainer } from '../../../containers'; import { ViewMode } from '../../../types'; import { IEmbeddable } from '../../../embeddables'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_header.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx similarity index 88% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_header.tsx rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx index 8f4a9b1097044..fcdffdaa4e1eb 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_header.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx @@ -23,8 +23,6 @@ import React from 'react'; import { IAction } from 'src/plugins/ui_actions/public'; import { PanelOptionsMenu } from './panel_options_menu'; import { IEmbeddable } from '../../embeddables'; -import { VisualizeEmbeddable } from '../../../../../../../kibana/public/visualize/embeddable/visualize_embeddable'; -import { VISUALIZE_EMBEDDABLE_TYPE } from '../../../../../../../kibana/public/visualize/embeddable/constants'; export interface PanelHeaderProps { title?: string; @@ -49,10 +47,8 @@ function renderBadges(badges: IAction[], embeddable: IEmbeddable) { )); } -function isVisualizeEmbeddable( - embeddable: IEmbeddable | VisualizeEmbeddable -): embeddable is VisualizeEmbeddable { - return embeddable.type === VISUALIZE_EMBEDDABLE_TYPE; +function isVisualizeEmbeddable(embeddable: IEmbeddable | any): embeddable is any { + return embeddable.type === 'VISUALIZE_EMBEDDABLE_TYPE'; } export function PanelHeader({ @@ -85,7 +81,7 @@ export function PanelHeader({ let viewDescr = ''; if (isVisualizeEmbeddable(embeddable)) { - const vd = (embeddable as VisualizeEmbeddable).getVisualizationDescription(); + const vd = (embeddable as any).getVisualizationDescription(); if (vd) { viewDescr = vd; } diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_options_menu.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_options_menu.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_options_menu.tsx rename to src/plugins/embeddable/public/lib/panel/panel_header/panel_options_menu.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/actions/edit_mode_action.ts b/src/plugins/embeddable/public/lib/test_samples/actions/edit_mode_action.ts similarity index 93% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/actions/edit_mode_action.ts rename to src/plugins/embeddable/public/lib/test_samples/actions/edit_mode_action.ts index ab8cd71940a5e..feecc8e262ee9 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/actions/edit_mode_action.ts +++ b/src/plugins/embeddable/public/lib/test_samples/actions/edit_mode_action.ts @@ -17,7 +17,7 @@ * under the License. */ -import { createAction } from '../../../../../../../../../plugins/ui_actions/public'; +import { createAction } from '../../ui_actions'; import { ViewMode } from '../../types'; import { IEmbeddable } from '../../embeddables'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/actions/get_message_modal.tsx b/src/plugins/embeddable/public/lib/test_samples/actions/get_message_modal.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/actions/get_message_modal.tsx rename to src/plugins/embeddable/public/lib/test_samples/actions/get_message_modal.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/actions/index.ts b/src/plugins/embeddable/public/lib/test_samples/actions/index.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/actions/index.ts rename to src/plugins/embeddable/public/lib/test_samples/actions/index.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/actions/say_hello_action.tsx b/src/plugins/embeddable/public/lib/test_samples/actions/say_hello_action.tsx similarity index 96% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/actions/say_hello_action.tsx rename to src/plugins/embeddable/public/lib/test_samples/actions/say_hello_action.tsx index 69626dc31bab7..5b61a3a71a641 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/actions/say_hello_action.tsx +++ b/src/plugins/embeddable/public/lib/test_samples/actions/say_hello_action.tsx @@ -17,10 +17,7 @@ * under the License. */ -import { - IAction, - IncompatibleActionError, -} from '../../../../../../../../../plugins/ui_actions/public'; +import { IAction, IncompatibleActionError } from '../../ui_actions'; import { EmbeddableInput, Embeddable, EmbeddableOutput, IEmbeddable } from '../../embeddables'; export const SAY_HELLO_ACTION = 'SAY_HELLO_ACTION'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/actions/send_message_action.tsx b/src/plugins/embeddable/public/lib/test_samples/actions/send_message_action.tsx similarity index 92% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/actions/send_message_action.tsx rename to src/plugins/embeddable/public/lib/test_samples/actions/send_message_action.tsx index 23f4029b9fcde..fc20a99987484 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/actions/send_message_action.tsx +++ b/src/plugins/embeddable/public/lib/test_samples/actions/send_message_action.tsx @@ -18,14 +18,11 @@ */ import React from 'react'; import { EuiFlyoutBody } from '@elastic/eui'; -import { - createAction, - IncompatibleActionError, -} from '../../../../../../../../../plugins/ui_actions/public'; +import { createAction, IncompatibleActionError } from '../../ui_actions'; +import { CoreStart } from '../../../../../../core/public'; import { Embeddable, EmbeddableInput } from '../../embeddables'; import { GetMessageModal } from './get_message_modal'; import { FullNameEmbeddableOutput, hasFullNameOutput } from './say_hello_action'; -import { CoreStart } from '../../../../../../../../../core/public'; export const SEND_MESSAGE_ACTION = 'SEND_MESSAGE_ACTION'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card.tsx rename to src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable.tsx rename to src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx similarity index 97% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx rename to src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx index a4e3218560bdc..962cddfa3735f 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx +++ b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory.tsx @@ -21,12 +21,12 @@ import React from 'react'; import { i18n } from '@kbn/i18n'; import { TExecuteTriggerActions } from 'src/plugins/ui_actions/public'; +import { CoreStart } from 'src/core/public'; import { EmbeddableFactory } from '../../../embeddables'; import { Container } from '../../../containers'; import { ContactCardEmbeddable, ContactCardEmbeddableInput } from './contact_card_embeddable'; import { ContactCardInitializer } from './contact_card_initializer'; import { EmbeddableFactoryOptions } from '../../../embeddables/embeddable_factory'; -import { CoreStart } from '../../../../../../../../../../core/public'; export const CONTACT_CARD_EMBEDDABLE = 'CONTACT_CARD_EMBEDDABLE'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_initializer.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_initializer.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_initializer.tsx rename to src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/contact_card_initializer.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/index.ts b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/index.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/index.ts rename to src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/index.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/slow_contact_card_embeddable_factory.ts b/src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/slow_contact_card_embeddable_factory.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/slow_contact_card_embeddable_factory.ts rename to src/plugins/embeddable/public/lib/test_samples/embeddables/contact_card/slow_contact_card_embeddable_factory.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/empty_embeddable.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/empty_embeddable.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/empty_embeddable.tsx rename to src/plugins/embeddable/public/lib/test_samples/embeddables/empty_embeddable.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/filterable_container.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/filterable_container.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/filterable_container.tsx rename to src/plugins/embeddable/public/lib/test_samples/embeddables/filterable_container.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/filterable_container_factory.ts b/src/plugins/embeddable/public/lib/test_samples/embeddables/filterable_container_factory.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/filterable_container_factory.ts rename to src/plugins/embeddable/public/lib/test_samples/embeddables/filterable_container_factory.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/filterable_embeddable.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/filterable_embeddable.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/filterable_embeddable.tsx rename to src/plugins/embeddable/public/lib/test_samples/embeddables/filterable_embeddable.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/filterable_embeddable_factory.ts b/src/plugins/embeddable/public/lib/test_samples/embeddables/filterable_embeddable_factory.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/filterable_embeddable_factory.ts rename to src/plugins/embeddable/public/lib/test_samples/embeddables/filterable_embeddable_factory.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable.tsx similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable.tsx rename to src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable.tsx diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable_factory.ts b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable_factory.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable_factory.ts rename to src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable_factory.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world/index.ts b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world/index.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world/index.ts rename to src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world/index.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world_container.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx similarity index 96% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world_container.tsx rename to src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx index 2a7406f49ad7e..8209f5bca2411 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world_container.tsx +++ b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx @@ -21,10 +21,10 @@ import ReactDOM from 'react-dom'; import { I18nProvider } from '@kbn/i18n/react'; import { CoreStart } from 'src/core/public'; import { TGetActionsCompatibleWithTrigger } from 'src/plugins/ui_actions/public'; +import { Start as InspectorStartContract } from 'src/plugins/inspector/public'; import { Container, ViewMode, ContainerInput } from '../..'; import { HelloWorldContainerComponent } from './hello_world_container_component'; import { GetEmbeddableFactory, GetEmbeddableFactories } from '../../types'; -import { Start as InspectorStartContract } from '../../../../../../../../../plugins/inspector/public'; export const HELLO_WORLD_CONTAINER = 'HELLO_WORLD_CONTAINER'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world_container_component.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container_component.tsx similarity index 97% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world_container_component.tsx rename to src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container_component.tsx index 9f09d7058744f..7c0e09eff1d50 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world_container_component.tsx +++ b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container_component.tsx @@ -22,9 +22,9 @@ import { Subscription } from 'rxjs'; import { EuiFlexGroup, EuiFlexItem, EuiSpacer } from '@elastic/eui'; import { CoreStart } from 'src/core/public'; import { TGetActionsCompatibleWithTrigger } from 'src/plugins/ui_actions/public'; +import { Start as InspectorStartContract } from 'src/plugins/inspector/public'; import { IContainer, PanelState, EmbeddableChildPanel } from '../..'; import { GetEmbeddableFactory, GetEmbeddableFactories } from '../../types'; -import { Start as InspectorStartContract } from '../../../../../../../../../plugins/inspector/public'; interface Props { container: IContainer; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/index.ts b/src/plugins/embeddable/public/lib/test_samples/embeddables/index.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/index.ts rename to src/plugins/embeddable/public/lib/test_samples/embeddables/index.ts diff --git a/src/plugins/embeddable/public/lib/test_samples/index.ts b/src/plugins/embeddable/public/lib/test_samples/index.ts new file mode 100644 index 0000000000000..0b1b24cf4c972 --- /dev/null +++ b/src/plugins/embeddable/public/lib/test_samples/index.ts @@ -0,0 +1,21 @@ +/* + * 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. + */ + +export * from './actions'; +export * from './embeddables'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/triggers/index.ts b/src/plugins/embeddable/public/lib/triggers/index.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/triggers/index.ts rename to src/plugins/embeddable/public/lib/triggers/index.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/types.ts b/src/plugins/embeddable/public/lib/types.ts similarity index 95% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/types.ts rename to src/plugins/embeddable/public/lib/types.ts index 5088bddaa78d7..e098d8f384820 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/types.ts +++ b/src/plugins/embeddable/public/lib/types.ts @@ -17,8 +17,8 @@ * under the License. */ +import { Adapters } from './inspector'; import { EmbeddableFactory } from './embeddables/embeddable_factory'; -import { Adapters } from '../../../../../../../plugins/inspector/public'; export interface Trigger { id: string; diff --git a/src/plugins/embeddable/public/lib/ui_actions.ts b/src/plugins/embeddable/public/lib/ui_actions.ts new file mode 100644 index 0000000000000..130a7a78e9d46 --- /dev/null +++ b/src/plugins/embeddable/public/lib/ui_actions.ts @@ -0,0 +1,20 @@ +/* + * 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. + */ + +export * from '../../../ui_actions/public'; diff --git a/src/plugins/embeddable/public/mocks.ts b/src/plugins/embeddable/public/mocks.ts new file mode 100644 index 0000000000000..ef1517bb7f1d5 --- /dev/null +++ b/src/plugins/embeddable/public/mocks.ts @@ -0,0 +1,62 @@ +/* + * 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 { Plugin } from '.'; +import { coreMock } from '../../../core/public/mocks'; + +// eslint-disable-next-line +import { uiActionsPluginMock } from '../../ui_actions/public/mocks'; + +export type Setup = jest.Mocked>; +export type Start = jest.Mocked>; + +const createSetupContract = (): Setup => { + const setupContract: Setup = { + registerEmbeddableFactory: jest.fn(), + }; + return setupContract; +}; + +const createStartContract = (): Start => { + const startContract: Start = { + registerEmbeddableFactory: jest.fn(), + getEmbeddableFactories: jest.fn(), + getEmbeddableFactory: jest.fn(), + }; + return startContract; +}; + +const createInstance = () => { + const plugin = new Plugin({} as any); + const setup = plugin.setup(coreMock.createSetup(), { + uiActions: uiActionsPluginMock.createSetupContract(), + }); + const doStart = () => plugin.start(coreMock.createStart()); + return { + plugin, + setup, + doStart, + }; +}; + +export const embeddablePluginMock = { + createSetupContract, + createStartContract, + createInstance, +}; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/plugin.ts b/src/plugins/embeddable/public/plugin.ts similarity index 94% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/plugin.ts rename to src/plugins/embeddable/public/plugin.ts index 0e4a34da40c75..458c8bfeb8762 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/plugin.ts +++ b/src/plugins/embeddable/public/plugin.ts @@ -18,12 +18,7 @@ */ import { IUiActionsSetup } from 'src/plugins/ui_actions/public'; -import { - PluginInitializerContext, - CoreSetup, - CoreStart, - Plugin, -} from '../../../../../../core/public'; +import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from '../../../core/public'; import { EmbeddableFactoryRegistry } from './types'; import { createApi, EmbeddableApi } from './api'; import { bootstrap } from './bootstrap'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/apply_filter_action.test.ts b/src/plugins/embeddable/public/tests/apply_filter_action.test.ts similarity index 98% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/apply_filter_action.test.ts rename to src/plugins/embeddable/public/tests/apply_filter_action.test.ts index 3273b335b5074..52500acc3dc59 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/apply_filter_action.test.ts +++ b/src/plugins/embeddable/public/tests/apply_filter_action.test.ts @@ -31,7 +31,7 @@ import { FilterableEmbeddableInput, } from '../lib/test_samples'; // eslint-disable-next-line -import { inspectorPluginMock } from '../../../../../../../plugins/inspector/public/mocks'; +import { inspectorPluginMock } from 'src/plugins/inspector/public/mocks'; import { FilterStateStore } from '@kbn/es-query'; test('ApplyFilterAction applies the filter to the root of the container tree', async () => { diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/container.test.ts b/src/plugins/embeddable/public/tests/container.test.ts similarity index 99% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/container.test.ts rename to src/plugins/embeddable/public/tests/container.test.ts index 8cfd627e34f87..c2044057786ae 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/container.test.ts +++ b/src/plugins/embeddable/public/tests/container.test.ts @@ -43,7 +43,8 @@ import { FilterableContainer, FilterableContainerInput, } from '../lib/test_samples/embeddables/filterable_container'; -import { coreMock } from '../../../../../../../core/public/mocks'; +// eslint-disable-next-line +import { coreMock } from '../../../../core/public/mocks'; import { testPlugin } from './test_plugin'; import { of } from './helpers'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/customize_panel_modal.test.tsx b/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx similarity index 98% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/customize_panel_modal.test.tsx rename to src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx index c3375d9de13bc..b11bd167e15f2 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/customize_panel_modal.test.tsx +++ b/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx @@ -31,7 +31,8 @@ import { ContactCardEmbeddableFactory, } from '../lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory'; import { HelloWorldContainer } from '../lib/test_samples/embeddables/hello_world_container'; -import { coreMock } from '../../../../../../../core/public/mocks'; +// eslint-disable-next-line +import { coreMock } from '../../../../core/public/mocks'; import { testPlugin } from './test_plugin'; import { EmbeddableApi } from '../api'; import { CustomizePanelModal } from '../lib/panel/panel_header/panel_actions/customize_title/customize_panel_modal'; diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/explicit_input.test.ts b/src/plugins/embeddable/public/tests/explicit_input.test.ts similarity index 98% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/explicit_input.test.ts rename to src/plugins/embeddable/public/tests/explicit_input.test.ts index 08009c165cbce..6cde7bdc48ba1 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/explicit_input.test.ts +++ b/src/plugins/embeddable/public/tests/explicit_input.test.ts @@ -33,7 +33,7 @@ import { FilterableContainer } from '../lib/test_samples/embeddables/filterable_ import { isErrorEmbeddable } from '../lib'; import { HelloWorldContainer } from '../lib/test_samples/embeddables/hello_world_container'; // eslint-disable-next-line -import { coreMock } from '../../../../../../../core/public/mocks'; +import { coreMock } from '../../../../core/public/mocks'; const { setup, doStart, coreStart, uiActions } = testPlugin( coreMock.createSetup(), diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/get_embeddable_factories.test.ts b/src/plugins/embeddable/public/tests/get_embeddable_factories.test.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/get_embeddable_factories.test.ts rename to src/plugins/embeddable/public/tests/get_embeddable_factories.test.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/helpers.ts b/src/plugins/embeddable/public/tests/helpers.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/helpers.ts rename to src/plugins/embeddable/public/tests/helpers.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/test_plugin.ts b/src/plugins/embeddable/public/tests/test_plugin.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/tests/test_plugin.ts rename to src/plugins/embeddable/public/tests/test_plugin.ts diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/types.ts b/src/plugins/embeddable/public/types.ts similarity index 100% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/types.ts rename to src/plugins/embeddable/public/types.ts diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx index 528b98c70a6da..ba9a874bcc5d3 100644 --- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx +++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_container_example.tsx @@ -18,12 +18,6 @@ */ import React from 'react'; import { EuiButton, EuiLoadingChart } from '@elastic/eui'; -import { - DASHBOARD_CONTAINER_TYPE, - DashboardContainer, - DashboardContainerFactory, -} from '../../../../../../../../src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public'; - import { ErrorEmbeddable, ViewMode, @@ -31,7 +25,12 @@ import { EmbeddablePanel, GetEmbeddableFactory, GetEmbeddableFactories, -} from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; +} from '../embeddable_api'; +import { + DASHBOARD_CONTAINER_TYPE, + DashboardContainer, + DashboardContainerFactory, +} from '../../../../../../../../src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public'; import { CoreStart } from '../../../../../../../../src/core/public'; import { dashboardInput } from './dashboard_input'; diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_input.ts b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_input.ts index f684974b28b49..011b322612d90 100644 --- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_input.ts +++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/dashboard_input.ts @@ -17,10 +17,8 @@ * under the License. */ +import { ViewMode, CONTACT_CARD_EMBEDDABLE, HELLO_WORLD_EMBEDDABLE_TYPE } from '../embeddable_api'; import { DashboardContainerInput } from '../../../../../../../../src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public'; -import { CONTACT_CARD_EMBEDDABLE } from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory'; -import { HELLO_WORLD_EMBEDDABLE_TYPE } from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable'; -import { ViewMode } from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; export const dashboardInput: DashboardContainerInput = { panels: { diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/hello_world_container_example.tsx b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/hello_world_container_example.tsx index eb72879eb8f8e..efd700552ec32 100644 --- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/hello_world_container_example.tsx +++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/hello_world_container_example.tsx @@ -20,16 +20,18 @@ import React from 'react'; import { Subscription } from 'rxjs'; import { EuiFieldText, EuiFormRow } from '@elastic/eui'; -import { TGetActionsCompatibleWithTrigger } from '../../../../../../../../src/plugins/ui_actions/public'; -import { CoreStart } from '../../../../../../../../src/core/public'; import { EmbeddablePanel, GetEmbeddableFactory, GetEmbeddableFactories, -} from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; -import { HelloWorldContainer } from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world_container'; -import { CONTACT_CARD_EMBEDDABLE } from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/contact_card/contact_card_embeddable_factory'; -import { HELLO_WORLD_EMBEDDABLE_TYPE } from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable'; +} from '../../../../../../../../src/plugins/embeddable/public'; +import { + HelloWorldContainer, + CONTACT_CARD_EMBEDDABLE, + HELLO_WORLD_EMBEDDABLE_TYPE, +} from '../../../../../../../../src/plugins/embeddable/public/lib/test_samples'; +import { TGetActionsCompatibleWithTrigger } from '../../../../../../../../src/plugins/ui_actions/public'; +import { CoreStart } from '../../../../../../../../src/core/public'; import { Start as InspectorStartContract } from '../../../../../../../../src/plugins/inspector/public'; interface Props { diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/hello_world_embeddable_example.tsx b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/hello_world_embeddable_example.tsx index 853ceb0322ea6..78b122cb1baf5 100644 --- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/hello_world_embeddable_example.tsx +++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/hello_world_embeddable_example.tsx @@ -18,13 +18,13 @@ */ import React from 'react'; -import { TGetActionsCompatibleWithTrigger } from '../../../../../../../../src/plugins/ui_actions/public'; import { EmbeddablePanel, GetEmbeddableFactory, GetEmbeddableFactories, -} from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; -import { HelloWorldEmbeddable } from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable'; +} from '../../../../../../../../src/plugins/embeddable/public'; +import { HelloWorldEmbeddable } from '../../../../../../../../src/plugins/embeddable/public/lib/test_samples'; +import { TGetActionsCompatibleWithTrigger } from '../../../../../../../../src/plugins/ui_actions/public'; import { CoreStart } from '../../../../../../../../src/core/public'; import { Start as InspectorStartContract } from '../../../../../../../../src/plugins/inspector/public'; diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/embeddable_api.ts b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/embeddable_api.ts index e46bf60dacb4b..d4a8cbabc3c2a 100644 --- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/embeddable_api.ts +++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/embeddable_api.ts @@ -17,4 +17,5 @@ * under the License. */ -export * from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; +export * from '../../../../../../../src/plugins/embeddable/public'; +export * from '../../../../../../../src/plugins/embeddable/public/lib/test_samples'; diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/embeddables/hello_world_embeddable_factory.ts b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/embeddables/hello_world_embeddable_factory.ts index 6be4afcb36daf..3cc7b70ce4090 100644 --- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/embeddables/hello_world_embeddable_factory.ts +++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/embeddables/hello_world_embeddable_factory.ts @@ -17,8 +17,10 @@ * under the License. */ -import { setup } from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/legacy'; -import { HelloWorldEmbeddableFactory } from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples/embeddables/hello_world/hello_world_embeddable_factory'; +// eslint-disable-next-line +import { npSetup } from '../../../../../../../../src/legacy/ui/public/new_platform'; +// eslint-disable-next-line +import { HelloWorldEmbeddableFactory } from '../../../../../../../../src/plugins/embeddable/public/lib/test_samples'; const factory = new HelloWorldEmbeddableFactory(); -setup.registerEmbeddableFactory(factory.type, factory); +npSetup.plugins.embeddable.registerEmbeddableFactory(factory.type, factory); diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/legacy.ts b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/legacy.ts index 1635cda5a7e31..a310403c86b5d 100644 --- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/legacy.ts +++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/legacy.ts @@ -32,15 +32,11 @@ import { uiModules } from 'ui/modules'; import template from './index.html'; import { plugin } from '.'; -import { - setup as embeddableSetup, - start as embeddableStart, -} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/legacy'; const pluginInstance = plugin({} as any); export const setup = pluginInstance.setup(npSetup.core, { - embeddable: embeddableSetup, + embeddable: npSetup.plugins.embeddable, inspector: npSetup.plugins.inspector, __LEGACY: { SavedObjectFinder, @@ -64,7 +60,7 @@ uiRoutes.when('/', { }); export const start = pluginInstance.start(npStart.core, { - embeddable: embeddableStart, + embeddable: npStart.plugins.embeddable, inspector: npStart.plugins.inspector, uiActions: npStart.plugins.uiActions, __LEGACY: { diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/plugin.tsx b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/plugin.tsx index dbccdba3b6383..f03b3c4a1e0a5 100644 --- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/plugin.tsx +++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/plugin.tsx @@ -36,7 +36,7 @@ import { createSendMessageAction, HelloWorldEmbeddableFactory, ContactCardEmbeddableFactory, -} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples'; +} from './embeddable_api'; import { App } from './app'; export interface SetupDependencies { diff --git a/test/plugin_functional/plugins/kbn_tp_sample_panel_action/public/sample_panel_action.tsx b/test/plugin_functional/plugins/kbn_tp_sample_panel_action/public/sample_panel_action.tsx index 334d3bdc4ac48..71724595d462a 100644 --- a/test/plugin_functional/plugins/kbn_tp_sample_panel_action/public/sample_panel_action.tsx +++ b/test/plugin_functional/plugins/kbn_tp_sample_panel_action/public/sample_panel_action.tsx @@ -20,10 +20,7 @@ import { EuiFlyoutBody, EuiFlyoutHeader, EuiTitle } from '@elastic/eui'; import React from 'react'; import { npStart, npSetup } from 'ui/new_platform'; -import { - CONTEXT_MENU_TRIGGER, - IEmbeddable, -} from '../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; +import { CONTEXT_MENU_TRIGGER, IEmbeddable } from '../../../../../src/plugins/embeddable/public'; import { createAction } from '../../../../../src/plugins/ui_actions/public'; interface ActionContext { diff --git a/test/plugin_functional/plugins/kbn_tp_sample_panel_action/public/sample_panel_link.ts b/test/plugin_functional/plugins/kbn_tp_sample_panel_action/public/sample_panel_link.ts index c020559cfb792..f042d466c794a 100644 --- a/test/plugin_functional/plugins/kbn_tp_sample_panel_action/public/sample_panel_link.ts +++ b/test/plugin_functional/plugins/kbn_tp_sample_panel_action/public/sample_panel_link.ts @@ -18,7 +18,7 @@ */ import { npStart } from 'ui/new_platform'; import { IAction, createAction } from '../../../../../src/plugins/ui_actions/public'; -import { CONTEXT_MENU_TRIGGER } from '../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; +import { CONTEXT_MENU_TRIGGER } from '../../../../../src/plugins/embeddable/public'; export const createSamplePanelLink = (): IAction => createAction({ diff --git a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/kibana.json b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/kibana.json index f0303e7ad6a7a..fd2c7ad1130c1 100644 --- a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/kibana.json +++ b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/kibana.json @@ -2,7 +2,8 @@ "id": "advanced_ui_actions", "version": "kibana", "requiredPlugins": [ - "embeddable" + "embeddable", + "ui_actions" ], "server": false, "ui": true diff --git a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/can_inherit_time_range.test.ts b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/can_inherit_time_range.test.ts index fe6a37c92f84b..a0a550da1d24c 100644 --- a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/can_inherit_time_range.test.ts +++ b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/can_inherit_time_range.test.ts @@ -4,10 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ import { canInheritTimeRange } from './can_inherit_time_range'; +/** eslint-disable */ import { HelloWorldEmbeddable, HelloWorldContainer, -} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples'; +} from '../../../../../../../src/plugins/embeddable/public/lib/test_samples'; +/** eslint-enable */ import { TimeRangeEmbeddable, TimeRangeContainer } from './test_helpers'; jest.mock('ui/new_platform'); diff --git a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/can_inherit_time_range.ts b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/can_inherit_time_range.ts index 221fdc314f8c8..09d8d26998e95 100644 --- a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/can_inherit_time_range.ts +++ b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/can_inherit_time_range.ts @@ -4,12 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +import { Embeddable, IContainer, ContainerInput } from 'src/plugins/embeddable/public'; import { TimeRange } from '../../../../../../../src/plugins/data/public'; -import { - Embeddable, - IContainer, - ContainerInput, -} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; import { TimeRangeInput } from './custom_time_range_action'; interface ContainerTimeRangeInput extends ContainerInput { diff --git a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_action.test.ts b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_action.test.ts index a2d20399ec6ca..1a5b26134ff5a 100644 --- a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_action.test.ts +++ b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_action.test.ts @@ -10,17 +10,19 @@ import { skip } from 'rxjs/operators'; import * as Rx from 'rxjs'; import { mount } from 'enzyme'; -import { EmbeddableFactory } from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; +import { EmbeddableFactory } from '../../../../../../../src/plugins/embeddable/public'; import { TimeRangeEmbeddable, TimeRangeContainer, TIME_RANGE_EMBEDDABLE } from './test_helpers'; import { TimeRangeEmbeddableFactory } from './test_helpers/time_range_embeddable_factory'; import { CustomTimeRangeAction } from './custom_time_range_action'; import { coreMock } from '../../../../../../../src/core/public/mocks'; +/* eslint-disable */ import { HelloWorldEmbeddableFactory, HELLO_WORLD_EMBEDDABLE_TYPE, HelloWorldEmbeddable, HelloWorldContainer, -} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples'; +} from '../../../../../../../src/plugins/embeddable/public/lib/test_samples'; +/* eslint-enable */ import { nextTick } from 'test_utils/enzyme_helpers'; import { ReactElement } from 'react'; diff --git a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_action.tsx b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_action.tsx index f98e18fbf0e9e..a9ab5edea4a25 100644 --- a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_action.tsx +++ b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_action.tsx @@ -6,6 +6,7 @@ import { i18n } from '@kbn/i18n'; import React from 'react'; +import { IEmbeddable, Embeddable, EmbeddableInput } from 'src/plugins/embeddable/public'; import { IAction, IncompatibleActionError, @@ -15,12 +16,6 @@ import { SEARCH_EMBEDDABLE_TYPE } from '../../../../../../../src/legacy/core_plu import { VisualizeEmbeddable } from '../../../../../../../src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable'; import { VISUALIZE_EMBEDDABLE_TYPE } from '../../../../../../../src/legacy/core_plugins/kibana/public/visualize/embeddable/constants'; -import { - IEmbeddable, - Embeddable, - EmbeddableInput, -} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; - import { CustomizeTimeRangeModal } from './customize_time_range_modal'; import { OpenModal, CommonlyUsedRange } from './types'; diff --git a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_badge.test.ts b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_badge.test.ts index 33a6adb61775a..9b13e5b03cf10 100644 --- a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_badge.test.ts +++ b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_badge.test.ts @@ -10,7 +10,7 @@ import { skip } from 'rxjs/operators'; import * as Rx from 'rxjs'; import { mount } from 'enzyme'; -import { EmbeddableFactory } from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; +import { EmbeddableFactory } from '../../../../../../../src/plugins/embeddable/public'; import { TimeRangeEmbeddable, TimeRangeContainer, TIME_RANGE_EMBEDDABLE } from './test_helpers'; import { TimeRangeEmbeddableFactory } from './test_helpers/time_range_embeddable_factory'; import { CustomTimeRangeBadge } from './custom_time_range_badge'; diff --git a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_badge.tsx b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_badge.tsx index 29d8711297873..13fdbb17e1070 100644 --- a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_badge.tsx +++ b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/custom_time_range_badge.tsx @@ -7,16 +7,12 @@ import React from 'react'; import { prettyDuration, commonDurationRanges } from '@elastic/eui'; +import { IEmbeddable, Embeddable, EmbeddableInput } from 'src/plugins/embeddable/public'; import { IAction, IncompatibleActionError, } from '../../../../../../../src/plugins/ui_actions/public'; import { TimeRange } from '../../../../../../../src/plugins/data/public'; -import { - IEmbeddable, - Embeddable, - EmbeddableInput, -} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; import { CustomizeTimeRangeModal } from './customize_time_range_modal'; import { doesInheritTimeRange } from './does_inherit_time_range'; diff --git a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/customize_time_range_modal.tsx b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/customize_time_range_modal.tsx index dfa5768a4f859..26ff149599812 100644 --- a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/customize_time_range_modal.tsx +++ b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/customize_time_range_modal.tsx @@ -19,12 +19,8 @@ import { EuiFlexItem, } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; +import { Embeddable, IContainer, ContainerInput } from 'src/plugins/embeddable/public'; import { TimeRange } from '../../../../../../../src/plugins/data/public'; -import { - Embeddable, - IContainer, - ContainerInput, -} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; import { TimeRangeInput } from './custom_time_range_action'; import { doesInheritTimeRange } from './does_inherit_time_range'; import { CommonlyUsedRange } from './types'; diff --git a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/does_inherit_time_range.ts b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/does_inherit_time_range.ts index aa960c45e20d6..6b4033db34580 100644 --- a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/does_inherit_time_range.ts +++ b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/does_inherit_time_range.ts @@ -4,11 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -import { - Embeddable, - IContainer, - ContainerInput, -} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; +import { Embeddable, IContainer, ContainerInput } from 'src/plugins/embeddable/public'; import { TimeRangeInput } from './custom_time_range_action'; export function doesInheritTimeRange(embeddable: Embeddable) { diff --git a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/legacy.ts b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/legacy.ts index 65580d25d08ce..535e55d71d349 100644 --- a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/legacy.ts +++ b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/legacy.ts @@ -10,16 +10,12 @@ import { npSetup, npStart } from 'ui/new_platform'; import { plugin } from '.'; -import { - setup as embeddableSetup, - start as embeddableStart, -} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/legacy'; - const pluginInstance = plugin({} as any); export const setup = pluginInstance.setup(npSetup.core, { - embeddable: embeddableSetup, + embeddable: npSetup.plugins.embeddable, + uiActions: npSetup.plugins.uiActions, }); export const start = pluginInstance.start(npStart.core, { - embeddable: embeddableStart, + embeddable: npStart.plugins.embeddable, uiActions: npStart.plugins.uiActions, }); diff --git a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/plugin.ts b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/plugin.ts index 871d9f9536285..f1b87f6c694a1 100644 --- a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/plugin.ts +++ b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/plugin.ts @@ -5,23 +5,25 @@ */ import { PluginInitializerContext, CoreSetup, CoreStart, Plugin } from 'src/core/public'; -import { IUiActionsStart } from 'src/plugins/ui_actions/public'; +import { IUiActionsStart, IUiActionsSetup } from 'src/plugins/ui_actions/public'; import { - Plugin as EmbeddablePlugin, CONTEXT_MENU_TRIGGER, PANEL_BADGE_TRIGGER, -} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; + Setup as EmbeddableSetup, + Start as EmbeddableStart, +} from '../../../../../../../src/plugins/embeddable/public'; import { CustomTimeRangeAction } from './custom_time_range_action'; import { CustomTimeRangeBadge } from './custom_time_range_badge'; import { CommonlyUsedRange } from './types'; interface SetupDependencies { - embeddable: ReturnType; + embeddable: EmbeddableSetup; // Embeddable are needed because they register basic triggers/actions. + uiActions: IUiActionsSetup; } interface StartDependencies { - embeddable: ReturnType; + embeddable: EmbeddableStart; uiActions: IUiActionsStart; } @@ -32,9 +34,9 @@ export class AdvancedUiActionsPublicPlugin implements Plugin { constructor(initializerContext: PluginInitializerContext) {} - public setup(core: CoreSetup, { embeddable }: SetupDependencies): Setup {} + public setup(core: CoreSetup, { uiActions }: SetupDependencies): Setup {} - public start(core: CoreStart, { embeddable, uiActions }: StartDependencies): Start { + public start(core: CoreStart, { uiActions }: StartDependencies): Start { const dateFormat = core.uiSettings.get('dateFormat') as string; const commonlyUsedRanges = core.uiSettings.get('timepicker:quickRanges') as CommonlyUsedRange[]; const timeRangeAction = new CustomTimeRangeAction({ diff --git a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/test_helpers/time_range_container.ts b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/test_helpers/time_range_container.ts index 0227e97fe3537..a916f40160c59 100644 --- a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/test_helpers/time_range_container.ts +++ b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/test_helpers/time_range_container.ts @@ -4,13 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ -import { TimeRange } from '../../../../../../../../src/plugins/data/public'; import { ContainerInput, Container, ContainerOutput, GetEmbeddableFactory, -} from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; +} from '../../../../../../../../src/plugins/embeddable/public'; +import { TimeRange } from '../../../../../../../../src/plugins/data/public'; /** * interfaces are not allowed to specify a sub-set of the required types until diff --git a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/test_helpers/time_range_embeddable.ts b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/test_helpers/time_range_embeddable.ts index 7fb8c390f720c..0ca8a0ad9391f 100644 --- a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/test_helpers/time_range_embeddable.ts +++ b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/test_helpers/time_range_embeddable.ts @@ -4,13 +4,13 @@ * you may not use this file except in compliance with the Elastic License. */ -import { TimeRange } from '../../../../../../../../src/plugins/data/public'; import { EmbeddableOutput, Embeddable, EmbeddableInput, IContainer, -} from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; +} from '../../../../../../../../src/plugins/embeddable/public'; +import { TimeRange } from '../../../../../../../../src/plugins/data/public'; interface EmbeddableTimeRangeInput extends EmbeddableInput { timeRange: TimeRange; diff --git a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/test_helpers/time_range_embeddable_factory.ts b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/test_helpers/time_range_embeddable_factory.ts index f4dcaa1e935ad..225bf3420faa1 100644 --- a/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/test_helpers/time_range_embeddable_factory.ts +++ b/x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/test_helpers/time_range_embeddable_factory.ts @@ -4,12 +4,12 @@ * you may not use this file except in compliance with the Elastic License. */ -import { TimeRange } from '../../../../../../../../src/plugins/data/public'; import { EmbeddableInput, IContainer, EmbeddableFactory, -} from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; +} from '../../../../../../../../src/plugins/embeddable/public'; +import { TimeRange } from '../../../../../../../../src/plugins/data/public'; import { TIME_RANGE_EMBEDDABLE, TimeRangeEmbeddable } from './time_range_embeddable'; interface EmbeddableTimeRangeInput extends EmbeddableInput { diff --git a/x-pack/legacy/plugins/siem/public/components/embeddables/actions/apply_siem_filter_action.test.tsx b/x-pack/legacy/plugins/siem/public/components/embeddables/actions/apply_siem_filter_action.test.tsx index bdbfad15a9810..66636766f9872 100644 --- a/x-pack/legacy/plugins/siem/public/components/embeddables/actions/apply_siem_filter_action.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/embeddables/actions/apply_siem_filter_action.test.tsx @@ -18,7 +18,7 @@ import { EmbeddableInput, EmbeddableOutput, IEmbeddable, -} from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/embeddables'; +} from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; import { Filter } from '@kbn/es-query'; // Using type narrowing to remove all the any's -- https://github.com/elastic/kibana/pull/43965/files#r318796100 diff --git a/x-pack/legacy/plugins/siem/public/components/embeddables/actions/apply_siem_filter_action.tsx b/x-pack/legacy/plugins/siem/public/components/embeddables/actions/apply_siem_filter_action.tsx index 0ea87ecaed0e8..8ee016f12deed 100644 --- a/x-pack/legacy/plugins/siem/public/components/embeddables/actions/apply_siem_filter_action.tsx +++ b/x-pack/legacy/plugins/siem/public/components/embeddables/actions/apply_siem_filter_action.tsx @@ -8,9 +8,9 @@ import { Filter } from '@kbn/es-query'; import { getOr } from 'lodash/fp'; import { i18n } from '@kbn/i18n'; import { IAction } from 'src/plugins/ui_actions/public'; +import { IEmbeddable } from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; // @ts-ignore Missing type defs as maps moves to Typescript import { MAP_SAVED_OBJECT_TYPE } from '../../../../../maps/common/constants'; -import { IEmbeddable } from '../../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/embeddables'; export const APPLY_SIEM_FILTER_ACTION_ID = 'APPLY_SIEM_FILTER_ACTION_ID'; diff --git a/x-pack/legacy/plugins/siem/public/components/embeddables/embedded_map_helpers.tsx b/x-pack/legacy/plugins/siem/public/components/embeddables/embedded_map_helpers.tsx index cb1fa30fce26e..1ecb478ebe244 100644 --- a/x-pack/legacy/plugins/siem/public/components/embeddables/embedded_map_helpers.tsx +++ b/x-pack/legacy/plugins/siem/public/components/embeddables/embedded_map_helpers.tsx @@ -12,15 +12,15 @@ import { APPLY_FILTER_TRIGGER, CONTEXT_MENU_TRIGGER, PANEL_BADGE_TRIGGER, -} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/triggers'; + APPLY_FILTER_ACTION, + ViewMode, +} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; import { APPLY_SIEM_FILTER_ACTION_ID, ApplySiemFilterAction, } from './actions/apply_siem_filter_action'; -import { APPLY_FILTER_ACTION } from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions'; import { IndexPatternMapping, MapEmbeddable, SetQuery } from './types'; import { getLayerList } from './map_config'; -import { ViewMode } from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; // @ts-ignore Missing type defs as maps moves to Typescript import { MAP_SAVED_OBJECT_TYPE } from '../../../../maps/common/constants'; import * as i18n from './translations';