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 167015435141..a46364abf5c5 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
@@ -70,6 +70,10 @@ import { DashboardAppScope } from './dashboard_app';
import { VISUALIZE_EMBEDDABLE_TYPE } from '../visualize/embeddable';
import { convertSavedDashboardPanelToPanelState } from './lib/embeddable_saved_object_converters';
import { RenderDeps } from './application';
+import {
+ SavedObjectFinderProps,
+ SavedObjectFinderUi,
+} from '../../../../../plugins/kibana_react/public';
export interface DashboardAppControllerDependencies extends RenderDeps {
$scope: DashboardAppScope;
@@ -717,14 +721,17 @@ export class DashboardAppController {
};
navActions[TopNavIds.ADD] = () => {
if (dashboardContainer && !isErrorEmbeddable(dashboardContainer)) {
+ const SavedObjectFinder = (props: SavedObjectFinderProps) => (
+
+ );
+
openAddPanelFlyout({
embeddable: dashboardContainer,
getAllFactories: embeddables.getEmbeddableFactories,
getFactory: embeddables.getEmbeddableFactory,
notifications,
overlays,
- uiSettings,
- savedObjects,
+ SavedObjectFinder,
});
}
};
diff --git a/src/plugins/dashboard_embeddable_container/public/actions/expand_panel_action.test.tsx b/src/plugins/dashboard_embeddable_container/public/actions/expand_panel_action.test.tsx
index 69e1eb86b71e..f8c05170e8f6 100644
--- a/src/plugins/dashboard_embeddable_container/public/actions/expand_panel_action.test.tsx
+++ b/src/plugins/dashboard_embeddable_container/public/actions/expand_panel_action.test.tsx
@@ -42,6 +42,7 @@ let embeddable: ContactCardEmbeddable;
beforeEach(async () => {
const options: DashboardOptions = {
ExitFullScreenButton: () => null,
+ SavedObjectFinder: () => null,
application: {} as any,
embeddable: {
getEmbeddableFactory: (id: string) => embeddableFactories.get(id)!,
@@ -51,8 +52,6 @@ beforeEach(async () => {
overlays: {} as any,
savedObjectMetaData: {} as any,
uiActions: {} as any,
- uiSettings: {} as any,
- savedObjects: {} as any,
};
const input = getSampleDashboardInput({
panels: {
diff --git a/src/plugins/dashboard_embeddable_container/public/actions/open_replace_panel_flyout.tsx b/src/plugins/dashboard_embeddable_container/public/actions/open_replace_panel_flyout.tsx
index 1a17962ad4e5..f15d538703e2 100644
--- a/src/plugins/dashboard_embeddable_container/public/actions/open_replace_panel_flyout.tsx
+++ b/src/plugins/dashboard_embeddable_container/public/actions/open_replace_panel_flyout.tsx
@@ -31,10 +31,19 @@ import {
export async function openReplacePanelFlyout(options: {
embeddable: IContainer;
core: CoreStart;
+ savedObjectFinder: React.ComponentType;
+ notifications: CoreStart['notifications'];
panelToRemove: IEmbeddable;
getEmbeddableFactories: IEmbeddableStart['getEmbeddableFactories'];
}) {
- const { embeddable, core, panelToRemove, getEmbeddableFactories } = options;
+ const {
+ embeddable,
+ core,
+ panelToRemove,
+ savedObjectFinder,
+ notifications,
+ getEmbeddableFactories,
+ } = options;
const flyoutSession = core.overlays.openFlyout(
toMountPoint(
),
diff --git a/src/plugins/dashboard_embeddable_container/public/actions/replace_panel_action.test.tsx b/src/plugins/dashboard_embeddable_container/public/actions/replace_panel_action.test.tsx
index 7858d2cd0f2f..4438a6c99712 100644
--- a/src/plugins/dashboard_embeddable_container/public/actions/replace_panel_action.test.tsx
+++ b/src/plugins/dashboard_embeddable_container/public/actions/replace_panel_action.test.tsx
@@ -45,14 +45,13 @@ beforeEach(async () => {
coreStart = coreMock.createStart();
const options: DashboardOptions = {
ExitFullScreenButton: () => null,
+ SavedObjectFinder: () => null,
application: {} as any,
embeddable: {
getEmbeddableFactory: (id: string) => embeddableFactories.get(id)!,
} as any,
inspector: {} as any,
notifications: {} as any,
- uiSettings: coreStart.uiSettings,
- savedObjects: coreStart.savedObjects,
overlays: coreStart.overlays,
savedObjectMetaData: {} as any,
uiActions: {} as any,
@@ -83,12 +82,26 @@ beforeEach(async () => {
});
test('Executes the replace panel action', async () => {
- const action = new ReplacePanelAction(coreStart, getEmbeddableFactories);
+ let SavedObjectFinder: any;
+ let notifications: any;
+ const action = new ReplacePanelAction(
+ coreStart,
+ SavedObjectFinder,
+ notifications,
+ getEmbeddableFactories
+ );
action.execute({ embeddable });
});
test('Is not compatible when embeddable is not in a dashboard container', async () => {
- const action = new ReplacePanelAction(coreStart, getEmbeddableFactories);
+ let SavedObjectFinder: any;
+ let notifications: any;
+ const action = new ReplacePanelAction(
+ coreStart,
+ SavedObjectFinder,
+ notifications,
+ getEmbeddableFactories
+ );
expect(
await action.isCompatible({
embeddable: new ContactCardEmbeddable(
@@ -100,7 +113,14 @@ test('Is not compatible when embeddable is not in a dashboard container', async
});
test('Execute throws an error when called with an embeddable not in a parent', async () => {
- const action = new ReplacePanelAction(coreStart, getEmbeddableFactories);
+ let SavedObjectFinder: any;
+ let notifications: any;
+ const action = new ReplacePanelAction(
+ coreStart,
+ SavedObjectFinder,
+ notifications,
+ getEmbeddableFactories
+ );
async function check() {
await action.execute({ embeddable: container });
}
@@ -108,11 +128,25 @@ test('Execute throws an error when called with an embeddable not in a parent', a
});
test('Returns title', async () => {
- const action = new ReplacePanelAction(coreStart, getEmbeddableFactories);
+ let SavedObjectFinder: any;
+ let notifications: any;
+ const action = new ReplacePanelAction(
+ coreStart,
+ SavedObjectFinder,
+ notifications,
+ getEmbeddableFactories
+ );
expect(action.getDisplayName({ embeddable })).toBeDefined();
});
test('Returns an icon', async () => {
- const action = new ReplacePanelAction(coreStart, getEmbeddableFactories);
+ let SavedObjectFinder: any;
+ let notifications: any;
+ const action = new ReplacePanelAction(
+ coreStart,
+ SavedObjectFinder,
+ notifications,
+ getEmbeddableFactories
+ );
expect(action.getIconType({ embeddable })).toBeDefined();
});
diff --git a/src/plugins/dashboard_embeddable_container/public/actions/replace_panel_action.tsx b/src/plugins/dashboard_embeddable_container/public/actions/replace_panel_action.tsx
index f06e578b8a10..78ce6bdc4c58 100644
--- a/src/plugins/dashboard_embeddable_container/public/actions/replace_panel_action.tsx
+++ b/src/plugins/dashboard_embeddable_container/public/actions/replace_panel_action.tsx
@@ -41,6 +41,8 @@ export class ReplacePanelAction implements IAction {
constructor(
private core: CoreStart,
+ private savedobjectfinder: React.ComponentType,
+ private notifications: CoreStart['notifications'],
private getEmbeddableFactories: IEmbeddableStart['getEmbeddableFactories']
) {}
@@ -80,6 +82,8 @@ export class ReplacePanelAction implements IAction {
openReplacePanelFlyout({
embeddable: dash,
core: this.core,
+ savedObjectFinder: this.savedobjectfinder,
+ notifications: this.notifications,
panelToRemove: view,
getEmbeddableFactories: this.getEmbeddableFactories,
});
diff --git a/src/plugins/dashboard_embeddable_container/public/actions/replace_panel_flyout.tsx b/src/plugins/dashboard_embeddable_container/public/actions/replace_panel_flyout.tsx
index 885d0bfaec25..36313353e3c3 100644
--- a/src/plugins/dashboard_embeddable_container/public/actions/replace_panel_flyout.tsx
+++ b/src/plugins/dashboard_embeddable_container/public/actions/replace_panel_flyout.tsx
@@ -22,16 +22,14 @@ import React from 'react';
import { EuiFlyout, EuiFlyoutBody, EuiFlyoutHeader, EuiTitle } from '@elastic/eui';
import { GetEmbeddableFactories } from 'src/plugins/embeddable/public';
import { DashboardPanelState } from '../embeddable';
-import { CoreStart, NotificationsStart, Toast } from '../../../../core/public';
+import { NotificationsStart, Toast } from '../../../../core/public';
import { IContainer, IEmbeddable, EmbeddableInput, EmbeddableOutput } from '../embeddable_plugin';
-import { SavedObjectFinderUi } from '../../../kibana_react/public';
interface Props {
container: IContainer;
+ savedObjectsFinder: React.ComponentType;
onClose: () => void;
notifications: NotificationsStart;
- uiSettings: CoreStart['uiSettings'];
- savedObjects: CoreStart['savedObjects'];
panelToRemove: IEmbeddable;
getEmbeddableFactories: GetEmbeddableFactories;
}
@@ -96,8 +94,9 @@ export class ReplacePanelFlyout extends React.Component {
};
public render() {
+ const SavedObjectFinder = this.props.savedObjectsFinder;
const savedObjectsFinder = (
- {
.map(({ savedObjectMetaData }) => savedObjectMetaData as any)}
showFilter={true}
onChoose={this.onReplacePanel}
- uiSettings={this.props.uiSettings}
- savedObjects={this.props.savedObjects}
/>
);
diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container.test.tsx b/src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container.test.tsx
index 1dd5c6ab15c7..770c46c62e42 100644
--- a/src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container.test.tsx
+++ b/src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container.test.tsx
@@ -41,10 +41,9 @@ const options: DashboardContainerOptions = {
notifications: {} as any,
overlays: {} as any,
inspector: {} as any,
+ SavedObjectFinder: () => null,
ExitFullScreenButton: () => null,
uiActions: {} as any,
- uiSettings: {} as any,
- savedObjects: {} as any,
};
beforeEach(() => {
diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container.tsx b/src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container.tsx
index b9866f3a7173..684aa93779bc 100644
--- a/src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container.tsx
+++ b/src/plugins/dashboard_embeddable_container/public/embeddable/dashboard_container.tsx
@@ -77,10 +77,9 @@ export interface DashboardContainerOptions {
application: CoreStart['application'];
overlays: CoreStart['overlays'];
notifications: CoreStart['notifications'];
- savedObjects: CoreStart['savedObjects'];
- uiSettings: CoreStart['uiSettings'];
embeddable: IEmbeddableStart;
inspector: InspectorStartContract;
+ SavedObjectFinder: React.ComponentType;
ExitFullScreenButton: React.ComponentType;
uiActions: IUiActionsStart;
}
diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/grid/dashboard_grid.test.tsx b/src/plugins/dashboard_embeddable_container/public/embeddable/grid/dashboard_grid.test.tsx
index e8114ca72940..c1a3d88979f4 100644
--- a/src/plugins/dashboard_embeddable_container/public/embeddable/grid/dashboard_grid.test.tsx
+++ b/src/plugins/dashboard_embeddable_container/public/embeddable/grid/dashboard_grid.test.tsx
@@ -68,12 +68,11 @@ function prepare(props?: Partial) {
inspector: {
isAvailable: jest.fn(),
} as any,
+ SavedObjectFinder: () => null,
ExitFullScreenButton: () => null,
uiActions: {
getTriggerCompatibleActions: (() => []) as any,
} as any,
- uiSettings: {} as any,
- savedObjects: {} as any,
};
dashboardContainer = new DashboardContainer(initialInput, options);
const defaultTestProps: DashboardGridProps = {
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 6a8ee13e2a97..40db43427339 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,8 +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}
- uiSettings={this.props.kibana.services.uiSettings}
- savedObjects={this.props.kibana.services.savedObjects}
+ SavedObjectFinder={this.props.kibana.services.SavedObjectFinder}
/>
);
diff --git a/src/plugins/dashboard_embeddable_container/public/embeddable/viewport/dashboard_viewport.test.tsx b/src/plugins/dashboard_embeddable_container/public/embeddable/viewport/dashboard_viewport.test.tsx
index efb6d95683cb..a2f7b8dc28fb 100644
--- a/src/plugins/dashboard_embeddable_container/public/embeddable/viewport/dashboard_viewport.test.tsx
+++ b/src/plugins/dashboard_embeddable_container/public/embeddable/viewport/dashboard_viewport.test.tsx
@@ -59,8 +59,7 @@ function getProps(
inspector: {
isAvailable: jest.fn(),
} as any,
- uiSettings: {} as any,
- savedObjects: {} as any,
+ SavedObjectFinder: () => null,
ExitFullScreenButton,
uiActions: {
getTriggerCompatibleActions: (() => []) as any,
diff --git a/src/plugins/dashboard_embeddable_container/public/plugin.tsx b/src/plugins/dashboard_embeddable_container/public/plugin.tsx
index 9753e7fcae5a..d18fbba239ec 100644
--- a/src/plugins/dashboard_embeddable_container/public/plugin.tsx
+++ b/src/plugins/dashboard_embeddable_container/public/plugin.tsx
@@ -27,6 +27,8 @@ import { ExpandPanelAction, ReplacePanelAction } from '.';
import { DashboardContainerFactory } from './embeddable/dashboard_container_factory';
import { Start as InspectorStartContract } from '../../../plugins/inspector/public';
import {
+ SavedObjectFinderUi,
+ SavedObjectFinderProps,
ExitFullScreenButton as ExitFullScreenButtonUi,
ExitFullScreenButtonProps,
} from '../../../plugins/kibana_react/public';
@@ -56,9 +58,20 @@ export class DashboardEmbeddableContainerPublicPlugin
}
public start(core: CoreStart, plugins: StartDependencies): Start {
- const { application, notifications, overlays, uiSettings, savedObjects } = core;
+ const { application, notifications, overlays } = core;
const { embeddable, inspector, uiActions } = plugins;
+ const SavedObjectFinder: React.FC> = props => (
+
+ );
+
const useHideChrome = () => {
React.useEffect(() => {
core.chrome.setIsVisible(false);
@@ -73,6 +86,8 @@ export class DashboardEmbeddableContainerPublicPlugin
const changeViewAction = new ReplacePanelAction(
core,
+ SavedObjectFinder,
+ notifications,
plugins.embeddable.getEmbeddableFactories
);
uiActions.registerAction(changeViewAction);
@@ -84,10 +99,9 @@ export class DashboardEmbeddableContainerPublicPlugin
overlays,
embeddable,
inspector,
+ SavedObjectFinder,
ExitFullScreenButton,
uiActions,
- uiSettings,
- savedObjects,
});
embeddable.registerEmbeddableFactory(factory.type, factory);
diff --git a/src/plugins/dashboard_embeddable_container/public/tests/dashboard_container.test.tsx b/src/plugins/dashboard_embeddable_container/public/tests/dashboard_container.test.tsx
index fd2b29466364..6a3b69af60d6 100644
--- a/src/plugins/dashboard_embeddable_container/public/tests/dashboard_container.test.tsx
+++ b/src/plugins/dashboard_embeddable_container/public/tests/dashboard_container.test.tsx
@@ -64,8 +64,7 @@ test('DashboardContainer in edit mode shows edit mode actions', async () => {
notifications: {} as any,
overlays: {} as any,
inspector: {} as any,
- uiSettings: {} as any,
- savedObjects: {} as any,
+ SavedObjectFinder: () => null,
ExitFullScreenButton: () => null,
uiActions: {} as any,
};
@@ -90,8 +89,7 @@ test('DashboardContainer in edit mode shows edit mode actions', async () => {
notifications={{} as any}
overlays={{} as any}
inspector={inspector}
- uiSettings={{} as any}
- savedObjects={{} as any}
+ SavedObjectFinder={() => null}
/>
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 c5eb7f17e9cc..3c9e6e31220b 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,9 +68,8 @@ 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}
/>
);
@@ -107,9 +106,8 @@ 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 2432b97ddd74..d3f9b07be475 100644
--- a/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx
+++ b/src/plugins/embeddable/public/lib/containers/embeddable_child_panel.tsx
@@ -40,9 +40,8 @@ export interface EmbeddableChildPanelProps {
getAllEmbeddableFactories: GetEmbeddableFactories;
overlays: CoreStart['overlays'];
notifications: CoreStart['notifications'];
- uiSettings: CoreStart['uiSettings'];
- savedObjects: CoreStart['savedObjects'];
inspector: InspectorStartContract;
+ SavedObjectFinder: React.ComponentType;
}
interface State {
@@ -103,9 +102,8 @@ export class EmbeddableChildPanel extends React.Component
)}
diff --git a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx
index 1073dcc04d21..196d6f934134 100644
--- a/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx
+++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.test.tsx
@@ -162,9 +162,8 @@ test('HelloWorldContainer in view mode hides edit mode actions', async () => {
getEmbeddableFactory={(() => undefined) as any}
notifications={{} as any}
overlays={{} as any}
- uiSettings={{} as any}
- savedObjects={{} as any}
inspector={inspector}
+ SavedObjectFinder={() => null}
/>
);
@@ -201,9 +200,8 @@ const renderInEditModeAndOpenContextMenu = async (
getEmbeddableFactory={(() => undefined) as any}
notifications={{} as any}
overlays={{} as any}
- uiSettings={{} as any}
- savedObjects={{} as any}
inspector={inspector}
+ SavedObjectFinder={() => null}
/>
);
@@ -301,8 +299,7 @@ test('HelloWorldContainer in edit mode shows edit mode actions', async () => {
notifications={{} as any}
overlays={{} as any}
inspector={inspector}
- uiSettings={{} as any}
- savedObjects={{} as any}
+ SavedObjectFinder={() => null}
/>
);
@@ -364,8 +361,7 @@ test('Updates when hidePanelTitles is toggled', async () => {
notifications={{} as any}
overlays={{} as any}
inspector={inspector}
- uiSettings={{} as any}
- savedObjects={{} as any}
+ SavedObjectFinder={() => null}
/>
);
@@ -417,8 +413,7 @@ test('Check when hide header option is false', async () => {
notifications={{} as any}
overlays={{} as any}
inspector={inspector}
- uiSettings={{} as any}
- savedObjects={{} as any}
+ SavedObjectFinder={() => null}
hideHeader={false}
/>
@@ -455,8 +450,7 @@ test('Check when hide header option is true', async () => {
notifications={{} as any}
overlays={{} as any}
inspector={inspector}
- uiSettings={{} as any}
- savedObjects={{} as any}
+ SavedObjectFinder={() => null}
hideHeader={true}
/>
diff --git a/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx b/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx
index afd22b5769da..234d8508bb97 100644
--- a/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx
+++ b/src/plugins/embeddable/public/lib/panel/embeddable_panel.tsx
@@ -48,9 +48,8 @@ interface Props {
getAllEmbeddableFactories: GetEmbeddableFactories;
overlays: CoreStart['overlays'];
notifications: CoreStart['notifications'];
- uiSettings: CoreStart['uiSettings'];
- savedObjects: CoreStart['savedObjects'];
inspector: InspectorStartContract;
+ SavedObjectFinder: React.ComponentType;
hideHeader?: boolean;
}
@@ -243,8 +242,7 @@ export class EmbeddablePanel extends React.Component {
this.props.getAllEmbeddableFactories,
this.props.overlays,
this.props.notifications,
- this.props.uiSettings,
- this.props.savedObjects
+ this.props.SavedObjectFinder
),
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.test.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.test.tsx
index b0c9e16cc4dc..47113ffc5956 100644
--- a/src/plugins/embeddable/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
@@ -48,8 +48,7 @@ beforeEach(async () => {
() => [] as any,
start.overlays,
start.notifications,
- start.uiSettings,
- start.savedObjects
+ () => null
);
const derivedFilter: esFilters.Filter = {
@@ -84,8 +83,7 @@ test('Is not compatible when container is in view mode', async () => {
() => [] as any,
start.overlays,
start.notifications,
- start.uiSettings,
- start.savedObjects
+ () => null
);
container.updateInput({ viewMode: ViewMode.VIEW });
expect(await addPanelAction.isCompatible({ embeddable: container })).toBe(false);
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 e4a1929ad815..9ecc4686c21b 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 { CoreStart, NotificationsStart, OverlayStart } from 'src/core/public';
+import { NotificationsStart, OverlayStart } from 'src/core/public';
import { ViewMode, GetEmbeddableFactory, GetEmbeddableFactories } from '../../../../types';
import { openAddPanelFlyout } from './open_add_panel_flyout';
import { IContainer } from '../../../../containers';
@@ -38,8 +38,7 @@ export class AddPanelAction implements IAction {
private readonly getAllFactories: GetEmbeddableFactories,
private readonly overlays: OverlayStart,
private readonly notifications: NotificationsStart,
- private readonly uiSettings: CoreStart['uiSettings'],
- private readonly savedObjects: CoreStart['savedObjects']
+ private readonly SavedObjectFinder: React.ComponentType
) {}
public getDisplayName() {
@@ -67,8 +66,7 @@ export class AddPanelAction implements IAction {
getAllFactories: this.getAllFactories,
overlays: this.overlays,
notifications: this.notifications,
- savedObjects: this.savedObjects,
- uiSettings: this.uiSettings,
+ SavedObjectFinder: this.SavedObjectFinder,
});
}
}
diff --git a/src/plugins/embeddable/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
index c69c25837f80..fd8f286a9d8f 100644
--- a/src/plugins/embeddable/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
@@ -63,8 +63,7 @@ test('createNewEmbeddable() add embeddable to container', async () => {
getFactory={getEmbeddableFactory}
getAllFactories={() => new Set([contactCardEmbeddableFactory]).values()}
notifications={core.notifications}
- uiSettings={core.uiSettings}
- savedObjects={core.savedObjects}
+ SavedObjectFinder={() => null}
/>
) as ReactWrapper;
@@ -109,8 +108,7 @@ test('selecting embeddable in "Create new ..." list calls createNewEmbeddable()'
getFactory={getEmbeddableFactory}
getAllFactories={() => new Set([contactCardEmbeddableFactory]).values()}
notifications={core.notifications}
- uiSettings={core.uiSettings}
- savedObjects={core.savedObjects}
+ SavedObjectFinder={() => null}
/>
) as ReactWrapper;
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 cc49e0d8777a..4f2ae7ab19bc 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, CoreStart } from 'src/core/public';
+import { CoreSetup } from 'src/core/public';
import {
EuiButton,
@@ -36,7 +36,6 @@ import {
import { IContainer } from '../../../../containers';
import { EmbeddableFactoryNotFoundError } from '../../../../errors';
import { GetEmbeddableFactories, GetEmbeddableFactory } from '../../../../types';
-import { SavedObjectFinderUi } from '../../../../../../../kibana_react/public';
interface Props {
onClose: () => void;
@@ -44,8 +43,7 @@ interface Props {
getFactory: GetEmbeddableFactory;
getAllFactories: GetEmbeddableFactories;
notifications: CoreSetup['notifications'];
- savedObjects: CoreStart['savedObjects'];
- uiSettings: CoreSetup['uiSettings'];
+ SavedObjectFinder: React.ComponentType;
}
interface State {
@@ -133,8 +131,9 @@ 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 1101f71e1d46..481693501066 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 { CoreSetup, CoreStart, NotificationsStart, OverlayStart } from 'src/core/public';
+import { NotificationsStart, OverlayStart } from 'src/core/public';
import { toMountPoint } from '../../../../../../../kibana_react/public';
import { IContainer } from '../../../../containers';
import { AddPanelFlyout } from './add_panel_flyout';
@@ -29,8 +29,7 @@ export async function openAddPanelFlyout(options: {
getAllFactories: GetEmbeddableFactories;
overlays: OverlayStart;
notifications: NotificationsStart;
- savedObjects: CoreStart['savedObjects'];
- uiSettings: CoreSetup['uiSettings'];
+ SavedObjectFinder: React.ComponentType;
}) {
const {
embeddable,
@@ -38,8 +37,7 @@ export async function openAddPanelFlyout(options: {
getAllFactories,
overlays,
notifications,
- savedObjects,
- uiSettings,
+ SavedObjectFinder,
} = options;
const flyoutSession = overlays.openFlyout(
toMountPoint(
@@ -53,8 +51,7 @@ export async function openAddPanelFlyout(options: {
getFactory={getFactory}
getAllFactories={getAllFactories}
notifications={notifications}
- savedObjects={savedObjects}
- uiSettings={uiSettings}
+ SavedObjectFinder={SavedObjectFinder}
/>
),
{
diff --git a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx
index 317df193f629..de486598470d 100644
--- a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx
+++ b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container.tsx
@@ -50,9 +50,8 @@ interface HelloWorldContainerOptions {
getAllEmbeddableFactories: GetEmbeddableFactories;
overlays: CoreStart['overlays'];
notifications: CoreStart['notifications'];
- uiSettings: CoreStart['uiSettings'];
- savedObjects: CoreStart['savedObjects'];
inspector: InspectorStartContract;
+ SavedObjectFinder: React.ComponentType;
}
export class HelloWorldContainer extends Container {
@@ -84,8 +83,7 @@ export class HelloWorldContainer extends Container
,
node
diff --git a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container_component.tsx b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container_component.tsx
index 8cd30cde42f9..7c0e09eff1d5 100644
--- a/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container_component.tsx
+++ b/src/plugins/embeddable/public/lib/test_samples/embeddables/hello_world_container_component.tsx
@@ -34,8 +34,7 @@ interface Props {
overlays: CoreStart['overlays'];
notifications: CoreStart['notifications'];
inspector: InspectorStartContract;
- uiSettings: CoreStart['uiSettings'];
- savedObjects: CoreStart['savedObjects'];
+ SavedObjectFinder: React.ComponentType;
}
interface State {
@@ -113,9 +112,8 @@ export class HelloWorldContainerComponent extends Component {
getAllEmbeddableFactories={this.props.getAllEmbeddableFactories}
overlays={this.props.overlays}
notifications={this.props.notifications}
- uiSettings={this.props.uiSettings}
- savedObjects={this.props.savedObjects}
inspector={this.props.inspector}
+ SavedObjectFinder={this.props.SavedObjectFinder}
/>
);
diff --git a/src/plugins/embeddable/public/tests/apply_filter_action.test.ts b/src/plugins/embeddable/public/tests/apply_filter_action.test.ts
index 2c3299f3bc63..0721acb1a1fb 100644
--- a/src/plugins/embeddable/public/tests/apply_filter_action.test.ts
+++ b/src/plugins/embeddable/public/tests/apply_filter_action.test.ts
@@ -106,9 +106,8 @@ test('ApplyFilterAction is incompatible if the root container does not accept a
getAllEmbeddableFactories: api.getEmbeddableFactories,
overlays: coreStart.overlays,
notifications: coreStart.notifications,
- uiSettings: coreStart.uiSettings,
- savedObjects: coreStart.savedObjects,
inspector,
+ SavedObjectFinder: () => null,
}
);
@@ -147,8 +146,7 @@ test('trying to execute on incompatible context throws an error ', async () => {
overlays: coreStart.overlays,
notifications: coreStart.notifications,
inspector,
- uiSettings: coreStart.uiSettings,
- savedObjects: coreStart.savedObjects,
+ SavedObjectFinder: () => null,
}
);
diff --git a/src/plugins/embeddable/public/tests/container.test.ts b/src/plugins/embeddable/public/tests/container.test.ts
index 3385bf9354a9..f97c26a41b90 100644
--- a/src/plugins/embeddable/public/tests/container.test.ts
+++ b/src/plugins/embeddable/public/tests/container.test.ts
@@ -73,8 +73,7 @@ async function creatHelloWorldContainerAndEmbeddable(
overlays: coreStart.overlays,
notifications: coreStart.notifications,
inspector: {} as any,
- uiSettings: coreStart.uiSettings,
- savedObjects: coreStart.savedObjects,
+ SavedObjectFinder: () => null,
});
const embeddable = await container.addNewEmbeddable<
ContactCardEmbeddableInput,
@@ -147,8 +146,7 @@ test('Container.removeEmbeddable removes and cleans up', async done => {
overlays: coreStart.overlays,
notifications: coreStart.notifications,
inspector: {} as any,
- uiSettings: coreStart.uiSettings,
- savedObjects: coreStart.savedObjects,
+ SavedObjectFinder: () => null,
}
);
const embeddable = await container.addNewEmbeddable<
@@ -328,8 +326,7 @@ test(`Container updates its state when a child's input is updated`, async done =
notifications: coreStart.notifications,
overlays: coreStart.overlays,
inspector: {} as any,
- uiSettings: coreStart.uiSettings,
- savedObjects: coreStart.savedObjects,
+ SavedObjectFinder: () => null,
});
const cloneSubscription = Rx.merge(
containerClone.getOutput$(),
@@ -579,8 +576,7 @@ test('Container changes made directly after adding a new embeddable are propagat
overlays: coreStart.overlays,
notifications: coreStart.notifications,
inspector: {} as any,
- uiSettings: coreStart.uiSettings,
- savedObjects: coreStart.savedObjects,
+ SavedObjectFinder: () => null,
}
);
@@ -712,8 +708,7 @@ test('untilEmbeddableLoaded() throws an error if there is no such child panel in
overlays: coreStart.overlays,
notifications: coreStart.notifications,
inspector: {} as any,
- uiSettings: coreStart.uiSettings,
- savedObjects: coreStart.savedObjects,
+ SavedObjectFinder: () => null,
}
);
@@ -747,8 +742,7 @@ test('untilEmbeddableLoaded() resolves if child is loaded in the container', asy
overlays: coreStart.overlays,
notifications: coreStart.notifications,
inspector: {} as any,
- uiSettings: coreStart.uiSettings,
- savedObjects: coreStart.savedObjects,
+ SavedObjectFinder: () => null,
}
);
@@ -786,8 +780,7 @@ test('untilEmbeddableLoaded resolves with undefined if child is subsequently rem
overlays: coreStart.overlays,
notifications: coreStart.notifications,
inspector: {} as any,
- uiSettings: coreStart.uiSettings,
- savedObjects: coreStart.savedObjects,
+ SavedObjectFinder: () => null,
}
);
@@ -827,8 +820,7 @@ test('adding a panel then subsequently removing it before its loaded removes the
overlays: coreStart.overlays,
notifications: coreStart.notifications,
inspector: {} as any,
- uiSettings: coreStart.uiSettings,
- savedObjects: coreStart.savedObjects,
+ SavedObjectFinder: () => null,
}
);
diff --git a/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx b/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx
index a1b85384d9b6..70d7c99d3fb9 100644
--- a/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx
+++ b/src/plugins/embeddable/public/tests/customize_panel_modal.test.tsx
@@ -65,8 +65,7 @@ beforeEach(async () => {
overlays: coreStart.overlays,
notifications: coreStart.notifications,
inspector: {} as any,
- uiSettings: coreStart.uiSettings,
- savedObjects: coreStart.savedObjects,
+ SavedObjectFinder: () => null,
}
);
const contactCardEmbeddable = await container.addNewEmbeddable<
diff --git a/src/plugins/embeddable/public/tests/explicit_input.test.ts b/src/plugins/embeddable/public/tests/explicit_input.test.ts
index a7fbc4c96b69..47c4b0944cef 100644
--- a/src/plugins/embeddable/public/tests/explicit_input.test.ts
+++ b/src/plugins/embeddable/public/tests/explicit_input.test.ts
@@ -86,8 +86,7 @@ test('Explicit embeddable input mapped to undefined with no inherited value will
notifications: coreStart.notifications,
overlays: coreStart.overlays,
inspector: {} as any,
- uiSettings: coreStart.uiSettings,
- savedObjects: coreStart.savedObjects,
+ SavedObjectFinder: () => null,
}
);
@@ -135,8 +134,7 @@ test('Explicit input tests in async situations', (done: () => void) => {
notifications: coreStart.notifications,
overlays: coreStart.overlays,
inspector: {} as any,
- uiSettings: coreStart.uiSettings,
- savedObjects: coreStart.savedObjects,
+ SavedObjectFinder: () => null,
}
);
diff --git a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/app.tsx b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/app.tsx
index 1c8cbde56685..c0ed2b027f0e 100644
--- a/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/app.tsx
+++ b/test/plugin_functional/plugins/kbn_tp_embeddable_explorer/public/np_ready/public/app/app.tsx
@@ -36,8 +36,7 @@ export interface AppProps {
overlays: CoreStart['overlays'];
notifications: CoreStart['notifications'];
inspector: InspectorStartContract;
- uiSettings: CoreStart['uiSettings'];
- savedObjects: CoreStart['savedObjects'];
+ SavedObjectFinder: React.ComponentType;
I18nContext: CoreStart['i18n']['Context'];
}
@@ -106,8 +105,7 @@ export class App extends Component {
overlays={this.props.overlays}
notifications={this.props.notifications}
inspector={this.props.inspector}
- uiSettings={this.props.uiSettings}
- savedObjects={this.props.savedObjects}
+ SavedObjectFinder={this.props.SavedObjectFinder}
/>
);
}
@@ -120,8 +118,7 @@ export class App extends Component {
overlays={this.props.overlays}
notifications={this.props.notifications}
inspector={this.props.inspector}
- uiSettings={this.props.uiSettings}
- savedObjects={this.props.savedObjects}
+ SavedObjectFinder={this.props.SavedObjectFinder}
/>
);
}
@@ -134,8 +131,7 @@ export class App extends Component {
overlays={this.props.overlays}
notifications={this.props.notifications}
inspector={this.props.inspector}
- uiSettings={this.props.uiSettings}
- savedObjects={this.props.savedObjects}
+ SavedObjectFinder={this.props.SavedObjectFinder}
/>
);
}
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 d8a569d367bc..5cfaa1c22f4e 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
@@ -43,9 +43,8 @@ interface Props {
getAllEmbeddableFactories: GetEmbeddableFactories;
overlays: CoreStart['overlays'];
notifications: CoreStart['notifications'];
- uiSettings: CoreStart['uiSettings'];
- savedObjects: CoreStart['savedObjects'];
inspector: InspectorStartContract;
+ SavedObjectFinder: React.ComponentType;
}
interface State {
@@ -115,8 +114,7 @@ export class DashboardContainerExample extends React.Component {
overlays={this.props.overlays}
notifications={this.props.notifications}
inspector={this.props.inspector}
- uiSettings={this.props.uiSettings}
- savedObjects={this.props.savedObjects}
+ SavedObjectFinder={this.props.SavedObjectFinder}
/>
)}
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 45b36d3a2771..efd700552ec3 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
@@ -41,8 +41,7 @@ interface Props {
overlays: CoreStart['overlays'];
notifications: CoreStart['notifications'];
inspector: InspectorStartContract;
- uiSettings: CoreStart['uiSettings'];
- savedObjects: CoreStart['savedObjects'];
+ SavedObjectFinder: React.ComponentType;
}
export class HelloWorldContainerExample extends React.Component {
@@ -81,8 +80,7 @@ export class HelloWorldContainerExample extends React.Component
);
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 4f1456f136c0..78b122cb1baf 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
@@ -35,8 +35,7 @@ interface Props {
overlays: CoreStart['overlays'];
notifications: CoreStart['notifications'];
inspector: InspectorStartContract;
- uiSettings: CoreStart['uiSettings'];
- savedObjects: CoreStart['savedObjects'];
+ SavedObjectFinder: React.ComponentType;
}
export class ContactCardEmbeddableExample extends React.Component {
@@ -65,8 +64,7 @@ export class ContactCardEmbeddableExample extends React.Component {
overlays={this.props.overlays}
notifications={this.props.notifications}
inspector={this.props.inspector}
- uiSettings={this.props.uiSettings}
- savedObjects={this.props.savedObjects}
+ SavedObjectFinder={this.props.SavedObjectFinder}
/>
);
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 8cf74dbdf8a5..adf898d9af2c 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,10 @@ import {
ContactCardEmbeddableFactory,
} from './embeddable_api';
import { App } from './app';
+import {
+ SavedObjectFinderProps,
+ SavedObjectFinderUi,
+} from '../../../../../../../src/plugins/kibana_react/public/saved_objects';
import {
IEmbeddableStart,
IEmbeddableSetup,
@@ -97,6 +101,13 @@ export class EmbeddableExplorerPublicPlugin
plugins.__LEGACY.onRenderComplete(() => {
const root = document.getElementById(REACT_ROOT_ID);
+ const SavedObjectFinder = (props: SavedObjectFinderProps) => (
+
+ );
ReactDOM.render(
,
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 e24b438bb9d4..5c7ef1a8c179 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
@@ -17,6 +17,10 @@ import {
import { start } from '../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/legacy';
import { EmbeddableExpression } from '../expression_types/embeddable';
import { RendererStrings } from '../../i18n';
+import {
+ SavedObjectFinderProps,
+ SavedObjectFinderUi,
+} from '../../../../../../src/plugins/kibana_react/public';
const { embeddable: strings } = RendererStrings;
@@ -33,6 +37,13 @@ interface Handlers {
}
const renderEmbeddable = (embeddableObject: IEmbeddable, domNode: HTMLElement) => {
+ const SavedObjectFinder = (props: SavedObjectFinderProps) => (
+
+ );
return (
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 7f0e98caa984..1658002408fb 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
@@ -28,6 +28,10 @@ import { MapToolTip } from './map_tool_tip/map_tool_tip';
import * as i18n from './translations';
import { MapEmbeddable, SetQuery } from './types';
import { Query, esFilters } from '../../../../../../../src/plugins/data/public';
+import {
+ SavedObjectFinderProps,
+ SavedObjectFinderUi,
+} from '../../../../../../../src/plugins/kibana_react/public';
interface EmbeddableMapProps {
maintainRatio?: boolean;
@@ -175,6 +179,10 @@ export const EmbeddedMapComponent = ({
}
}, [startDate, endDate]);
+ const SavedObjectFinder = (props: SavedObjectFinderProps) => (
+
+ );
+
return isError ? null : (
@@ -201,10 +209,9 @@ 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 ? (