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 f096deffde216..33471e172c589 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 @@ -106,5 +106,5 @@ test('Returns title', async () => { test('Returns an icon', async () => { const action = new ExpandPanelAction(); - expect(action.getIcon({ embeddable })).toBeDefined(); + expect(action.getIconType({ embeddable })).toBeDefined(); }); diff --git a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/actions/expand_panel_action.tsx b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/actions/expand_panel_action.tsx index b2f8dcd7fea7d..273234cf8d8d5 100644 --- a/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/actions/expand_panel_action.tsx +++ b/src/legacy/core_plugins/dashboard_embeddable_container/public/np_ready/public/lib/actions/expand_panel_action.tsx @@ -17,9 +17,7 @@ * under the License. */ -import { EuiIcon } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; -import React from 'react'; import { Action, IEmbeddable, @@ -70,12 +68,12 @@ export class ExpandPanelAction extends Action { ); } - public getIcon({ embeddable }: ActionContext) { + public getIconType({ embeddable }: ActionContext) { if (!embeddable.parent || !isDashboard(embeddable.parent)) { throw new IncompatibleActionError(); } // TODO: use 'minimize' when an eui-icon of such is available. - return ; + return isExpanded(embeddable) ? 'expand' : 'expand'; } public async isCompatible({ embeddable }: ActionContext) { diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/action.ts b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/action.ts index d1d152b6f7c38..1002915de1d93 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/action.ts +++ b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/action.ts @@ -17,8 +17,6 @@ * under the License. */ -import { EuiContextMenuItemIcon } from '@elastic/eui'; - import { IEmbeddable } from '../embeddables'; export interface ActionContext< @@ -43,11 +41,9 @@ export abstract class Action< constructor(public readonly id: string) {} /** - * Optional icon that can be displayed along with the title. + * Optional EUI icon type that can be displayed along with the title. */ - public getIcon( - context: ActionContext - ): EuiContextMenuItemIcon | undefined { + public getIconType(context: ActionContext): string | undefined { return undefined; } diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/edit_panel_action.tsx b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/edit_panel_action.ts similarity index 94% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/edit_panel_action.tsx rename to src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/edit_panel_action.ts index 2e8e3f24f2b5c..5edd82bd14a37 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/edit_panel_action.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/actions/edit_panel_action.ts @@ -17,9 +17,7 @@ * under the License. */ -import React from 'react'; import { i18n } from '@kbn/i18n'; -import { EuiIcon } from '@elastic/eui'; import { Action, ActionContext } from './action'; import { GetEmbeddableFactory, ViewMode } from '../types'; import { EmbeddableFactoryNotFoundError } from '../errors'; @@ -46,8 +44,8 @@ export class EditPanelAction extends Action { }); } - getIcon() { - return ; + getIconType() { + return 'pencil'; } public async isCompatible({ embeddable }: ActionContext) { diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/context_menu_actions/build_eui_context_menu_panels.ts b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/context_menu_actions/build_eui_context_menu_panels.ts index 283ca4cf13002..b51a40a3ef2d9 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/context_menu_actions/build_eui_context_menu_panels.ts +++ b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/context_menu_actions/build_eui_context_menu_panels.ts @@ -99,7 +99,7 @@ function convertPanelActionToContextMenuItem({ }): EuiContextMenuPanelItemDescriptor { const menuPanelItem: EuiContextMenuPanelItemDescriptor = { name: action.getDisplayName(actionContext), - icon: action.getIcon(actionContext), + icon: action.getIconType(actionContext), panel: _.get(action, 'childContextMenuPanel.id'), 'data-test-subj': `embeddablePanelAction-${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_action.test.tsx b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.test.tsx index a4dd2098bc76d..441632e509bab 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/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.test.tsx @@ -125,5 +125,5 @@ test('Returns title', async () => { }); test('Returns an icon', async () => { - expect(action.getIcon()).toBeDefined(); + expect(action.getIconType()).toBeDefined(); }); diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.tsx b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.ts similarity index 94% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.tsx rename to src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.ts index 7696ce6d01543..c440e3dff699c 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/add_panel/add_panel_action.ts @@ -16,10 +16,6 @@ * specific language governing permissions and limitations * under the License. */ - -import { EuiIcon } from '@elastic/eui'; -import React from 'react'; - import { i18n } from '@kbn/i18n'; import { ViewMode, GetEmbeddableFactory, GetEmbeddableFactories } from '../../../../types'; import { Action, ActionContext } from '../../../../actions'; @@ -47,8 +43,8 @@ export class AddPanelAction extends Action { }); } - public getIcon() { - return ; + public getIconType() { + return 'plusInCircleFilled'; } public async isCompatible({ embeddable }: ActionContext) { diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.tsx b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.ts similarity index 93% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.tsx rename to src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.ts index e682d5c75df9e..51001de0fefb5 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/customize_title/customize_panel_action.ts @@ -17,8 +17,6 @@ * under the License. */ -import { EuiIcon } from '@elastic/eui'; -import React from 'react'; import { i18n } from '@kbn/i18n'; import { Action, ActionContext } from '../../../../actions'; import { ViewMode } from '../../../../types'; @@ -41,8 +39,8 @@ export class CustomizePanelTitleAction extends Action { }); } - public getIcon() { - return ; + public getIconType() { + return 'pencil'; } public async isCompatible({ embeddable }: ActionContext) { 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/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/inspect_panel_action.test.tsx index f17dd85314902..362b7e5fe5443 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/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/inspect_panel_action.test.tsx @@ -155,9 +155,5 @@ test('Returns title', async () => { test('Returns an icon', async () => { const inspector = inspectorPluginMock.createStartContract(); const inspectAction = new InspectPanelAction(inspector); - expect(inspectAction.getIcon()).toMatchInlineSnapshot(` - - `); + expect(inspectAction.getIconType()).toBe('inspect'); }); diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/inspect_panel_action.tsx b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/inspect_panel_action.ts similarity index 95% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/inspect_panel_action.tsx rename to src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/inspect_panel_action.ts index 01eb275aa2122..06ba48a5e23b2 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/inspect_panel_action.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/inspect_panel_action.ts @@ -17,8 +17,6 @@ * under the License. */ -import { EuiIcon } from '@elastic/eui'; -import React from 'react'; import { i18n } from '@kbn/i18n'; import { Action, ActionContext } from '../../../actions'; import { Start as InspectorStartContract } from '../../../../../../../../../../plugins/inspector/public'; @@ -39,8 +37,8 @@ export class InspectPanelAction extends Action { }); } - public getIcon() { - return ; + public getIconType() { + return 'inspect'; } public async isCompatible({ embeddable }: ActionContext) { 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/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/remove_panel_action.test.tsx index 45d20b3a935a8..6421f4e85730c 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/remove_panel_action.test.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/remove_panel_action.test.tsx @@ -102,7 +102,7 @@ test('Returns title', async () => { expect(action.getDisplayName()).toBeDefined(); }); -test('Returns an icon', async () => { +test('Returns an icon type', async () => { const action = new RemovePanelAction(); - expect(action.getIcon()).toBeDefined(); + expect(action.getIconType()).toBeDefined(); }); diff --git a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/remove_panel_action.tsx b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/remove_panel_action.ts similarity index 94% rename from src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/remove_panel_action.tsx rename to src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/remove_panel_action.ts index 3aa0bfa6529b5..fbea36e35f53d 100644 --- a/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/remove_panel_action.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/panel/panel_header/panel_actions/remove_panel_action.ts @@ -16,9 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import React from 'react'; import { i18n } from '@kbn/i18n'; -import { EuiIcon } from '@elastic/eui'; import { ContainerInput, IContainer } from '../../../containers'; import { ViewMode } from '../../../types'; import { Action, ActionContext } from '../../../actions'; @@ -50,8 +48,8 @@ export class RemovePanelAction extends Action { }); } - public getIcon() { - return ; + public getIconType() { + return 'trash'; } public async isCompatible({ embeddable }: ActionContext) {