From f33192d35f9d491b17ca364b84d02865f8d1beeb Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Thu, 18 Jun 2020 15:35:22 +0200 Subject: [PATCH] [refactor] remove drilldown plugin, move components to uiActionsEnhanced (#69403) * refactor: remove drilldown plugin by moving components to uiActionsEnhanced * fix * fix mistake in test * fix i18n --- src/dev/storybook/aliases.ts | 1 - .../lib/panel/panel_header/panel_header.tsx | 2 +- x-pack/.i18nrc.json | 1 - x-pack/plugins/dashboard_enhanced/kibana.json | 2 +- .../dashboard_enhanced/public/plugin.ts | 3 - .../flyout_create_drilldown.test.tsx | 6 +- .../flyout_create_drilldown.tsx | 4 +- .../flyout_edit_drilldown.test.tsx | 4 +- .../flyout_edit_drilldown.tsx | 4 +- x-pack/plugins/drilldowns/README.md | 3 - x-pack/plugins/drilldowns/kibana.json | 8 --- .../public/components/flyout_frame/i18n.ts | 15 ----- x-pack/plugins/drilldowns/public/index.ts | 18 ------ x-pack/plugins/drilldowns/public/mocks.ts | 30 ---------- x-pack/plugins/drilldowns/public/plugin.ts | 48 ---------------- .../translations/translations/ja-JP.json | 42 +++++++------- .../translations/translations/zh-CN.json | 42 +++++++------- ...nnected_flyout_manage_drilldowns.story.tsx | 29 ++++------ ...onnected_flyout_manage_drilldowns.test.tsx | 34 +++++------- .../connected_flyout_manage_drilldowns.tsx | 55 ++++++++----------- .../i18n.ts | 31 ++++++----- .../index.ts | 0 .../test_data.ts | 6 +- .../drilldown_hello_bar.story.tsx | 2 +- .../drilldown_hello_bar.tsx | 0 .../components/drilldown_hello_bar/i18n.ts | 6 +- .../components/drilldown_hello_bar/index.tsx | 0 .../flyout_drilldown_wizard.story.tsx | 6 +- .../flyout_drilldown_wizard.tsx | 2 +- .../flyout_drilldown_wizard/i18n.ts | 10 ++-- .../flyout_drilldown_wizard/index.ts | 0 .../flyout_frame/flyout_frame.story.tsx | 2 +- .../flyout_frame/flyout_frame.test.tsx | 2 +- .../components/flyout_frame/flyout_frame.tsx | 0 .../components/flyout_frame/i18n.ts | 21 +++++++ .../components/flyout_frame/index.tsx | 0 .../flyout_list_manage_drilldowns.story.tsx | 0 .../flyout_list_manage_drilldowns.tsx | 0 .../flyout_list_manage_drilldowns/i18n.ts | 2 +- .../flyout_list_manage_drilldowns/index.ts | 0 .../form_drilldown_wizard.story.tsx | 2 +- .../form_drilldown_wizard.test.tsx | 0 .../form_drilldown_wizard.tsx | 6 +- .../components/form_drilldown_wizard/i18n.ts | 6 +- .../form_drilldown_wizard/index.tsx | 0 .../public/drilldowns/components/index.ts} | 8 +-- .../components/list_manage_drilldowns/i18n.ts | 21 ++++--- .../list_manage_drilldowns/index.tsx | 0 .../list_manage_drilldowns.story.tsx | 0 .../list_manage_drilldowns.test.tsx | 0 .../list_manage_drilldowns.tsx | 0 .../public/drilldowns/index.ts | 1 + .../ui_actions_enhanced/public/mocks.ts | 1 + .../ui_actions_enhanced/public/plugin.ts | 13 ++++- .../ui_actions_enhanced/scripts/storybook.js | 5 +- 55 files changed, 194 insertions(+), 310 deletions(-) delete mode 100644 x-pack/plugins/drilldowns/README.md delete mode 100644 x-pack/plugins/drilldowns/kibana.json delete mode 100644 x-pack/plugins/drilldowns/public/components/flyout_frame/i18n.ts delete mode 100644 x-pack/plugins/drilldowns/public/index.ts delete mode 100644 x-pack/plugins/drilldowns/public/mocks.ts delete mode 100644 x-pack/plugins/drilldowns/public/plugin.ts rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.story.tsx (62%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.test.tsx (89%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx (86%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/connected_flyout_manage_drilldowns/i18n.ts (61%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/connected_flyout_manage_drilldowns/index.ts (100%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/connected_flyout_manage_drilldowns/test_data.ts (90%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/drilldown_hello_bar/drilldown_hello_bar.story.tsx (93%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/drilldown_hello_bar/drilldown_hello_bar.tsx (100%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/drilldown_hello_bar/i18n.ts (73%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/drilldown_hello_bar/index.tsx (100%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/flyout_drilldown_wizard/flyout_drilldown_wizard.story.tsx (90%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/flyout_drilldown_wizard/flyout_drilldown_wizard.tsx (98%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/flyout_drilldown_wizard/i18n.ts (62%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/flyout_drilldown_wizard/index.ts (100%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/flyout_frame/flyout_frame.story.tsx (97%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/flyout_frame/flyout_frame.test.tsx (98%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/flyout_frame/flyout_frame.tsx (100%) create mode 100644 x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_frame/i18n.ts rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/flyout_frame/index.tsx (100%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/flyout_list_manage_drilldowns/flyout_list_manage_drilldowns.story.tsx (100%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/flyout_list_manage_drilldowns/flyout_list_manage_drilldowns.tsx (100%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/flyout_list_manage_drilldowns/i18n.ts (79%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/flyout_list_manage_drilldowns/index.ts (100%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/form_drilldown_wizard/form_drilldown_wizard.story.tsx (94%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/form_drilldown_wizard/form_drilldown_wizard.test.tsx (100%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/form_drilldown_wizard/form_drilldown_wizard.tsx (94%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/form_drilldown_wizard/i18n.ts (68%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/form_drilldown_wizard/index.tsx (100%) rename x-pack/plugins/{drilldowns/scripts/storybook.js => ui_actions_enhanced/public/drilldowns/components/index.ts} (53%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/list_manage_drilldowns/i18n.ts (54%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/list_manage_drilldowns/index.tsx (100%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/list_manage_drilldowns/list_manage_drilldowns.story.tsx (100%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/list_manage_drilldowns/list_manage_drilldowns.test.tsx (100%) rename x-pack/plugins/{drilldowns/public => ui_actions_enhanced/public/drilldowns}/components/list_manage_drilldowns/list_manage_drilldowns.tsx (100%) diff --git a/src/dev/storybook/aliases.ts b/src/dev/storybook/aliases.ts index 2f785896da8d5..85bfd4a7a4d26 100644 --- a/src/dev/storybook/aliases.ts +++ b/src/dev/storybook/aliases.ts @@ -22,7 +22,6 @@ export const storybookAliases = { canvas: 'x-pack/plugins/canvas/scripts/storybook_new.js', codeeditor: 'src/plugins/kibana_react/public/code_editor/scripts/storybook.ts', dashboard_enhanced: 'x-pack/plugins/dashboard_enhanced/scripts/storybook.js', - drilldowns: 'x-pack/plugins/drilldowns/scripts/storybook.js', embeddable: 'src/plugins/embeddable/scripts/storybook.js', infra: 'x-pack/legacy/plugins/infra/scripts/storybook.js', security_solution: 'x-pack/plugins/security_solution/scripts/storybook.js', diff --git a/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx b/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx index 8ba7be7880a7b..7b66f29cc2726 100644 --- a/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx +++ b/src/plugins/embeddable/public/lib/panel/panel_header/panel_header.tsx @@ -81,7 +81,7 @@ function renderNotifications( if (tooltip) { badge = ( - + {badge} ); diff --git a/x-pack/.i18nrc.json b/x-pack/.i18nrc.json index 21b2df3ba12f8..278968cb47231 100644 --- a/x-pack/.i18nrc.json +++ b/x-pack/.i18nrc.json @@ -13,7 +13,6 @@ "xpack.crossClusterReplication": "plugins/cross_cluster_replication", "xpack.dashboardMode": "legacy/plugins/dashboard_mode", "xpack.data": "plugins/data_enhanced", - "xpack.drilldowns": "plugins/drilldowns", "xpack.embeddableEnhanced": "plugins/embeddable_enhanced", "xpack.endpoint": "plugins/endpoint", "xpack.features": "plugins/features", diff --git a/x-pack/plugins/dashboard_enhanced/kibana.json b/x-pack/plugins/dashboard_enhanced/kibana.json index 37211ea537179..3a95419d2f2fe 100644 --- a/x-pack/plugins/dashboard_enhanced/kibana.json +++ b/x-pack/plugins/dashboard_enhanced/kibana.json @@ -3,6 +3,6 @@ "version": "kibana", "server": false, "ui": true, - "requiredPlugins": ["data", "uiActionsEnhanced", "drilldowns", "embeddable", "dashboard", "share"], + "requiredPlugins": ["data", "uiActionsEnhanced", "embeddable", "dashboard", "share"], "configPath": ["xpack", "dashboardEnhanced"] } diff --git a/x-pack/plugins/dashboard_enhanced/public/plugin.ts b/x-pack/plugins/dashboard_enhanced/public/plugin.ts index 413f5a7afe356..854a4964ffe15 100644 --- a/x-pack/plugins/dashboard_enhanced/public/plugin.ts +++ b/x-pack/plugins/dashboard_enhanced/public/plugin.ts @@ -10,12 +10,10 @@ import { EmbeddableSetup, EmbeddableStart } from '../../../../src/plugins/embedd import { DashboardDrilldownsService } from './services'; import { DataPublicPluginStart } from '../../../../src/plugins/data/public'; import { AdvancedUiActionsSetup, AdvancedUiActionsStart } from '../../ui_actions_enhanced/public'; -import { DrilldownsSetup, DrilldownsStart } from '../../drilldowns/public'; import { DashboardStart } from '../../../../src/plugins/dashboard/public'; export interface SetupDependencies { uiActionsEnhanced: AdvancedUiActionsSetup; - drilldowns: DrilldownsSetup; embeddable: EmbeddableSetup; share: SharePluginSetup; } @@ -23,7 +21,6 @@ export interface SetupDependencies { export interface StartDependencies { uiActionsEnhanced: AdvancedUiActionsStart; data: DataPublicPluginStart; - drilldowns: DrilldownsStart; embeddable: EmbeddableStart; share: SharePluginStart; dashboard: DashboardStart; diff --git a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_create_drilldown/flyout_create_drilldown.test.tsx b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_create_drilldown/flyout_create_drilldown.test.tsx index 5ec1b881317d6..712a46dc32e08 100644 --- a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_create_drilldown/flyout_create_drilldown.test.tsx +++ b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_create_drilldown/flyout_create_drilldown.test.tsx @@ -9,13 +9,13 @@ import { OpenFlyoutAddDrilldownParams, } from './flyout_create_drilldown'; import { coreMock } from '../../../../../../../../src/core/public/mocks'; -import { drilldownsPluginMock } from '../../../../../../drilldowns/public/mocks'; import { ViewMode } from '../../../../../../../../src/plugins/embeddable/public'; import { TriggerContextMapping } from '../../../../../../../../src/plugins/ui_actions/public'; import { MockEmbeddable, enhanceEmbeddable } from '../test_helpers'; +import { uiActionsEnhancedPluginMock } from '../../../../../../ui_actions_enhanced/public/mocks'; const overlays = coreMock.createStart().overlays; -const drilldowns = drilldownsPluginMock.createStartContract(); +const uiActionsEnhanced = uiActionsEnhancedPluginMock.createStartContract(); const actionParams: OpenFlyoutAddDrilldownParams = { start: () => ({ @@ -23,7 +23,7 @@ const actionParams: OpenFlyoutAddDrilldownParams = { overlays, } as any, plugins: { - drilldowns, + uiActionsEnhanced, }, self: {}, }), diff --git a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_create_drilldown/flyout_create_drilldown.tsx b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_create_drilldown/flyout_create_drilldown.tsx index 326cd551c7f84..4804a700c6cff 100644 --- a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_create_drilldown/flyout_create_drilldown.tsx +++ b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_create_drilldown/flyout_create_drilldown.tsx @@ -16,7 +16,7 @@ import { StartServicesGetter } from '../../../../../../../../src/plugins/kibana_ export const OPEN_FLYOUT_ADD_DRILLDOWN = 'OPEN_FLYOUT_ADD_DRILLDOWN'; export interface OpenFlyoutAddDrilldownParams { - start: StartServicesGetter>; + start: StartServicesGetter>; } export class FlyoutCreateDrilldownAction implements ActionByType { @@ -62,7 +62,7 @@ export class FlyoutCreateDrilldownAction implements ActionByType handle.close()} viewMode={'create'} dynamicActionManager={embeddable.enhancements.dynamicActions} diff --git a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_edit_drilldown/flyout_edit_drilldown.test.tsx b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_edit_drilldown/flyout_edit_drilldown.test.tsx index 309e6cbf53a3d..b9ae45c2853c3 100644 --- a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_edit_drilldown/flyout_edit_drilldown.test.tsx +++ b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_edit_drilldown/flyout_edit_drilldown.test.tsx @@ -6,14 +6,12 @@ import { FlyoutEditDrilldownAction, FlyoutEditDrilldownParams } from './flyout_edit_drilldown'; import { coreMock } from '../../../../../../../../src/core/public/mocks'; -import { drilldownsPluginMock } from '../../../../../../drilldowns/public/mocks'; import { ViewMode } from '../../../../../../../../src/plugins/embeddable/public'; import { uiActionsEnhancedPluginMock } from '../../../../../../ui_actions_enhanced/public/mocks'; import { EnhancedEmbeddable } from '../../../../../../embeddable_enhanced/public'; import { MockEmbeddable, enhanceEmbeddable } from '../test_helpers'; const overlays = coreMock.createStart().overlays; -const drilldowns = drilldownsPluginMock.createStartContract(); const uiActionsPlugin = uiActionsEnhancedPluginMock.createPlugin(); const uiActions = uiActionsPlugin.doStart(); @@ -32,7 +30,7 @@ const actionParams: FlyoutEditDrilldownParams = { overlays, } as any, plugins: { - drilldowns, + uiActionsEnhanced: uiActions, }, self: {}, }), diff --git a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_edit_drilldown/flyout_edit_drilldown.tsx b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_edit_drilldown/flyout_edit_drilldown.tsx index 5d2a90fdaff08..af1ae67454463 100644 --- a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_edit_drilldown/flyout_edit_drilldown.tsx +++ b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_edit_drilldown/flyout_edit_drilldown.tsx @@ -20,7 +20,7 @@ import { StartServicesGetter } from '../../../../../../../../src/plugins/kibana_ export const OPEN_FLYOUT_EDIT_DRILLDOWN = 'OPEN_FLYOUT_EDIT_DRILLDOWN'; export interface FlyoutEditDrilldownParams { - start: StartServicesGetter>; + start: StartServicesGetter>; } export class FlyoutEditDrilldownAction implements ActionByType { @@ -58,7 +58,7 @@ export class FlyoutEditDrilldownAction implements ActionByType handle.close()} viewMode={'manage'} dynamicActionManager={embeddable.enhancements.dynamicActions} diff --git a/x-pack/plugins/drilldowns/README.md b/x-pack/plugins/drilldowns/README.md deleted file mode 100644 index 701b6082d4985..0000000000000 --- a/x-pack/plugins/drilldowns/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# Drilldowns - -Provides functionality to navigate between Kibana apps with context information. diff --git a/x-pack/plugins/drilldowns/kibana.json b/x-pack/plugins/drilldowns/kibana.json deleted file mode 100644 index 1614f94b488fd..0000000000000 --- a/x-pack/plugins/drilldowns/kibana.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "id": "drilldowns", - "version": "kibana", - "server": false, - "ui": true, - "requiredPlugins": ["uiActions", "embeddable", "uiActionsEnhanced"], - "configPath": ["xpack", "drilldowns"] -} diff --git a/x-pack/plugins/drilldowns/public/components/flyout_frame/i18n.ts b/x-pack/plugins/drilldowns/public/components/flyout_frame/i18n.ts deleted file mode 100644 index 23af89ebf9bc7..0000000000000 --- a/x-pack/plugins/drilldowns/public/components/flyout_frame/i18n.ts +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { i18n } from '@kbn/i18n'; - -export const txtClose = i18n.translate('xpack.drilldowns.components.FlyoutFrame.CloseButtonLabel', { - defaultMessage: 'Close', -}); - -export const txtBack = i18n.translate('xpack.drilldowns.components.FlyoutFrame.BackButtonLabel', { - defaultMessage: 'Back', -}); diff --git a/x-pack/plugins/drilldowns/public/index.ts b/x-pack/plugins/drilldowns/public/index.ts deleted file mode 100644 index f976356822dce..0000000000000 --- a/x-pack/plugins/drilldowns/public/index.ts +++ /dev/null @@ -1,18 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { DrilldownsPlugin } from './plugin'; - -export { - SetupContract as DrilldownsSetup, - SetupDependencies as DrilldownsSetupDependencies, - StartContract as DrilldownsStart, - StartDependencies as DrilldownsStartDependencies, -} from './plugin'; - -export function plugin() { - return new DrilldownsPlugin(); -} diff --git a/x-pack/plugins/drilldowns/public/mocks.ts b/x-pack/plugins/drilldowns/public/mocks.ts deleted file mode 100644 index 18816243a3572..0000000000000 --- a/x-pack/plugins/drilldowns/public/mocks.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { DrilldownsSetup, DrilldownsStart } from '.'; - -export type Setup = jest.Mocked; -export type Start = jest.Mocked; - -const createSetupContract = (): Setup => { - const setupContract: Setup = { - registerDrilldown: jest.fn(), - }; - return setupContract; -}; - -const createStartContract = (): Start => { - const startContract: Start = { - FlyoutManageDrilldowns: jest.fn(), - }; - - return startContract; -}; - -export const drilldownsPluginMock = { - createSetupContract, - createStartContract, -}; diff --git a/x-pack/plugins/drilldowns/public/plugin.ts b/x-pack/plugins/drilldowns/public/plugin.ts deleted file mode 100644 index 2805e2b747934..0000000000000 --- a/x-pack/plugins/drilldowns/public/plugin.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { CoreStart, CoreSetup, Plugin } from 'src/core/public'; -import { UiActionsSetup, UiActionsStart } from '../../../../src/plugins/ui_actions/public'; -import { AdvancedUiActionsSetup, AdvancedUiActionsStart } from '../../ui_actions_enhanced/public'; -import { createFlyoutManageDrilldowns } from './components/connected_flyout_manage_drilldowns'; -import { Storage } from '../../../../src/plugins/kibana_utils/public'; - -export interface SetupDependencies { - uiActions: UiActionsSetup; - uiActionsEnhanced: AdvancedUiActionsSetup; -} - -export interface StartDependencies { - uiActions: UiActionsStart; - uiActionsEnhanced: AdvancedUiActionsStart; -} - -// eslint-disable-next-line -export interface SetupContract {} - -export interface StartContract { - FlyoutManageDrilldowns: ReturnType; -} - -export class DrilldownsPlugin - implements Plugin { - public setup(core: CoreSetup, plugins: SetupDependencies): SetupContract { - return {}; - } - - public start(core: CoreStart, plugins: StartDependencies): StartContract { - return { - FlyoutManageDrilldowns: createFlyoutManageDrilldowns({ - uiActionsEnhanced: plugins.uiActionsEnhanced, - storage: new Storage(localStorage), - notifications: core.notifications, - docsLink: core.docLinks.links.dashboard.drilldowns, - }), - }; - } - - public stop() {} -} diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 7b887867b43b8..37cdbf5c0d8a9 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -3970,6 +3970,27 @@ "xpack.uiActionsEnhanced.customizeTimeRangeMenuItem.displayName": "時間範囲のカスタマイズ", "xpack.uiActionsEnhanced.components.DiscoverDrilldownConfig.chooseIndexPattern": "対象インデックスパターンを選択", "xpack.uiActionsEnhanced.drilldown.goToDiscover": "Discoverに移動(例)", + "xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.helpText": "ドロップダウンを使用すると、パネルを操作するときに、新しい動作を定義できます。複数のオプションを追加するか、既定のフィルタリング動作を上書きできます。", + "xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.hideHelpButtonLabel": "非表示", + "xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.viewDocsLinkLabel": "ドキュメントを表示", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.createDrilldownButtonLabel": "ドリルダウンを作成", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.createDrilldownTitle": "ドリルダウンを作成", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.deleteDrilldownButtonLabel": "ドリルダウンを削除", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.editDrilldownButtonLabel": "保存", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.editDrilldownTitle": "ドリルダウンを編集", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownDeletedText": "ドリルダウンを削除しました。", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownDeletedTitle": "ドリルダウンが削除されました", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsCRUDErrorTitle": "ドリルダウンの保存エラー", + "xpack.uiActionsEnhanced.drilldowns.components.FlyoutFrame.BackButtonLabel": "戻る", + "xpack.uiActionsEnhanced.drilldowns.components.FlyoutFrame.CloseButtonLabel": "閉じる", + "xpack.uiActionsEnhanced.drilldowns.components.FlyoutListManageDrilldowns.manageDrilldownsTitle": "ドリルダウンを管理", + "xpack.uiActionsEnhanced.drilldowns.components.FormCreateDrilldown.drilldownAction": "アクション", + "xpack.uiActionsEnhanced.drilldowns.components.FormCreateDrilldown.nameOfDrilldown": "名前", + "xpack.uiActionsEnhanced.drilldowns.components.FormCreateDrilldown.untitledDrilldown": "無題のドリルダウン", + "xpack.uiActionsEnhanced.drilldowns.components.ListManageDrilldowns.createDrilldownButtonLabel": "新規作成...", + "xpack.uiActionsEnhanced.drilldowns.components.ListManageDrilldowns.deleteDrilldownsButtonLabel": "削除({count})", + "xpack.uiActionsEnhanced.drilldowns.components.ListManageDrilldowns.editDrilldownButtonLabel": "編集", + "xpack.uiActionsEnhanced.drilldowns.components.ListManageDrilldowns.selectThisDrilldownCheckboxLabel": "このドリルダウンを選択", "xpack.alerts.alertNavigationRegistry.get.missingNavigationError": "「{consumer}」内のアラートタイプ「{alertType}」のナビゲーションは登録されていません。", "xpack.alerts.alertNavigationRegistry.register.duplicateDefaultError": "「{consumer}」内のデフォルトナビゲーションは既に登録されています。", "xpack.alerts.alertNavigationRegistry.register.duplicateNavigationError": "「{consumer}」内のアラートタイプ「{alertType}」のナビゲーションは既に登録されています。", @@ -6122,27 +6143,6 @@ "xpack.data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "1つ以上の引数", "xpack.data.query.queryBar.cancelLongQuery": "キャンセル", "xpack.data.query.queryBar.runBeyond": "タイムアウトを越えて実行", - "xpack.drilldowns.components.DrilldownHelloBar.helpText": "ドロップダウンを使用すると、パネルを操作するときに、新しい動作を定義できます。複数のオプションを追加するか、既定のフィルタリング動作を上書きできます。", - "xpack.drilldowns.components.DrilldownHelloBar.hideHelpButtonLabel": "非表示", - "xpack.drilldowns.components.DrilldownHelloBar.viewDocsLinkLabel": "ドキュメントを表示", - "xpack.drilldowns.components.flyoutDrilldownWizard.createDrilldownButtonLabel": "ドリルダウンを作成", - "xpack.drilldowns.components.flyoutDrilldownWizard.createDrilldownTitle": "ドリルダウンを作成", - "xpack.drilldowns.components.flyoutDrilldownWizard.deleteDrilldownButtonLabel": "ドリルダウンを削除", - "xpack.drilldowns.components.flyoutDrilldownWizard.editDrilldownButtonLabel": "保存", - "xpack.drilldowns.components.flyoutDrilldownWizard.editDrilldownTitle": "ドリルダウンを編集", - "xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownDeletedText": "ドリルダウンを削除しました。", - "xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownDeletedTitle": "ドリルダウンが削除されました", - "xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsCRUDErrorTitle": "ドリルダウンの保存エラー", - "xpack.drilldowns.components.FlyoutFrame.BackButtonLabel": "戻る", - "xpack.drilldowns.components.FlyoutFrame.CloseButtonLabel": "閉じる", - "xpack.drilldowns.components.FlyoutListManageDrilldowns.manageDrilldownsTitle": "ドリルダウンを管理", - "xpack.drilldowns.components.FormCreateDrilldown.drilldownAction": "アクション", - "xpack.drilldowns.components.FormCreateDrilldown.nameOfDrilldown": "名前", - "xpack.drilldowns.components.FormCreateDrilldown.untitledDrilldown": "無題のドリルダウン", - "xpack.drilldowns.components.ListManageDrilldowns.createDrilldownButtonLabel": "新規作成...", - "xpack.drilldowns.components.ListManageDrilldowns.deleteDrilldownsButtonLabel": "削除({count})", - "xpack.drilldowns.components.ListManageDrilldowns.editDrilldownButtonLabel": "編集", - "xpack.drilldowns.components.ListManageDrilldowns.selectThisDrilldownCheckboxLabel": "このドリルダウンを選択", "xpack.features.advancedSettingsFeatureName": "高度な設定", "xpack.features.dashboardFeatureName": "ダッシュボード", "xpack.features.devToolsFeatureName": "開発ツール", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index e821c4fb22899..2dfa0d40b9a8a 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -3973,6 +3973,27 @@ "xpack.uiActionsEnhanced.customizeTimeRangeMenuItem.displayName": "定制时间范围", "xpack.uiActionsEnhanced.components.DiscoverDrilldownConfig.chooseIndexPattern": "选择目标索引模式", "xpack.uiActionsEnhanced.drilldown.goToDiscover": "前往 Discover(示例)", + "xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.helpText": "向下钻取可用于定义与面板交互时的新行为。可以添加多个选项或仅覆盖默认筛选行为。", + "xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.hideHelpButtonLabel": "隐藏", + "xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.viewDocsLinkLabel": "查看文档", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.createDrilldownButtonLabel": "创建向下钻取", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.createDrilldownTitle": "创建向下钻取", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.deleteDrilldownButtonLabel": "删除向下钻取", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.editDrilldownButtonLabel": "保存", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.editDrilldownTitle": "编辑向下钻取", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownDeletedText": "您已删除向下钻取。", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownDeletedTitle": "向下钻取已删除", + "xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsCRUDErrorTitle": "保存向下钻取时出错", + "xpack.uiActionsEnhanced.drilldowns.components.FlyoutFrame.BackButtonLabel": "上一步", + "xpack.uiActionsEnhanced.drilldowns.components.FlyoutFrame.CloseButtonLabel": "关闭", + "xpack.uiActionsEnhanced.drilldowns.components.FlyoutListManageDrilldowns.manageDrilldownsTitle": "管理向下钻取", + "xpack.uiActionsEnhanced.drilldowns.components.FormCreateDrilldown.drilldownAction": "操作", + "xpack.uiActionsEnhanced.drilldowns.components.FormCreateDrilldown.nameOfDrilldown": "名称", + "xpack.uiActionsEnhanced.drilldowns.components.FormCreateDrilldown.untitledDrilldown": "未命名向下钻取", + "xpack.uiActionsEnhanced.drilldowns.components.ListManageDrilldowns.createDrilldownButtonLabel": "新建", + "xpack.uiActionsEnhanced.drilldowns.components.ListManageDrilldowns.deleteDrilldownsButtonLabel": "删除 ({count})", + "xpack.uiActionsEnhanced.drilldowns.components.ListManageDrilldowns.editDrilldownButtonLabel": "编辑", + "xpack.uiActionsEnhanced.drilldowns.components.ListManageDrilldowns.selectThisDrilldownCheckboxLabel": "选择此向下钻取", "xpack.alerts.alertNavigationRegistry.get.missingNavigationError": "在“{consumer}”内针对告警类型“{alertType}”的导航未注册。", "xpack.alerts.alertNavigationRegistry.register.duplicateDefaultError": "“{consumer}”内的默认导航已注册。", "xpack.alerts.alertNavigationRegistry.register.duplicateNavigationError": "在“{consumer}”内针对告警类型“{alertType}”的导航已注册。", @@ -6125,27 +6146,6 @@ "xpack.data.kueryAutocomplete.orOperatorDescription.oneOrMoreArgumentsText": "一个或多个参数", "xpack.data.query.queryBar.cancelLongQuery": "取消", "xpack.data.query.queryBar.runBeyond": "运行超时", - "xpack.drilldowns.components.DrilldownHelloBar.helpText": "向下钻取可用于定义与面板交互时的新行为。可以添加多个选项或仅覆盖默认筛选行为。", - "xpack.drilldowns.components.DrilldownHelloBar.hideHelpButtonLabel": "隐藏", - "xpack.drilldowns.components.DrilldownHelloBar.viewDocsLinkLabel": "查看文档", - "xpack.drilldowns.components.flyoutDrilldownWizard.createDrilldownButtonLabel": "创建向下钻取", - "xpack.drilldowns.components.flyoutDrilldownWizard.createDrilldownTitle": "创建向下钻取", - "xpack.drilldowns.components.flyoutDrilldownWizard.deleteDrilldownButtonLabel": "删除向下钻取", - "xpack.drilldowns.components.flyoutDrilldownWizard.editDrilldownButtonLabel": "保存", - "xpack.drilldowns.components.flyoutDrilldownWizard.editDrilldownTitle": "编辑向下钻取", - "xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownDeletedText": "您已删除向下钻取。", - "xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownDeletedTitle": "向下钻取已删除", - "xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsCRUDErrorTitle": "保存向下钻取时出错", - "xpack.drilldowns.components.FlyoutFrame.BackButtonLabel": "上一步", - "xpack.drilldowns.components.FlyoutFrame.CloseButtonLabel": "关闭", - "xpack.drilldowns.components.FlyoutListManageDrilldowns.manageDrilldownsTitle": "管理向下钻取", - "xpack.drilldowns.components.FormCreateDrilldown.drilldownAction": "操作", - "xpack.drilldowns.components.FormCreateDrilldown.nameOfDrilldown": "名称", - "xpack.drilldowns.components.FormCreateDrilldown.untitledDrilldown": "未命名向下钻取", - "xpack.drilldowns.components.ListManageDrilldowns.createDrilldownButtonLabel": "新建", - "xpack.drilldowns.components.ListManageDrilldowns.deleteDrilldownsButtonLabel": "删除 ({count})", - "xpack.drilldowns.components.ListManageDrilldowns.editDrilldownButtonLabel": "编辑", - "xpack.drilldowns.components.ListManageDrilldowns.selectThisDrilldownCheckboxLabel": "选择此向下钻取", "xpack.features.advancedSettingsFeatureName": "高级设置", "xpack.features.dashboardFeatureName": "仪表板", "xpack.features.devToolsFeatureName": "开发工具", diff --git a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.story.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.story.tsx similarity index 62% rename from x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.story.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.story.tsx index 5fde4fc79e433..cd8452ff74ab4 100644 --- a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.story.tsx +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.story.tsx @@ -12,28 +12,23 @@ import { dashboardFactory, urlFactory, // eslint-disable-next-line @kbn/eslint/no-restricted-paths -} from '../../../../ui_actions_enhanced/public/components/action_wizard/test_data'; -import { Storage } from '../../../../../../src/plugins/kibana_utils/public'; -import { StubBrowserStorage } from '../../../../../../src/test_utils/public/stub_browser_storage'; +} from '../../../components/action_wizard/test_data'; +import { Storage } from '../../../../../../../src/plugins/kibana_utils/public'; +import { StubBrowserStorage } from '../../../../../../../src/test_utils/public/stub_browser_storage'; import { mockDynamicActionManager } from './test_data'; +import { ActionFactory } from '../../../dynamic_actions'; const FlyoutManageDrilldowns = createFlyoutManageDrilldowns({ - uiActionsEnhanced: { - getActionFactories() { - return [dashboardFactory, urlFactory]; + actionFactories: [dashboardFactory as ActionFactory, urlFactory as ActionFactory], + storage: new Storage(new StubBrowserStorage()), + toastService: { + addError: (...args: any[]) => { + alert(JSON.stringify(args)); + }, + addSuccess: (...args: any[]) => { + alert(JSON.stringify(args)); }, } as any, - storage: new Storage(new StubBrowserStorage()), - notifications: { - toasts: { - addError: (...args: any[]) => { - alert(JSON.stringify(args)); - }, - addSuccess: (...args: any[]) => { - alert(JSON.stringify(args)); - }, - } as any, - }, }); storiesOf('components/FlyoutManageDrilldowns', module).add('default', () => ( diff --git a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.test.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.test.tsx similarity index 89% rename from x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.test.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.test.tsx index 32cbec795d092..161caa9782f02 100644 --- a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.test.tsx +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.test.tsx @@ -8,29 +8,23 @@ import React from 'react'; import { cleanup, fireEvent, render, wait } from '@testing-library/react/pure'; import '@testing-library/jest-dom/extend-expect'; import { createFlyoutManageDrilldowns } from './connected_flyout_manage_drilldowns'; -import { - dashboardFactory, - urlFactory, -} from '../../../../ui_actions_enhanced/public/components/action_wizard/test_data'; -import { StubBrowserStorage } from '../../../../../../src/test_utils/public/stub_browser_storage'; -import { Storage } from '../../../../../../src/plugins/kibana_utils/public'; +import { dashboardFactory, urlFactory } from '../../../components/action_wizard/test_data'; +import { StubBrowserStorage } from '../../../../../../../src/test_utils/public/stub_browser_storage'; +import { Storage } from '../../../../../../../src/plugins/kibana_utils/public'; import { mockDynamicActionManager } from './test_data'; import { TEST_SUBJ_DRILLDOWN_ITEM } from '../list_manage_drilldowns'; import { WELCOME_MESSAGE_TEST_SUBJ } from '../drilldown_hello_bar'; -import { coreMock } from '../../../../../../src/core/public/mocks'; +import { coreMock } from '../../../../../../../src/core/public/mocks'; import { NotificationsStart } from 'kibana/public'; import { toastDrilldownsCRUDError } from './i18n'; +import { ActionFactory } from '../../../dynamic_actions'; const storage = new Storage(new StubBrowserStorage()); -const notifications = coreMock.createStart().notifications; +const toasts = coreMock.createStart().notifications.toasts; const FlyoutManageDrilldowns = createFlyoutManageDrilldowns({ - uiActionsEnhanced: { - getActionFactories() { - return [dashboardFactory, urlFactory]; - }, - } as any, - storage, - notifications, + actionFactories: [dashboardFactory as ActionFactory, urlFactory as ActionFactory], + storage: new Storage(new StubBrowserStorage()), + toastService: toasts, }); // https://github.com/elastic/kibana/issues/59469 @@ -38,8 +32,8 @@ afterEach(cleanup); beforeEach(() => { storage.clear(); - (notifications.toasts as jest.Mocked).addSuccess.mockClear(); - (notifications.toasts as jest.Mocked).addError.mockClear(); + (toasts as jest.Mocked).addSuccess.mockClear(); + (toasts as jest.Mocked).addError.mockClear(); }); test('Allows to manage drilldowns', async () => { @@ -163,7 +157,7 @@ test('Create only mode', async () => { }); fireEvent.click(screen.getAllByText(/Create Drilldown/i)[1]); - await wait(() => expect(notifications.toasts.addSuccess).toBeCalled()); + await wait(() => expect(toasts.addSuccess).toBeCalled()); expect(onClose).toBeCalled(); expect(await mockDynamicActionManager.state.get().events.length).toBe(1); }); @@ -194,7 +188,7 @@ test('After switching between action factories state is restored', async () => { expect(screen.getByLabelText(/name/i)).toHaveValue('test'); fireEvent.click(screen.getAllByText(/Create Drilldown/i)[1]); - await wait(() => expect(notifications.toasts.addSuccess).toBeCalled()); + await wait(() => expect(toasts.addSuccess).toBeCalled()); expect(await (mockDynamicActionManager.state.get().events[0].action.config as any).url).toBe( 'https://elastic.co' ); @@ -220,7 +214,7 @@ test("Error when can't save drilldown changes", async () => { }); fireEvent.click(screen.getAllByText(/Create Drilldown/i)[1]); await wait(() => - expect(notifications.toasts.addError).toBeCalledWith(error, { title: toastDrilldownsCRUDError }) + expect(toasts.addError).toBeCalledWith(error, { title: toastDrilldownsCRUDError }) ); }); diff --git a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx similarity index 86% rename from x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx index e05547741871e..fbc72d0470635 100644 --- a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx @@ -5,24 +5,17 @@ */ import React, { useEffect, useState } from 'react'; +import { ToastsStart } from 'kibana/public'; import useMountedState from 'react-use/lib/useMountedState'; -import { - UiActionsEnhancedActionFactory as ActionFactory, - AdvancedUiActionsStart, - UiActionsEnhancedDynamicActionManager as DynamicActionManager, - UiActionsEnhancedSerializedAction, - UiActionsEnhancedSerializedEvent, -} from '../../../../ui_actions_enhanced/public'; -import { NotificationsStart } from '../../../../../../src/core/public'; import { DrilldownWizardConfig, FlyoutDrilldownWizard } from '../flyout_drilldown_wizard'; import { FlyoutListManageDrilldowns } from '../flyout_list_manage_drilldowns'; -import { IStorageWrapper } from '../../../../../../src/plugins/kibana_utils/public'; +import { IStorageWrapper } from '../../../../../../../src/plugins/kibana_utils/public'; import { VALUE_CLICK_TRIGGER, SELECT_RANGE_TRIGGER, TriggerContextMapping, -} from '../../../../../../src/plugins/ui_actions/public'; -import { useContainerState } from '../../../../../../src/plugins/kibana_utils/public'; +} from '../../../../../../../src/plugins/ui_actions/public'; +import { useContainerState } from '../../../../../../../src/plugins/kibana_utils/public'; import { DrilldownListItem } from '../list_manage_drilldowns'; import { toastDrilldownCreated, @@ -31,6 +24,12 @@ import { toastDrilldownsCRUDError, toastDrilldownsDeleted, } from './i18n'; +import { + ActionFactory, + DynamicActionManager, + SerializedAction, + SerializedEvent, +} from '../../../dynamic_actions'; interface ConnectedFlyoutManageDrilldownsProps { dynamicActionManager: DynamicActionManager; @@ -48,19 +47,16 @@ enum Routes { } export function createFlyoutManageDrilldowns({ - uiActionsEnhanced, + actionFactories: allActionFactories, storage, - notifications, + toastService, docsLink, }: { - uiActionsEnhanced: AdvancedUiActionsStart; + actionFactories: ActionFactory[]; storage: IStorageWrapper; - notifications: NotificationsStart; + toastService: ToastsStart; docsLink?: string; }) { - // fine to assume this is static, - // because all action factories should be registered in setup phase - const allActionFactories = uiActionsEnhanced.getActionFactories(); const allActionFactoriesById = allActionFactories.reduce((acc, next) => { acc[next.id] = next; return acc; @@ -98,7 +94,7 @@ export function createFlyoutManageDrilldowns({ createDrilldown, editDrilldown, deleteDrilldown, - } = useDrilldownsStateManager(props.dynamicActionManager, notifications); + } = useDrilldownsStateManager(props.dynamicActionManager, toastService); /** * isCompatible promise is not yet resolved. @@ -130,9 +126,7 @@ export function createFlyoutManageDrilldowns({ /** * Maps drilldown to list item view model */ - function mapToDrilldownToDrilldownListItem( - drilldown: UiActionsEnhancedSerializedEvent - ): DrilldownListItem { + function mapToDrilldownToDrilldownListItem(drilldown: SerializedEvent): DrilldownListItem { const actionFactory = allActionFactoriesById[drilldown.action.factoryId]; return { id: drilldown.eventId, @@ -260,10 +254,7 @@ function useWelcomeMessage(storage: IStorageWrapper): [boolean, () => void] { ]; } -function useDrilldownsStateManager( - actionManager: DynamicActionManager, - notifications: NotificationsStart -) { +function useDrilldownsStateManager(actionManager: DynamicActionManager, toastService: ToastsStart) { const { events: drilldowns } = useContainerState(actionManager.state); const [isLoading, setIsLoading] = useState(false); const isMounted = useMountedState(); @@ -273,7 +264,7 @@ function useDrilldownsStateManager( try { await op(); } catch (e) { - notifications.toasts.addError(e, { + toastService.addError(e, { title: toastDrilldownsCRUDError, }); if (!isMounted) return; @@ -283,12 +274,12 @@ function useDrilldownsStateManager( } async function createDrilldown( - action: UiActionsEnhancedSerializedAction, + action: SerializedAction, selectedTriggers: Array ) { await run(async () => { await actionManager.createEvent(action, selectedTriggers); - notifications.toasts.addSuccess({ + toastService.addSuccess({ title: toastDrilldownCreated.title(action.name), text: toastDrilldownCreated.text, }); @@ -297,12 +288,12 @@ function useDrilldownsStateManager( async function editDrilldown( drilldownId: string, - action: UiActionsEnhancedSerializedAction, + action: SerializedAction, selectedTriggers: Array ) { await run(async () => { await actionManager.updateEvent(drilldownId, action, selectedTriggers); - notifications.toasts.addSuccess({ + toastService.addSuccess({ title: toastDrilldownEdited.title(action.name), text: toastDrilldownEdited.text, }); @@ -313,7 +304,7 @@ function useDrilldownsStateManager( await run(async () => { drilldownIds = Array.isArray(drilldownIds) ? drilldownIds : [drilldownIds]; await actionManager.deleteEvents(drilldownIds); - notifications.toasts.addSuccess( + toastService.addSuccess( drilldownIds.length === 1 ? { title: toastDrilldownDeleted.title, diff --git a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/i18n.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/i18n.ts similarity index 61% rename from x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/i18n.ts rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/i18n.ts index 851439eccbe7e..e75ee2634aa43 100644 --- a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/i18n.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/i18n.ts @@ -9,7 +9,7 @@ import { i18n } from '@kbn/i18n'; export const toastDrilldownCreated = { title: (drilldownName: string) => i18n.translate( - 'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownCreatedTitle', + 'xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownCreatedTitle', { defaultMessage: 'Drilldown "{drilldownName}" created', values: { @@ -18,7 +18,7 @@ export const toastDrilldownCreated = { } ), text: i18n.translate( - 'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownCreatedText', + 'xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownCreatedText', { // TODO: remove `Save your dashboard before testing.` part // when drilldowns are used not only in dashboard @@ -30,14 +30,17 @@ export const toastDrilldownCreated = { export const toastDrilldownEdited = { title: (drilldownName: string) => - i18n.translate('xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownEditedTitle', { - defaultMessage: 'Drilldown "{drilldownName}" updated', - values: { - drilldownName, - }, - }), + i18n.translate( + 'xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownEditedTitle', + { + defaultMessage: 'Drilldown "{drilldownName}" updated', + values: { + drilldownName, + }, + } + ), text: i18n.translate( - 'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownEditedText', + 'xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownEditedText', { defaultMessage: 'Save your dashboard before testing.', } @@ -46,13 +49,13 @@ export const toastDrilldownEdited = { export const toastDrilldownDeleted = { title: i18n.translate( - 'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownDeletedTitle', + 'xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownDeletedTitle', { defaultMessage: 'Drilldown deleted', } ), text: i18n.translate( - 'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownDeletedText', + 'xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownDeletedText', { defaultMessage: 'Save your dashboard before testing.', } @@ -62,14 +65,14 @@ export const toastDrilldownDeleted = { export const toastDrilldownsDeleted = { title: (n: number) => i18n.translate( - 'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsDeletedTitle', + 'xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsDeletedTitle', { defaultMessage: '{n} drilldowns deleted', values: { n }, } ), text: i18n.translate( - 'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsDeletedText', + 'xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsDeletedText', { defaultMessage: 'Save your dashboard before testing.', } @@ -77,7 +80,7 @@ export const toastDrilldownsDeleted = { }; export const toastDrilldownsCRUDError = i18n.translate( - 'xpack.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsCRUDErrorTitle', + 'xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.toast.drilldownsCRUDErrorTitle', { defaultMessage: 'Error saving drilldown', description: 'Title for generic error toast when persisting drilldown updates failed', diff --git a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/index.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/index.ts similarity index 100% rename from x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/index.ts rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/index.ts diff --git a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/test_data.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/test_data.ts similarity index 90% rename from x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/test_data.ts rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/test_data.ts index d585fa0692e8c..58c36e36481b8 100644 --- a/x-pack/plugins/drilldowns/public/components/connected_flyout_manage_drilldowns/test_data.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/test_data.ts @@ -9,9 +9,9 @@ import { UiActionsEnhancedDynamicActionManager as DynamicActionManager, UiActionsEnhancedDynamicActionManagerState as DynamicActionManagerState, UiActionsEnhancedSerializedAction, -} from '../../../../ui_actions_enhanced/public'; -import { TriggerContextMapping } from '../../../../../../src/plugins/ui_actions/public'; -import { createStateContainer } from '../../../../../../src/plugins/kibana_utils/common'; +} from '../../../index'; +import { TriggerContextMapping } from '../../../../../../../src/plugins/ui_actions/public'; +import { createStateContainer } from '../../../../../../../src/plugins/kibana_utils/common'; class MockDynamicActionManager implements PublicMethodsOf { public readonly state = createStateContainer({ diff --git a/x-pack/plugins/drilldowns/public/components/drilldown_hello_bar/drilldown_hello_bar.story.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/drilldown_hello_bar/drilldown_hello_bar.story.tsx similarity index 93% rename from x-pack/plugins/drilldowns/public/components/drilldown_hello_bar/drilldown_hello_bar.story.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/drilldown_hello_bar/drilldown_hello_bar.story.tsx index c4a4630397f1c..df168275fceb3 100644 --- a/x-pack/plugins/drilldowns/public/components/drilldown_hello_bar/drilldown_hello_bar.story.tsx +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/drilldown_hello_bar/drilldown_hello_bar.story.tsx @@ -6,7 +6,7 @@ import * as React from 'react'; import { storiesOf } from '@storybook/react'; -import { DrilldownHelloBar } from '.'; +import { DrilldownHelloBar } from './index'; const Demo = () => { const [show, setShow] = React.useState(true); diff --git a/x-pack/plugins/drilldowns/public/components/drilldown_hello_bar/drilldown_hello_bar.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/drilldown_hello_bar/drilldown_hello_bar.tsx similarity index 100% rename from x-pack/plugins/drilldowns/public/components/drilldown_hello_bar/drilldown_hello_bar.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/drilldown_hello_bar/drilldown_hello_bar.tsx diff --git a/x-pack/plugins/drilldowns/public/components/drilldown_hello_bar/i18n.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/drilldown_hello_bar/i18n.ts similarity index 73% rename from x-pack/plugins/drilldowns/public/components/drilldown_hello_bar/i18n.ts rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/drilldown_hello_bar/i18n.ts index 622376c5b40ad..e857366690c45 100644 --- a/x-pack/plugins/drilldowns/public/components/drilldown_hello_bar/i18n.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/drilldown_hello_bar/i18n.ts @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; export const txtHelpText = i18n.translate( - 'xpack.drilldowns.components.DrilldownHelloBar.helpText', + 'xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.helpText', { defaultMessage: 'Drilldowns enable you to define new behaviors for interacting with panels. You can add multiple actions and override the default filter.', @@ -15,14 +15,14 @@ export const txtHelpText = i18n.translate( ); export const txtViewDocsLinkLabel = i18n.translate( - 'xpack.drilldowns.components.DrilldownHelloBar.viewDocsLinkLabel', + 'xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.viewDocsLinkLabel', { defaultMessage: 'View docs', } ); export const txtHideHelpButtonLabel = i18n.translate( - 'xpack.drilldowns.components.DrilldownHelloBar.hideHelpButtonLabel', + 'xpack.uiActionsEnhanced.drilldowns.components.DrilldownHelloBar.hideHelpButtonLabel', { defaultMessage: 'Hide', } diff --git a/x-pack/plugins/drilldowns/public/components/drilldown_hello_bar/index.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/drilldown_hello_bar/index.tsx similarity index 100% rename from x-pack/plugins/drilldowns/public/components/drilldown_hello_bar/index.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/drilldown_hello_bar/index.tsx diff --git a/x-pack/plugins/drilldowns/public/components/flyout_drilldown_wizard/flyout_drilldown_wizard.story.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_drilldown_wizard/flyout_drilldown_wizard.story.tsx similarity index 90% rename from x-pack/plugins/drilldowns/public/components/flyout_drilldown_wizard/flyout_drilldown_wizard.story.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_drilldown_wizard/flyout_drilldown_wizard.story.tsx index be048bf920602..2069a83ab8ba0 100644 --- a/x-pack/plugins/drilldowns/public/components/flyout_drilldown_wizard/flyout_drilldown_wizard.story.tsx +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_drilldown_wizard/flyout_drilldown_wizard.story.tsx @@ -9,13 +9,13 @@ import * as React from 'react'; import { EuiFlyout } from '@elastic/eui'; import { storiesOf } from '@storybook/react'; -import { FlyoutDrilldownWizard } from '.'; +import { FlyoutDrilldownWizard } from './index'; import { dashboardFactory, urlFactory, // eslint-disable-next-line @kbn/eslint/no-restricted-paths -} from '../../../../ui_actions_enhanced/public/components/action_wizard/test_data'; -import { UiActionsEnhancedActionFactory as ActionFactory } from '../../../../ui_actions_enhanced/public/'; +} from '../../../components/action_wizard/test_data'; +import { ActionFactory } from '../../../dynamic_actions'; storiesOf('components/FlyoutDrilldownWizard', module) .add('default', () => { diff --git a/x-pack/plugins/drilldowns/public/components/flyout_drilldown_wizard/flyout_drilldown_wizard.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_drilldown_wizard/flyout_drilldown_wizard.tsx similarity index 98% rename from x-pack/plugins/drilldowns/public/components/flyout_drilldown_wizard/flyout_drilldown_wizard.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_drilldown_wizard/flyout_drilldown_wizard.tsx index 8994aac4123e1..58cf2501280c7 100644 --- a/x-pack/plugins/drilldowns/public/components/flyout_drilldown_wizard/flyout_drilldown_wizard.tsx +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_drilldown_wizard/flyout_drilldown_wizard.tsx @@ -16,7 +16,7 @@ import { txtEditDrilldownTitle, } from './i18n'; import { DrilldownHelloBar } from '../drilldown_hello_bar'; -import { UiActionsEnhancedActionFactory as ActionFactory } from '../../../../ui_actions_enhanced/public'; +import { ActionFactory } from '../../../dynamic_actions'; export interface DrilldownWizardConfig { name: string; diff --git a/x-pack/plugins/drilldowns/public/components/flyout_drilldown_wizard/i18n.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_drilldown_wizard/i18n.ts similarity index 62% rename from x-pack/plugins/drilldowns/public/components/flyout_drilldown_wizard/i18n.ts rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_drilldown_wizard/i18n.ts index a4a2754a444ab..86485dd7b8bbe 100644 --- a/x-pack/plugins/drilldowns/public/components/flyout_drilldown_wizard/i18n.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_drilldown_wizard/i18n.ts @@ -7,35 +7,35 @@ import { i18n } from '@kbn/i18n'; export const txtCreateDrilldownTitle = i18n.translate( - 'xpack.drilldowns.components.flyoutDrilldownWizard.createDrilldownTitle', + 'xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.createDrilldownTitle', { defaultMessage: 'Create Drilldown', } ); export const txtEditDrilldownTitle = i18n.translate( - 'xpack.drilldowns.components.flyoutDrilldownWizard.editDrilldownTitle', + 'xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.editDrilldownTitle', { defaultMessage: 'Edit Drilldown', } ); export const txtCreateDrilldownButtonLabel = i18n.translate( - 'xpack.drilldowns.components.flyoutDrilldownWizard.createDrilldownButtonLabel', + 'xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.createDrilldownButtonLabel', { defaultMessage: 'Create drilldown', } ); export const txtEditDrilldownButtonLabel = i18n.translate( - 'xpack.drilldowns.components.flyoutDrilldownWizard.editDrilldownButtonLabel', + 'xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.editDrilldownButtonLabel', { defaultMessage: 'Save', } ); export const txtDeleteDrilldownButtonLabel = i18n.translate( - 'xpack.drilldowns.components.flyoutDrilldownWizard.deleteDrilldownButtonLabel', + 'xpack.uiActionsEnhanced.drilldowns.components.flyoutDrilldownWizard.deleteDrilldownButtonLabel', { defaultMessage: 'Delete drilldown', } diff --git a/x-pack/plugins/drilldowns/public/components/flyout_drilldown_wizard/index.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_drilldown_wizard/index.ts similarity index 100% rename from x-pack/plugins/drilldowns/public/components/flyout_drilldown_wizard/index.ts rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_drilldown_wizard/index.ts diff --git a/x-pack/plugins/drilldowns/public/components/flyout_frame/flyout_frame.story.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_frame/flyout_frame.story.tsx similarity index 97% rename from x-pack/plugins/drilldowns/public/components/flyout_frame/flyout_frame.story.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_frame/flyout_frame.story.tsx index 7ef0bc5a8bee4..d47c34c4c7ec9 100644 --- a/x-pack/plugins/drilldowns/public/components/flyout_frame/flyout_frame.story.tsx +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_frame/flyout_frame.story.tsx @@ -9,7 +9,7 @@ import * as React from 'react'; import { EuiFlyout, EuiButton } from '@elastic/eui'; import { storiesOf } from '@storybook/react'; -import { FlyoutFrame } from '.'; +import { FlyoutFrame } from './index'; storiesOf('components/FlyoutFrame', module) .add('default', () => { diff --git a/x-pack/plugins/drilldowns/public/components/flyout_frame/flyout_frame.test.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_frame/flyout_frame.test.tsx similarity index 98% rename from x-pack/plugins/drilldowns/public/components/flyout_frame/flyout_frame.test.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_frame/flyout_frame.test.tsx index 0a3989487745f..cdbf36d81de33 100644 --- a/x-pack/plugins/drilldowns/public/components/flyout_frame/flyout_frame.test.tsx +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_frame/flyout_frame.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { render } from 'react-dom'; import { render as renderTestingLibrary, fireEvent, cleanup } from '@testing-library/react/pure'; -import { FlyoutFrame } from '.'; +import { FlyoutFrame } from './index'; afterEach(cleanup); diff --git a/x-pack/plugins/drilldowns/public/components/flyout_frame/flyout_frame.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_frame/flyout_frame.tsx similarity index 100% rename from x-pack/plugins/drilldowns/public/components/flyout_frame/flyout_frame.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_frame/flyout_frame.tsx diff --git a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_frame/i18n.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_frame/i18n.ts new file mode 100644 index 0000000000000..cf0cd95e25c79 --- /dev/null +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_frame/i18n.ts @@ -0,0 +1,21 @@ +/* + * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one + * or more contributor license agreements. Licensed under the Elastic License; + * you may not use this file except in compliance with the Elastic License. + */ + +import { i18n } from '@kbn/i18n'; + +export const txtClose = i18n.translate( + 'xpack.uiActionsEnhanced.drilldowns.components.FlyoutFrame.CloseButtonLabel', + { + defaultMessage: 'Close', + } +); + +export const txtBack = i18n.translate( + 'xpack.uiActionsEnhanced.drilldowns.components.FlyoutFrame.BackButtonLabel', + { + defaultMessage: 'Back', + } +); diff --git a/x-pack/plugins/drilldowns/public/components/flyout_frame/index.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_frame/index.tsx similarity index 100% rename from x-pack/plugins/drilldowns/public/components/flyout_frame/index.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_frame/index.tsx diff --git a/x-pack/plugins/drilldowns/public/components/flyout_list_manage_drilldowns/flyout_list_manage_drilldowns.story.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_list_manage_drilldowns/flyout_list_manage_drilldowns.story.tsx similarity index 100% rename from x-pack/plugins/drilldowns/public/components/flyout_list_manage_drilldowns/flyout_list_manage_drilldowns.story.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_list_manage_drilldowns/flyout_list_manage_drilldowns.story.tsx diff --git a/x-pack/plugins/drilldowns/public/components/flyout_list_manage_drilldowns/flyout_list_manage_drilldowns.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_list_manage_drilldowns/flyout_list_manage_drilldowns.tsx similarity index 100% rename from x-pack/plugins/drilldowns/public/components/flyout_list_manage_drilldowns/flyout_list_manage_drilldowns.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_list_manage_drilldowns/flyout_list_manage_drilldowns.tsx diff --git a/x-pack/plugins/drilldowns/public/components/flyout_list_manage_drilldowns/i18n.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_list_manage_drilldowns/i18n.ts similarity index 79% rename from x-pack/plugins/drilldowns/public/components/flyout_list_manage_drilldowns/i18n.ts rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_list_manage_drilldowns/i18n.ts index 0dd4e37d4dddd..f3aba205c0471 100644 --- a/x-pack/plugins/drilldowns/public/components/flyout_list_manage_drilldowns/i18n.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_list_manage_drilldowns/i18n.ts @@ -7,7 +7,7 @@ import { i18n } from '@kbn/i18n'; export const txtManageDrilldowns = i18n.translate( - 'xpack.drilldowns.components.FlyoutListManageDrilldowns.manageDrilldownsTitle', + 'xpack.uiActionsEnhanced.drilldowns.components.FlyoutListManageDrilldowns.manageDrilldownsTitle', { defaultMessage: 'Manage Drilldowns', } diff --git a/x-pack/plugins/drilldowns/public/components/flyout_list_manage_drilldowns/index.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_list_manage_drilldowns/index.ts similarity index 100% rename from x-pack/plugins/drilldowns/public/components/flyout_list_manage_drilldowns/index.ts rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/flyout_list_manage_drilldowns/index.ts diff --git a/x-pack/plugins/drilldowns/public/components/form_drilldown_wizard/form_drilldown_wizard.story.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/form_drilldown_wizard/form_drilldown_wizard.story.tsx similarity index 94% rename from x-pack/plugins/drilldowns/public/components/form_drilldown_wizard/form_drilldown_wizard.story.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/form_drilldown_wizard/form_drilldown_wizard.story.tsx index 2fc35eb6b5298..fe63b0835af9e 100644 --- a/x-pack/plugins/drilldowns/public/components/form_drilldown_wizard/form_drilldown_wizard.story.tsx +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/form_drilldown_wizard/form_drilldown_wizard.story.tsx @@ -6,7 +6,7 @@ import * as React from 'react'; import { storiesOf } from '@storybook/react'; -import { FormDrilldownWizard } from '.'; +import { FormDrilldownWizard } from './index'; const DemoEditName: React.FC = () => { const [name, setName] = React.useState(''); diff --git a/x-pack/plugins/drilldowns/public/components/form_drilldown_wizard/form_drilldown_wizard.test.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/form_drilldown_wizard/form_drilldown_wizard.test.tsx similarity index 100% rename from x-pack/plugins/drilldowns/public/components/form_drilldown_wizard/form_drilldown_wizard.test.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/form_drilldown_wizard/form_drilldown_wizard.test.tsx diff --git a/x-pack/plugins/drilldowns/public/components/form_drilldown_wizard/form_drilldown_wizard.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/form_drilldown_wizard/form_drilldown_wizard.tsx similarity index 94% rename from x-pack/plugins/drilldowns/public/components/form_drilldown_wizard/form_drilldown_wizard.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/form_drilldown_wizard/form_drilldown_wizard.tsx index 1813851d728db..622ed58e3625d 100644 --- a/x-pack/plugins/drilldowns/public/components/form_drilldown_wizard/form_drilldown_wizard.tsx +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/form_drilldown_wizard/form_drilldown_wizard.tsx @@ -7,10 +7,8 @@ import React from 'react'; import { EuiFieldText, EuiForm, EuiFormRow, EuiSpacer } from '@elastic/eui'; import { txtDrilldownAction, txtNameOfDrilldown, txtUntitledDrilldown } from './i18n'; -import { - UiActionsEnhancedActionFactory as ActionFactory, - ActionWizard, -} from '../../../../ui_actions_enhanced/public'; +import { ActionFactory } from '../../../dynamic_actions'; +import { ActionWizard } from '../../../components/action_wizard'; const noopFn = () => {}; diff --git a/x-pack/plugins/drilldowns/public/components/form_drilldown_wizard/i18n.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/form_drilldown_wizard/i18n.ts similarity index 68% rename from x-pack/plugins/drilldowns/public/components/form_drilldown_wizard/i18n.ts rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/form_drilldown_wizard/i18n.ts index e9b19ab0afa97..9636b6e8a74e7 100644 --- a/x-pack/plugins/drilldowns/public/components/form_drilldown_wizard/i18n.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/form_drilldown_wizard/i18n.ts @@ -7,21 +7,21 @@ import { i18n } from '@kbn/i18n'; export const txtNameOfDrilldown = i18n.translate( - 'xpack.drilldowns.components.FormCreateDrilldown.nameOfDrilldown', + 'xpack.uiActionsEnhanced.drilldowns.components.FormCreateDrilldown.nameOfDrilldown', { defaultMessage: 'Name', } ); export const txtUntitledDrilldown = i18n.translate( - 'xpack.drilldowns.components.FormCreateDrilldown.untitledDrilldown', + 'xpack.uiActionsEnhanced.drilldowns.components.FormCreateDrilldown.untitledDrilldown', { defaultMessage: 'Untitled drilldown', } ); export const txtDrilldownAction = i18n.translate( - 'xpack.drilldowns.components.FormCreateDrilldown.drilldownAction', + 'xpack.uiActionsEnhanced.drilldowns.components.FormCreateDrilldown.drilldownAction', { defaultMessage: 'Action', } diff --git a/x-pack/plugins/drilldowns/public/components/form_drilldown_wizard/index.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/form_drilldown_wizard/index.tsx similarity index 100% rename from x-pack/plugins/drilldowns/public/components/form_drilldown_wizard/index.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/form_drilldown_wizard/index.tsx diff --git a/x-pack/plugins/drilldowns/scripts/storybook.js b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/index.ts similarity index 53% rename from x-pack/plugins/drilldowns/scripts/storybook.js rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/index.ts index 2bfd0eb1a8f19..a6bed0078bfd7 100644 --- a/x-pack/plugins/drilldowns/scripts/storybook.js +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/index.ts @@ -4,10 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import { join } from 'path'; - -// eslint-disable-next-line -require('@kbn/storybook').runStorybookCli({ - name: 'drilldowns', - storyGlobs: [join(__dirname, '..', 'public', 'components', '**', '*.story.tsx')], -}); +export { createFlyoutManageDrilldowns } from './connected_flyout_manage_drilldowns'; diff --git a/x-pack/plugins/drilldowns/public/components/list_manage_drilldowns/i18n.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/list_manage_drilldowns/i18n.ts similarity index 54% rename from x-pack/plugins/drilldowns/public/components/list_manage_drilldowns/i18n.ts rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/list_manage_drilldowns/i18n.ts index fbc7c9dcfb4a1..65087b8523cb1 100644 --- a/x-pack/plugins/drilldowns/public/components/list_manage_drilldowns/i18n.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/list_manage_drilldowns/i18n.ts @@ -7,29 +7,32 @@ import { i18n } from '@kbn/i18n'; export const txtCreateDrilldown = i18n.translate( - 'xpack.drilldowns.components.ListManageDrilldowns.createDrilldownButtonLabel', + 'xpack.uiActionsEnhanced.drilldowns.components.ListManageDrilldowns.createDrilldownButtonLabel', { defaultMessage: 'Create new', } ); export const txtEditDrilldown = i18n.translate( - 'xpack.drilldowns.components.ListManageDrilldowns.editDrilldownButtonLabel', + 'xpack.uiActionsEnhanced.drilldowns.components.ListManageDrilldowns.editDrilldownButtonLabel', { defaultMessage: 'Edit', } ); export const txtDeleteDrilldowns = (count: number) => - i18n.translate('xpack.drilldowns.components.ListManageDrilldowns.deleteDrilldownsButtonLabel', { - defaultMessage: 'Delete ({count})', - values: { - count, - }, - }); + i18n.translate( + 'xpack.uiActionsEnhanced.drilldowns.components.ListManageDrilldowns.deleteDrilldownsButtonLabel', + { + defaultMessage: 'Delete ({count})', + values: { + count, + }, + } + ); export const txtSelectDrilldown = i18n.translate( - 'xpack.drilldowns.components.ListManageDrilldowns.selectThisDrilldownCheckboxLabel', + 'xpack.uiActionsEnhanced.drilldowns.components.ListManageDrilldowns.selectThisDrilldownCheckboxLabel', { defaultMessage: 'Select this drilldown', } diff --git a/x-pack/plugins/drilldowns/public/components/list_manage_drilldowns/index.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/list_manage_drilldowns/index.tsx similarity index 100% rename from x-pack/plugins/drilldowns/public/components/list_manage_drilldowns/index.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/list_manage_drilldowns/index.tsx diff --git a/x-pack/plugins/drilldowns/public/components/list_manage_drilldowns/list_manage_drilldowns.story.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/list_manage_drilldowns/list_manage_drilldowns.story.tsx similarity index 100% rename from x-pack/plugins/drilldowns/public/components/list_manage_drilldowns/list_manage_drilldowns.story.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/list_manage_drilldowns/list_manage_drilldowns.story.tsx diff --git a/x-pack/plugins/drilldowns/public/components/list_manage_drilldowns/list_manage_drilldowns.test.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/list_manage_drilldowns/list_manage_drilldowns.test.tsx similarity index 100% rename from x-pack/plugins/drilldowns/public/components/list_manage_drilldowns/list_manage_drilldowns.test.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/list_manage_drilldowns/list_manage_drilldowns.test.tsx diff --git a/x-pack/plugins/drilldowns/public/components/list_manage_drilldowns/list_manage_drilldowns.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/list_manage_drilldowns/list_manage_drilldowns.tsx similarity index 100% rename from x-pack/plugins/drilldowns/public/components/list_manage_drilldowns/list_manage_drilldowns.tsx rename to x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/list_manage_drilldowns/list_manage_drilldowns.tsx diff --git a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/index.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/index.ts index 7f81a68c803eb..0d469e46fa9fd 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/index.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/index.ts @@ -5,3 +5,4 @@ */ export * from './drilldown_definition'; +export * from './components'; diff --git a/x-pack/plugins/ui_actions_enhanced/public/mocks.ts b/x-pack/plugins/ui_actions_enhanced/public/mocks.ts index 65fde12755beb..196b8f2c1d5c7 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/mocks.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/mocks.ts @@ -27,6 +27,7 @@ const createStartContract = (): Start => { ...uiActionsPluginMock.createStartContract(), getActionFactories: jest.fn(), getActionFactory: jest.fn(), + FlyoutManageDrilldowns: jest.fn(), }; return startContract; diff --git a/x-pack/plugins/ui_actions_enhanced/public/plugin.ts b/x-pack/plugins/ui_actions_enhanced/public/plugin.ts index d79996d5ecc1b..04caef92f15a2 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/plugin.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/plugin.ts @@ -24,7 +24,6 @@ import { CUSTOM_TIME_RANGE, TimeRangeActionContext, } from './custom_time_range_action'; - import { CustomTimeRangeBadge, CUSTOM_TIME_RANGE_BADGE, @@ -32,6 +31,8 @@ import { } from './custom_time_range_badge'; import { CommonlyUsedRange } from './types'; import { UiActionsServiceEnhancements } from './services'; +import { createFlyoutManageDrilldowns } from './drilldowns'; +import { Storage } from '../../../../src/plugins/kibana_utils/public'; interface SetupDependencies { embeddable: EmbeddableSetup; // Embeddable are needed because they register basic triggers/actions. @@ -49,7 +50,9 @@ export interface SetupContract export interface StartContract extends UiActionsStart, - Pick {} + Pick { + FlyoutManageDrilldowns: ReturnType; +} declare module '../../../../src/plugins/ui_actions/public' { export interface ActionContextMapping { @@ -94,6 +97,12 @@ export class AdvancedUiActionsPublicPlugin return { ...uiActions, ...this.enhancements, + FlyoutManageDrilldowns: createFlyoutManageDrilldowns({ + actionFactories: this.enhancements.getActionFactories(), + storage: new Storage(window?.localStorage), + toastService: core.notifications.toasts, + docsLink: core.docLinks.links.dashboard.drilldowns, + }), }; } diff --git a/x-pack/plugins/ui_actions_enhanced/scripts/storybook.js b/x-pack/plugins/ui_actions_enhanced/scripts/storybook.js index 2a192fc56469e..1e3ab0d96b81c 100644 --- a/x-pack/plugins/ui_actions_enhanced/scripts/storybook.js +++ b/x-pack/plugins/ui_actions_enhanced/scripts/storybook.js @@ -9,5 +9,8 @@ import { join } from 'path'; // eslint-disable-next-line require('@kbn/storybook').runStorybookCli({ name: 'ui_actions_enhanced', - storyGlobs: [join(__dirname, '..', 'public', 'components', '**', '*.story.tsx')], + storyGlobs: [ + join(__dirname, '..', 'public', 'components', '**', '*.story.tsx'), + join(__dirname, '..', 'public', 'drilldowns', 'components', '**', '*.story.tsx'), + ], });