diff --git a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app_controller.tsx b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app_controller.tsx index 7972c7603d311..d4aa3c6aa625d 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app_controller.tsx +++ b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app_controller.tsx @@ -35,7 +35,6 @@ import { AppStateClass as TAppStateClass, KbnUrl, SaveOptions, - SavedObjectFinder, unhashUrl, } from './legacy_imports'; import { FilterStateManager, IndexPattern } from '../../../data/public'; @@ -115,7 +114,7 @@ export class DashboardAppController { timefilter: { timefilter }, }, }, - core: { notifications, overlays, chrome, injectedMetadata }, + core: { notifications, overlays, chrome, injectedMetadata, uiSettings, savedObjects }, }: DashboardAppControllerDependencies) { new FilterStateManager(globalState, getAppState, filterManager); const queryFilter = filterManager; @@ -728,7 +727,8 @@ export class DashboardAppController { getFactory: embeddables.getEmbeddableFactory, notifications, overlays, - SavedObjectFinder, + uiSettings, + savedObjects, }); } }; diff --git a/src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts b/src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts index 7c3c389330887..f02c252e2108d 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts +++ b/src/legacy/core_plugins/kibana/public/dashboard/legacy_imports.ts @@ -65,4 +65,3 @@ export { stateMonitorFactory, StateMonitor } from 'ui/state_management/state_mon export { ensureDefaultIndexPattern } from 'ui/legacy_compat'; export { unhashUrl } from 'ui/state_management/state_hashing'; export { IInjector } from 'ui/chrome'; -export { SavedObjectFinder } from 'ui/saved_objects/components/saved_object_finder'; diff --git a/src/legacy/core_plugins/kibana/public/visualize/wizard/search_selection/search_selection.tsx b/src/legacy/core_plugins/kibana/public/visualize/wizard/search_selection/search_selection.tsx index 88dbbb8de7df9..41607bdea7503 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/wizard/search_selection/search_selection.tsx +++ b/src/legacy/core_plugins/kibana/public/visualize/wizard/search_selection/search_selection.tsx @@ -22,9 +22,8 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; -import { SavedObjectFinder } from 'ui/saved_objects/components/saved_object_finder'; - -import { VisType } from '../../kibana_services'; +import { VisType, getServices } from '../../kibana_services'; +import { SavedObjectFinder } from '../../../../../../../plugins/kibana_react/public'; interface SearchSelectionProps { onSearchSelected: (searchId: string, searchType: string) => void; @@ -35,6 +34,9 @@ export class SearchSelection extends React.Component { private fixedPageSize: number = 8; public render() { + const { + core: { uiSettings, savedObjects }, + } = getServices(); return ( @@ -85,6 +87,8 @@ export class SearchSelection extends React.Component { }, ]} fixedPageSize={this.fixedPageSize} + uiSettings={uiSettings} + savedObjects={savedObjects} /> diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/grid/dashboard_grid.tsx b/src/plugins/dashboard_embeddable_container/public/embeddable/grid/dashboard_grid.tsx index 40db43427339d..2b905626d0db5 100644 --- a/src/plugins/dashboard_embeddable_container/public/embeddable/grid/dashboard_grid.tsx +++ b/src/plugins/dashboard_embeddable_container/public/embeddable/grid/dashboard_grid.tsx @@ -276,7 +276,7 @@ class DashboardGridUi extends React.Component { overlays={this.props.kibana.services.overlays} notifications={this.props.kibana.services.notifications} inspector={this.props.kibana.services.inspector} - SavedObjectFinder={this.props.kibana.services.SavedObjectFinder} + uiSettings={this.props.kibana.services.} /> ); diff --git a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx index 3c9e6e31220b2..c5eb7f17e9ccb 100644 --- a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx +++ b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.test.tsx @@ -68,8 +68,9 @@ test('EmbeddableChildPanel renders an embeddable when it is done loading', async getEmbeddableFactory={(() => undefined) as any} notifications={{} as any} overlays={{} as any} + uiSettings={{} as any} + savedObjects={{} as any} inspector={inspector} - SavedObjectFinder={() => null} /> ); @@ -106,8 +107,9 @@ test(`EmbeddableChildPanel renders an error message if the factory doesn't exist getEmbeddableFactory={(() => undefined) as any} notifications={{} as any} overlays={{} as any} + uiSettings={{} as any} + savedObjects={{} as any} inspector={inspector} - SavedObjectFinder={() => null} /> ); diff --git a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx index d3f9b07be4754..2432b97ddd749 100644 --- a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx +++ b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx @@ -40,8 +40,9 @@ export interface EmbeddableChildPanelProps { getAllEmbeddableFactories: GetEmbeddableFactories; overlays: CoreStart['overlays']; notifications: CoreStart['notifications']; + uiSettings: CoreStart['uiSettings']; + savedObjects: CoreStart['savedObjects']; inspector: InspectorStartContract; - SavedObjectFinder: React.ComponentType; } interface State { @@ -102,8 +103,9 @@ export class EmbeddableChildPanel extends React.Component )} diff --git a/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx b/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx index 2b48bf237829c..764384759553c 100644 --- a/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx +++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx @@ -48,8 +48,9 @@ interface Props { getAllEmbeddableFactories: GetEmbeddableFactories; overlays: CoreStart['overlays']; notifications: CoreStart['notifications']; + uiSettings: CoreStart['uiSettings']; + savedObjects: CoreStart['savedObjects']; inspector: InspectorStartContract; - SavedObjectFinder: React.ComponentType; hideHeader?: boolean; } @@ -233,7 +234,8 @@ export class EmbeddablePanel extends React.Component { this.props.getAllEmbeddableFactories, this.props.overlays, this.props.notifications, - this.props.SavedObjectFinder + this.props.uiSettings, + this.props.savedObjects ), new InspectPanelAction(this.props.inspector), new RemovePanelAction(), diff --git a/src/plugins/embeddable/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 index 9ecc4686c21b6..e4a1929ad815b 100644 --- a/src/plugins/embeddable/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,7 +18,7 @@ */ import { i18n } from '@kbn/i18n'; import { IAction } from 'src/plugins/ui_actions/public'; -import { NotificationsStart, OverlayStart } from 'src/core/public'; +import { CoreStart, NotificationsStart, OverlayStart } from 'src/core/public'; import { ViewMode, GetEmbeddableFactory, GetEmbeddableFactories } from '../../../../types'; import { openAddPanelFlyout } from './open_add_panel_flyout'; import { IContainer } from '../../../../containers'; @@ -38,7 +38,8 @@ export class AddPanelAction implements IAction { private readonly getAllFactories: GetEmbeddableFactories, private readonly overlays: OverlayStart, private readonly notifications: NotificationsStart, - private readonly SavedObjectFinder: React.ComponentType + private readonly uiSettings: CoreStart['uiSettings'], + private readonly savedObjects: CoreStart['savedObjects'] ) {} public getDisplayName() { @@ -66,7 +67,8 @@ export class AddPanelAction implements IAction { getAllFactories: this.getAllFactories, overlays: this.overlays, notifications: this.notifications, - SavedObjectFinder: this.SavedObjectFinder, + savedObjects: this.savedObjects, + uiSettings: this.uiSettings, }); } } diff --git a/src/plugins/embeddable/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 index 4f2ae7ab19bcb..73b2433c3d51e 100644 --- a/src/plugins/embeddable/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 @@ -19,7 +19,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React from 'react'; -import { CoreSetup } from 'src/core/public'; +import { CoreSetup, CoreStart } from 'src/core/public'; import { EuiButton, @@ -36,6 +36,7 @@ import { import { IContainer } from '../../../../containers'; import { EmbeddableFactoryNotFoundError } from '../../../../errors'; import { GetEmbeddableFactories, GetEmbeddableFactory } from '../../../../types'; +import { SavedObjectFinder } from '../../../../../../../kibana_react/public'; interface Props { onClose: () => void; @@ -43,7 +44,8 @@ interface Props { getFactory: GetEmbeddableFactory; getAllFactories: GetEmbeddableFactories; notifications: CoreSetup['notifications']; - SavedObjectFinder: React.ComponentType; + savedObjects: CoreStart['savedObjects']; + uiSettings: CoreSetup['uiSettings']; } interface State { @@ -131,7 +133,6 @@ export class AddPanelFlyout extends React.Component { } public render() { - const SavedObjectFinder = this.props.SavedObjectFinder; const savedObjectsFinder = ( { noItemsMessage={i18n.translate('embeddableApi.addPanel.noMatchingObjectsMessage', { defaultMessage: 'No matching objects found.', })} + savedObjects={this.props.savedObjects} + uiSettings={this.props.uiSettings} /> ); diff --git a/src/plugins/embeddable/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 index 481693501066c..1101f71e1d466 100644 --- a/src/plugins/embeddable/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,7 +17,7 @@ * under the License. */ import React from 'react'; -import { NotificationsStart, OverlayStart } from 'src/core/public'; +import { CoreSetup, CoreStart, NotificationsStart, OverlayStart } from 'src/core/public'; import { toMountPoint } from '../../../../../../../kibana_react/public'; import { IContainer } from '../../../../containers'; import { AddPanelFlyout } from './add_panel_flyout'; @@ -29,7 +29,8 @@ export async function openAddPanelFlyout(options: { getAllFactories: GetEmbeddableFactories; overlays: OverlayStart; notifications: NotificationsStart; - SavedObjectFinder: React.ComponentType; + savedObjects: CoreStart['savedObjects']; + uiSettings: CoreSetup['uiSettings']; }) { const { embeddable, @@ -37,7 +38,8 @@ export async function openAddPanelFlyout(options: { getAllFactories, overlays, notifications, - SavedObjectFinder, + savedObjects, + uiSettings, } = options; const flyoutSession = overlays.openFlyout( toMountPoint( @@ -51,7 +53,8 @@ export async function openAddPanelFlyout(options: { getFactory={getFactory} getAllFactories={getAllFactories} notifications={notifications} - SavedObjectFinder={SavedObjectFinder} + savedObjects={savedObjects} + uiSettings={uiSettings} /> ), { 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 a310403c86b5d..1928d7ac72313 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 @@ -22,7 +22,6 @@ import 'uiExports/embeddableFactories'; import 'uiExports/embeddableActions'; import { npSetup, npStart } from 'ui/new_platform'; -import { SavedObjectFinder } from 'ui/saved_objects/components/saved_object_finder'; import { ExitFullScreenButton } from 'ui/exit_full_screen'; import uiRoutes from 'ui/routes'; // @ts-ignore @@ -39,7 +38,6 @@ export const setup = pluginInstance.setup(npSetup.core, { embeddable: npSetup.plugins.embeddable, inspector: npSetup.plugins.inspector, __LEGACY: { - SavedObjectFinder, ExitFullScreenButton, }, }); @@ -64,7 +62,6 @@ export const start = pluginInstance.start(npStart.core, { inspector: npStart.plugins.inspector, uiActions: npStart.plugins.uiActions, __LEGACY: { - SavedObjectFinder, ExitFullScreenButton, onRenderComplete: (renderCompleteListener: () => void) => { if (rendered) { 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 6b82a67b9fcda..5245935c191ee 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 @@ -38,6 +38,7 @@ import { ContactCardEmbeddableFactory, } from './embeddable_api'; import { App } from './app'; +import { SavedObjectFinder as SavedObjectFinderNP } from '../../../../../../../src/plugins/kibana_react/public'; import { IEmbeddableStart, IEmbeddableSetup, @@ -47,7 +48,6 @@ export interface SetupDependencies { embeddable: IEmbeddableSetup; inspector: InspectorSetupContract; __LEGACY: { - SavedObjectFinder: React.ComponentType; ExitFullScreenButton: React.ComponentType; }; } @@ -57,7 +57,6 @@ interface StartDependencies { uiActions: IUiActionsStart; inspector: InspectorStartContract; __LEGACY: { - SavedObjectFinder: React.ComponentType; ExitFullScreenButton: React.ComponentType; onRenderComplete: (onRenderComplete: () => void) => void; }; @@ -97,6 +96,14 @@ export class EmbeddableExplorerPublicPlugin contactCardEmbeddableFactory ); + const SavedObjectFinder = (props: any) => ( + + ); + plugins.__LEGACY.onRenderComplete(() => { const root = document.getElementById(REACT_ROOT_ID); ReactDOM.render( @@ -107,8 +114,8 @@ export class EmbeddableExplorerPublicPlugin notifications={core.notifications} overlays={core.overlays} inspector={plugins.inspector} - SavedObjectFinder={plugins.__LEGACY.SavedObjectFinder} I18nContext={core.i18n.Context} + SavedObjectFinder={SavedObjectFinder} />, root ); diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/renderers/embeddable.tsx b/x-pack/legacy/plugins/canvas/canvas_plugin_src/renderers/embeddable.tsx index 8810871e9161b..e24b438bb9d4d 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/renderers/embeddable.tsx +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/renderers/embeddable.tsx @@ -16,7 +16,6 @@ import { } from '../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; import { start } from '../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/legacy'; import { EmbeddableExpression } from '../expression_types/embeddable'; -import { SavedObjectFinder } from '../../../../../../src/legacy/ui/public/saved_objects/components/saved_object_finder'; import { RendererStrings } from '../../i18n'; const { embeddable: strings } = RendererStrings; @@ -48,7 +47,8 @@ const renderEmbeddable = (embeddableObject: IEmbeddable, domNode: HTMLElement) = notifications={npStart.core.notifications} overlays={npStart.core.overlays} inspector={npStart.plugins.inspector} - SavedObjectFinder={SavedObjectFinder} + uiSettings={npStart.core.uiSettings} + savedObjects={npStart.core.savedObjects} /> diff --git a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/page.tsx b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/page.tsx index 68013bd243a91..22904b5efdfc2 100644 --- a/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/page.tsx +++ b/x-pack/legacy/plugins/ml/public/application/jobs/new_job/pages/index_or_search/page.tsx @@ -15,7 +15,8 @@ import { } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; -import { SavedObjectFinder } from 'ui/saved_objects/components/saved_object_finder'; +import { npStart } from 'ui/new_platform'; +import { SavedObjectFinder } from '../../../../../../../../../../src/plugins/kibana_react/public'; export interface PageProps { nextStepPath: string; @@ -76,6 +77,8 @@ export const Page: FC = ({ nextStepPath }) => { }, ]} fixedPageSize={RESULTS_PER_PAGE} + uiSettings={npStart.core.uiSettings} + savedObjects={npStart.core.savedObjects} /> diff --git a/x-pack/legacy/plugins/siem/public/components/embeddables/embedded_map.tsx b/x-pack/legacy/plugins/siem/public/components/embeddables/embedded_map.tsx index 5a3a689e12d83..35fe367c30780 100644 --- a/x-pack/legacy/plugins/siem/public/components/embeddables/embedded_map.tsx +++ b/x-pack/legacy/plugins/siem/public/components/embeddables/embedded_map.tsx @@ -9,7 +9,6 @@ import React, { useEffect, useState } from 'react'; import { createPortalNode, InPortal } from 'react-reverse-portal'; import styled, { css } from 'styled-components'; import { ELASTIC_WEBSITE_URL, DOC_LINK_VERSION } from 'ui/documentation_links'; -import { SavedObjectFinder } from 'ui/saved_objects/components/saved_object_finder'; import { EmbeddablePanel } from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; import { start } from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/legacy'; @@ -213,9 +212,10 @@ export const EmbeddedMapComponent = ({ getEmbeddableFactory={start.getEmbeddableFactory} getAllEmbeddableFactories={start.getEmbeddableFactories} notifications={core.notifications} + uiSettings={core.uiSettings} + savedObjects={core.savedObjects} overlays={core.overlays} inspector={plugins.inspector} - SavedObjectFinder={SavedObjectFinder} /> ) : !isLoading && isIndexError ? ( diff --git a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/search_selection/search_selection.tsx b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/search_selection/search_selection.tsx index 1a270505d61a6..23d1a70f1840b 100644 --- a/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/search_selection/search_selection.tsx +++ b/x-pack/legacy/plugins/transform/public/app/sections/transform_management/components/search_selection/search_selection.tsx @@ -8,8 +8,8 @@ import { EuiModalBody, EuiModalHeader, EuiModalHeaderTitle } from '@elastic/eui' import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; import React, { FC } from 'react'; - -import { SavedObjectFinder } from 'ui/saved_objects/components/saved_object_finder'; +import { SavedObjectFinder } from '../../../../../../../../../../src/plugins/kibana_react/public'; +import { useAppDependencies } from '../../../../app_dependencies'; interface SearchSelectionProps { onSearchSelected: (searchId: string, searchType: string) => void; @@ -17,56 +17,63 @@ interface SearchSelectionProps { const fixedPageSize: number = 8; -export const SearchSelection: FC = ({ onSearchSelected }) => ( - <> - - - {' '} - /{' '} - = ({ onSearchSelected }) => { + const { + core: { uiSettings, savedObjects }, + } = useAppDependencies(); + return ( + <> + + + {' '} + /{' '} + + + + + 'search', + name: i18n.translate( + 'xpack.transform.newTransform.searchSelection.savedObjectType.search', + { + defaultMessage: 'Saved search', + } + ), + }, + { + type: 'index-pattern', + getIconForSavedObject: () => 'indexPatternApp', + name: i18n.translate( + 'xpack.transform.newTransform.searchSelection.savedObjectType.indexPattern', + { + defaultMessage: 'Index pattern', + } + ), + }, + ]} + fixedPageSize={fixedPageSize} + uiSettings={uiSettings} + savedObjects={savedObjects} /> - - - - 'search', - name: i18n.translate( - 'xpack.transform.newTransform.searchSelection.savedObjectType.search', - { - defaultMessage: 'Saved search', - } - ), - }, - { - type: 'index-pattern', - getIconForSavedObject: () => 'indexPatternApp', - name: i18n.translate( - 'xpack.transform.newTransform.searchSelection.savedObjectType.indexPattern', - { - defaultMessage: 'Index pattern', - } - ), - }, - ]} - fixedPageSize={fixedPageSize} - /> - - -); + + + ); +}; diff --git a/x-pack/legacy/plugins/transform/public/plugin.ts b/x-pack/legacy/plugins/transform/public/plugin.ts index e7cc83d16b3b9..08a3a06fc24fc 100644 --- a/x-pack/legacy/plugins/transform/public/plugin.ts +++ b/x-pack/legacy/plugins/transform/public/plugin.ts @@ -27,12 +27,21 @@ const template = `
; +export type AppCore = Pick; export interface AppPlugins { management: {