diff --git a/CHANGELOG.md b/CHANGELOG.md
index 40f3fce4809..092edb7b417 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -43,6 +43,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Migrate from legacy elasticsearch client to opensearch-js client in `osd-opensearch-archiver` package([#4142](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4142))
- Replace the use of `bluebird` in `saved_objects` plugin ([#4026](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4026))
- [Table Visualization] Remove custom styling for text-align:center in favor of OUI utility class. ([#4164](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4164))
+- [Dashboard] Restructure the `Dashboard` plugin folder to be more cohesive with the project ([#4575](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4575))
### 🔩 Tests
diff --git a/src/plugins/dashboard/public/application/actions/add_to_library_action.test.tsx b/src/plugins/dashboard/public/application/actions/add_to_library_action.test.tsx
index 58523582a50..c13688c7351 100644
--- a/src/plugins/dashboard/public/application/actions/add_to_library_action.test.tsx
+++ b/src/plugins/dashboard/public/application/actions/add_to_library_action.test.tsx
@@ -33,21 +33,22 @@ import {
IContainer,
ReferenceOrValueEmbeddable,
EmbeddableInput,
-} from '../../embeddable_plugin';
-import { DashboardContainer } from '../embeddable';
-import { getSampleDashboardInput } from '../test_helpers';
+ ErrorEmbeddable,
+ ViewMode,
+} from '../../../../embeddable/public';
+import { embeddablePluginMock } from '../../../../embeddable/public/mocks';
import {
CONTACT_CARD_EMBEDDABLE,
ContactCardEmbeddableFactory,
ContactCardEmbeddable,
ContactCardEmbeddableInput,
ContactCardEmbeddableOutput,
-} from '../../embeddable_plugin_test_samples';
+} from '../../../../embeddable/public/lib/test_samples';
+import { DashboardContainer } from '../embeddable';
+import { getSampleDashboardInput } from '../test_helpers';
import { coreMock } from '../../../../../core/public/mocks';
import { CoreStart } from 'opensearch-dashboards/public';
import { AddToLibraryAction } from '.';
-import { embeddablePluginMock } from 'src/plugins/embeddable/public/mocks';
-import { ErrorEmbeddable, ViewMode } from '../../../../embeddable/public';
const { setup, doStart } = embeddablePluginMock.createInstance();
setup.registerEmbeddableFactory(
diff --git a/src/plugins/dashboard/public/application/actions/add_to_library_action.tsx b/src/plugins/dashboard/public/application/actions/add_to_library_action.tsx
index 1418cc65dc5..f687786cfe4 100644
--- a/src/plugins/dashboard/public/application/actions/add_to_library_action.tsx
+++ b/src/plugins/dashboard/public/application/actions/add_to_library_action.tsx
@@ -32,13 +32,15 @@ import { i18n } from '@osd/i18n';
import _ from 'lodash';
import uuid from 'uuid';
import { EuiIconType } from '@elastic/eui/src/components/icon/icon';
-import { ActionByType, IncompatibleActionError } from '../../ui_actions_plugin';
-import { ViewMode, PanelState, IEmbeddable } from '../../embeddable_plugin';
+import { ActionByType, IncompatibleActionError } from '../../../../ui_actions/public';
import {
PanelNotFoundError,
EmbeddableInput,
isReferenceOrValueEmbeddable,
isErrorEmbeddable,
+ ViewMode,
+ PanelState,
+ IEmbeddable,
} from '../../../../embeddable/public';
import { DashboardPanelState, DASHBOARD_CONTAINER_TYPE, DashboardContainer } from '..';
diff --git a/src/plugins/dashboard/public/application/actions/clone_panel_action.test.tsx b/src/plugins/dashboard/public/application/actions/clone_panel_action.test.tsx
index 6675d478eec..bf2fb17e7df 100644
--- a/src/plugins/dashboard/public/application/actions/clone_panel_action.test.tsx
+++ b/src/plugins/dashboard/public/application/actions/clone_panel_action.test.tsx
@@ -28,20 +28,20 @@
* under the License.
*/
-import { isErrorEmbeddable, IContainer, ErrorEmbeddable } from '../../embeddable_plugin';
-import { DashboardContainer, DashboardPanelState } from '../embeddable';
-import { getSampleDashboardInput, getSampleDashboardPanel } from '../test_helpers';
+import { isErrorEmbeddable, IContainer, ErrorEmbeddable } from '../../../../embeddable/public';
import {
CONTACT_CARD_EMBEDDABLE,
ContactCardEmbeddableFactory,
ContactCardEmbeddable,
ContactCardEmbeddableInput,
ContactCardEmbeddableOutput,
-} from '../../embeddable_plugin_test_samples';
+} from '../../../../embeddable/public/lib/test_samples';
+import { embeddablePluginMock } from '../../../../embeddable/public/mocks';
+import { DashboardContainer, DashboardPanelState } from '../embeddable';
+import { getSampleDashboardInput, getSampleDashboardPanel } from '../test_helpers';
import { coreMock } from '../../../../../core/public/mocks';
import { CoreStart } from 'opensearch-dashboards/public';
import { ClonePanelAction } from '.';
-import { embeddablePluginMock } from 'src/plugins/embeddable/public/mocks';
const { setup, doStart } = embeddablePluginMock.createInstance();
setup.registerEmbeddableFactory(
diff --git a/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx b/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx
index 97b3792fcba..8ef1e5a0cb2 100644
--- a/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx
+++ b/src/plugins/dashboard/public/application/actions/clone_panel_action.tsx
@@ -33,14 +33,16 @@ import { CoreStart } from 'src/core/public';
import uuid from 'uuid';
import _ from 'lodash';
import { EuiIconType } from '@elastic/eui/src/components/icon/icon';
-import { ActionByType, IncompatibleActionError } from '../../ui_actions_plugin';
-import { ViewMode, PanelState, IEmbeddable } from '../../embeddable_plugin';
+import { ActionByType, IncompatibleActionError } from '../../../../ui_actions/public';
import { SavedObject } from '../../../../saved_objects/public';
import {
PanelNotFoundError,
EmbeddableInput,
SavedObjectEmbeddableInput,
isErrorEmbeddable,
+ ViewMode,
+ PanelState,
+ IEmbeddable,
} from '../../../../embeddable/public';
import {
placePanelBeside,
diff --git a/src/plugins/dashboard/public/application/actions/expand_panel_action.test.tsx b/src/plugins/dashboard/public/application/actions/expand_panel_action.test.tsx
index 73c57496c79..5298dca2b97 100644
--- a/src/plugins/dashboard/public/application/actions/expand_panel_action.test.tsx
+++ b/src/plugins/dashboard/public/application/actions/expand_panel_action.test.tsx
@@ -28,18 +28,18 @@
* under the License.
*/
-import { isErrorEmbeddable } from '../../embeddable_plugin';
-import { ExpandPanelAction } from './expand_panel_action';
-import { DashboardContainer } from '../embeddable';
-import { getSampleDashboardInput, getSampleDashboardPanel } from '../test_helpers';
+import { isErrorEmbeddable } from '../../../../embeddable/public';
import {
CONTACT_CARD_EMBEDDABLE,
ContactCardEmbeddableFactory,
ContactCardEmbeddable,
ContactCardEmbeddableInput,
ContactCardEmbeddableOutput,
-} from '../../embeddable_plugin_test_samples';
-import { embeddablePluginMock } from 'src/plugins/embeddable/public/mocks';
+} from '../../../../embeddable/public/lib/test_samples';
+import { embeddablePluginMock } from '../../../../embeddable/public/mocks';
+import { ExpandPanelAction } from './expand_panel_action';
+import { DashboardContainer } from '../embeddable';
+import { getSampleDashboardInput, getSampleDashboardPanel } from '../test_helpers';
const { setup, doStart } = embeddablePluginMock.createInstance();
diff --git a/src/plugins/dashboard/public/application/actions/expand_panel_action.tsx b/src/plugins/dashboard/public/application/actions/expand_panel_action.tsx
index 63a69e21b48..4cbdb471844 100644
--- a/src/plugins/dashboard/public/application/actions/expand_panel_action.tsx
+++ b/src/plugins/dashboard/public/application/actions/expand_panel_action.tsx
@@ -30,8 +30,8 @@
import { EuiIconType } from '@elastic/eui/src/components/icon/icon';
import { i18n } from '@osd/i18n';
-import { IEmbeddable } from '../../embeddable_plugin';
-import { ActionByType, IncompatibleActionError } from '../../ui_actions_plugin';
+import { IEmbeddable } from '../../../../embeddable/public';
+import { ActionByType, IncompatibleActionError } from '../../../../ui_actions/public';
import { DASHBOARD_CONTAINER_TYPE, DashboardContainer } from '../embeddable';
export const ACTION_EXPAND_PANEL = 'togglePanel';
diff --git a/src/plugins/dashboard/public/application/actions/library_notification_action.test.tsx b/src/plugins/dashboard/public/application/actions/library_notification_action.test.tsx
index d9a45871e79..e9bb6c0c3ce 100644
--- a/src/plugins/dashboard/public/application/actions/library_notification_action.test.tsx
+++ b/src/plugins/dashboard/public/application/actions/library_notification_action.test.tsx
@@ -28,21 +28,26 @@
* under the License.
*/
-import { isErrorEmbeddable, ReferenceOrValueEmbeddable } from '../../embeddable_plugin';
-import { DashboardContainer } from '../embeddable';
-import { getSampleDashboardInput } from '../test_helpers';
+import {
+ isErrorEmbeddable,
+ ReferenceOrValueEmbeddable,
+ ErrorEmbeddable,
+ IContainer,
+ ViewMode,
+} from '../../../../embeddable/public';
import {
CONTACT_CARD_EMBEDDABLE,
ContactCardEmbeddableFactory,
ContactCardEmbeddable,
ContactCardEmbeddableInput,
ContactCardEmbeddableOutput,
-} from '../../embeddable_plugin_test_samples';
+} from '../../../../embeddable/public/lib/test_samples';
+import { embeddablePluginMock } from '../../../../embeddable/public/mocks';
+import { DashboardContainer } from '../embeddable';
+import { getSampleDashboardInput } from '../test_helpers';
import { coreMock } from '../../../../../core/public/mocks';
import { CoreStart } from 'opensearch-dashboards/public';
import { LibraryNotificationAction } from '.';
-import { embeddablePluginMock } from 'src/plugins/embeddable/public/mocks';
-import { ErrorEmbeddable, IContainer, ViewMode } from '../../../../embeddable/public';
const { setup, doStart } = embeddablePluginMock.createInstance();
setup.registerEmbeddableFactory(
diff --git a/src/plugins/dashboard/public/application/actions/library_notification_action.tsx b/src/plugins/dashboard/public/application/actions/library_notification_action.tsx
index 0522d2a3374..2dc37a7526e 100644
--- a/src/plugins/dashboard/public/application/actions/library_notification_action.tsx
+++ b/src/plugins/dashboard/public/application/actions/library_notification_action.tsx
@@ -37,8 +37,8 @@ import {
ViewMode,
isReferenceOrValueEmbeddable,
isErrorEmbeddable,
-} from '../../embeddable_plugin';
-import { ActionByType, IncompatibleActionError } from '../../ui_actions_plugin';
+} from '../../../../embeddable/public';
+import { ActionByType, IncompatibleActionError } from '../../../../ui_actions/public';
import { reactToUiComponent } from '../../../../opensearch_dashboards_react/public';
export const ACTION_LIBRARY_NOTIFICATION = 'ACTION_LIBRARY_NOTIFICATION';
diff --git a/src/plugins/dashboard/public/application/actions/open_replace_panel_flyout.tsx b/src/plugins/dashboard/public/application/actions/open_replace_panel_flyout.tsx
index 66f5dc21471..d10f92ce7d5 100644
--- a/src/plugins/dashboard/public/application/actions/open_replace_panel_flyout.tsx
+++ b/src/plugins/dashboard/public/application/actions/open_replace_panel_flyout.tsx
@@ -38,7 +38,7 @@ import {
EmbeddableOutput,
EmbeddableStart,
IContainer,
-} from '../../embeddable_plugin';
+} from '../../../../embeddable/public';
export async function openReplacePanelFlyout(options: {
embeddable: IContainer;
diff --git a/src/plugins/dashboard/public/application/actions/replace_panel_action.test.tsx b/src/plugins/dashboard/public/application/actions/replace_panel_action.test.tsx
index b3ac183a6ee..42e2f99f8a5 100644
--- a/src/plugins/dashboard/public/application/actions/replace_panel_action.test.tsx
+++ b/src/plugins/dashboard/public/application/actions/replace_panel_action.test.tsx
@@ -28,20 +28,20 @@
* under the License.
*/
-import { isErrorEmbeddable } from '../../embeddable_plugin';
-import { ReplacePanelAction } from './replace_panel_action';
-import { DashboardContainer } from '../embeddable';
-import { getSampleDashboardInput, getSampleDashboardPanel } from '../test_helpers';
+import { isErrorEmbeddable } from '../../../../embeddable/public';
import {
CONTACT_CARD_EMBEDDABLE,
ContactCardEmbeddableFactory,
ContactCardEmbeddable,
ContactCardEmbeddableInput,
ContactCardEmbeddableOutput,
-} from '../../embeddable_plugin_test_samples';
+} from '../../../../embeddable/public/lib/test_samples';
+import { embeddablePluginMock } from '../../../../embeddable/public/mocks';
+import { ReplacePanelAction } from './replace_panel_action';
+import { DashboardContainer } from '../embeddable';
+import { getSampleDashboardInput, getSampleDashboardPanel } from '../test_helpers';
import { coreMock } from '../../../../../core/public/mocks';
import { CoreStart } from 'opensearch-dashboards/public';
-import { embeddablePluginMock } from 'src/plugins/embeddable/public/mocks';
const { setup, doStart } = embeddablePluginMock.createInstance();
setup.registerEmbeddableFactory(
diff --git a/src/plugins/dashboard/public/application/actions/replace_panel_action.tsx b/src/plugins/dashboard/public/application/actions/replace_panel_action.tsx
index 933986967e9..fa634a170e4 100644
--- a/src/plugins/dashboard/public/application/actions/replace_panel_action.tsx
+++ b/src/plugins/dashboard/public/application/actions/replace_panel_action.tsx
@@ -31,9 +31,9 @@
import { i18n } from '@osd/i18n';
import { CoreStart } from 'src/core/public';
import { EuiIconType } from '@elastic/eui/src/components/icon/icon';
-import { IEmbeddable, ViewMode, EmbeddableStart } from '../../embeddable_plugin';
+import { IEmbeddable, ViewMode, EmbeddableStart } from '../../../../embeddable/public';
import { DASHBOARD_CONTAINER_TYPE, DashboardContainer } from '../embeddable';
-import { ActionByType, IncompatibleActionError } from '../../ui_actions_plugin';
+import { ActionByType, IncompatibleActionError } from '../../../../ui_actions/public';
import { openReplacePanelFlyout } from './open_replace_panel_flyout';
export const ACTION_REPLACE_PANEL = 'replacePanel';
diff --git a/src/plugins/dashboard/public/application/actions/replace_panel_flyout.tsx b/src/plugins/dashboard/public/application/actions/replace_panel_flyout.tsx
index 2ec1db3f42f..be994686cde 100644
--- a/src/plugins/dashboard/public/application/actions/replace_panel_flyout.tsx
+++ b/src/plugins/dashboard/public/application/actions/replace_panel_flyout.tsx
@@ -40,7 +40,7 @@ import {
IContainer,
IEmbeddable,
SavedObjectEmbeddableInput,
-} from '../../embeddable_plugin';
+} from '../../../../embeddable/public';
interface Props {
container: IContainer;
diff --git a/src/plugins/dashboard/public/application/actions/unlink_from_library_action.test.tsx b/src/plugins/dashboard/public/application/actions/unlink_from_library_action.test.tsx
index 11601b40200..8f2511f8c3f 100644
--- a/src/plugins/dashboard/public/application/actions/unlink_from_library_action.test.tsx
+++ b/src/plugins/dashboard/public/application/actions/unlink_from_library_action.test.tsx
@@ -28,25 +28,27 @@
* under the License.
*/
-import { isErrorEmbeddable, IContainer, ReferenceOrValueEmbeddable } from '../../embeddable_plugin';
-import { DashboardContainer } from '../embeddable';
-import { getSampleDashboardInput } from '../test_helpers';
+import {
+ isErrorEmbeddable,
+ IContainer,
+ ReferenceOrValueEmbeddable,
+ ViewMode,
+ SavedObjectEmbeddableInput,
+ ErrorEmbeddable,
+} from '../../../../embeddable/public';
import {
CONTACT_CARD_EMBEDDABLE,
ContactCardEmbeddableFactory,
ContactCardEmbeddable,
ContactCardEmbeddableInput,
ContactCardEmbeddableOutput,
-} from '../../embeddable_plugin_test_samples';
+} from '../../../../embeddable/public/lib/test_samples';
+import { embeddablePluginMock } from '../../../../embeddable/public/mocks';
+import { DashboardContainer } from '../embeddable';
+import { getSampleDashboardInput } from '../test_helpers';
import { coreMock } from '../../../../../core/public/mocks';
import { CoreStart } from 'opensearch-dashboards/public';
import { UnlinkFromLibraryAction } from '.';
-import { embeddablePluginMock } from 'src/plugins/embeddable/public/mocks';
-import {
- ViewMode,
- SavedObjectEmbeddableInput,
- ErrorEmbeddable,
-} from '../../../../embeddable/public';
const { setup, doStart } = embeddablePluginMock.createInstance();
setup.registerEmbeddableFactory(
diff --git a/src/plugins/dashboard/public/application/actions/unlink_from_library_action.tsx b/src/plugins/dashboard/public/application/actions/unlink_from_library_action.tsx
index 82a3b3fb5a0..67518066dd7 100644
--- a/src/plugins/dashboard/public/application/actions/unlink_from_library_action.tsx
+++ b/src/plugins/dashboard/public/application/actions/unlink_from_library_action.tsx
@@ -32,13 +32,15 @@ import { i18n } from '@osd/i18n';
import _ from 'lodash';
import uuid from 'uuid';
import { EuiIconType } from '@elastic/eui/src/components/icon/icon';
-import { ActionByType, IncompatibleActionError } from '../../ui_actions_plugin';
-import { ViewMode, PanelState, IEmbeddable } from '../../embeddable_plugin';
+import { ActionByType, IncompatibleActionError } from '../../../../ui_actions/public';
import {
PanelNotFoundError,
EmbeddableInput,
isReferenceOrValueEmbeddable,
isErrorEmbeddable,
+ ViewMode,
+ PanelState,
+ IEmbeddable,
} from '../../../../embeddable/public';
import { DashboardPanelState, DASHBOARD_CONTAINER_TYPE, DashboardContainer } from '..';
diff --git a/src/plugins/dashboard/public/application/listing/__snapshots__/create_button.test.tsx.snap b/src/plugins/dashboard/public/application/components/dashboard_listing/__snapshots__/create_button.test.tsx.snap
similarity index 100%
rename from src/plugins/dashboard/public/application/listing/__snapshots__/create_button.test.tsx.snap
rename to src/plugins/dashboard/public/application/components/dashboard_listing/__snapshots__/create_button.test.tsx.snap
diff --git a/src/plugins/dashboard/public/application/listing/create_button.test.tsx b/src/plugins/dashboard/public/application/components/dashboard_listing/create_button.test.tsx
similarity index 97%
rename from src/plugins/dashboard/public/application/listing/create_button.test.tsx
rename to src/plugins/dashboard/public/application/components/dashboard_listing/create_button.test.tsx
index 9521df8590e..19c676b9e5b 100644
--- a/src/plugins/dashboard/public/application/listing/create_button.test.tsx
+++ b/src/plugins/dashboard/public/application/components/dashboard_listing/create_button.test.tsx
@@ -15,7 +15,7 @@ import { findTestSubject } from '@elastic/eui/lib/test';
import React from 'react';
import { CreateButton } from './create_button';
-import { DashboardProvider } from '../../types';
+import { DashboardProvider } from '../../../types';
const provider = (type?: string, url?: string, text?: string): DashboardProvider => {
return {
diff --git a/src/plugins/dashboard/public/application/listing/create_button.tsx b/src/plugins/dashboard/public/application/components/dashboard_listing/create_button.tsx
similarity index 98%
rename from src/plugins/dashboard/public/application/listing/create_button.tsx
rename to src/plugins/dashboard/public/application/components/dashboard_listing/create_button.tsx
index 16d17c3568a..2d662309623 100644
--- a/src/plugins/dashboard/public/application/listing/create_button.tsx
+++ b/src/plugins/dashboard/public/application/components/dashboard_listing/create_button.tsx
@@ -11,7 +11,7 @@ import {
EuiFlexItem,
EuiPopover,
} from '@elastic/eui';
-import type { DashboardProvider } from '../../types';
+import type { DashboardProvider } from '../../../types';
interface CreateButtonProps {
dashboardProviders?: { [key: string]: DashboardProvider };
diff --git a/src/plugins/dashboard/public/application/listing/dashboard_listing.test.js b/src/plugins/dashboard/public/application/components/dashboard_listing/dashboard_listing.test.tsx
similarity index 97%
rename from src/plugins/dashboard/public/application/listing/dashboard_listing.test.js
rename to src/plugins/dashboard/public/application/components/dashboard_listing/dashboard_listing.test.tsx
index 23cfacd13fb..3d9c8404be5 100644
--- a/src/plugins/dashboard/public/application/listing/dashboard_listing.test.js
+++ b/src/plugins/dashboard/public/application/components/dashboard_listing/dashboard_listing.test.tsx
@@ -36,8 +36,8 @@ jest.mock(
() => ({
...jest.requireActual('lodash'),
// mock debounce to fire immediately with no internal timer
- debounce: (func) => {
- function debounced(...args) {
+ debounce: (func: any) => {
+ function debounced(this: any, ...args: any[]) {
return func.apply(this, args);
}
return debounced;
@@ -49,9 +49,9 @@ jest.mock(
import React from 'react';
import { shallow } from 'enzyme';
-import { DashboardListing } from '../components/dashboard_listing';
+import { DashboardListing } from './dashboard_listing';
-const find = (num) => {
+const find = (num: number) => {
const hits = [];
for (let i = 0; i < num; i++) {
hits.push({
@@ -62,7 +62,7 @@ const find = (num) => {
}
return Promise.resolve({
total: num,
- hits: hits,
+ hits,
});
};
diff --git a/src/plugins/dashboard/public/application/components/dashboard_listing.tsx b/src/plugins/dashboard/public/application/components/dashboard_listing/dashboard_listing.tsx
similarity index 94%
rename from src/plugins/dashboard/public/application/components/dashboard_listing.tsx
rename to src/plugins/dashboard/public/application/components/dashboard_listing/dashboard_listing.tsx
index df3ff909939..00ce5a713b7 100644
--- a/src/plugins/dashboard/public/application/components/dashboard_listing.tsx
+++ b/src/plugins/dashboard/public/application/components/dashboard_listing/dashboard_listing.tsx
@@ -10,13 +10,13 @@ import { useLocation } from 'react-router-dom';
import {
useOpenSearchDashboards,
TableListView,
-} from '../../../../opensearch_dashboards_react/public';
-import { CreateButton } from '../listing/create_button';
-import { DashboardConstants, createDashboardEditUrl } from '../../dashboard_constants';
-import { DashboardServices } from '../../types';
-import { getTableColumns } from '../utils/get_table_columns';
-import { getNoItemsMessage } from '../utils/get_no_items_message';
-import { syncQueryStateWithUrl } from '../../../../data/public';
+} from '../../../../../opensearch_dashboards_react/public';
+import { CreateButton } from './create_button';
+import { DashboardConstants, createDashboardEditUrl } from '../../../dashboard_constants';
+import { DashboardServices } from '../../../types';
+import { getTableColumns } from '../../utils/get_table_columns';
+import { getNoItemsMessage } from '../../utils/get_no_items_message';
+import { syncQueryStateWithUrl } from '../../../../../data/public';
export const EMPTY_FILTER = '';
diff --git a/src/plugins/dashboard/public/application/components/dashboard_listing/index.ts b/src/plugins/dashboard/public/application/components/dashboard_listing/index.ts
new file mode 100644
index 00000000000..19ded8c611a
--- /dev/null
+++ b/src/plugins/dashboard/public/application/components/dashboard_listing/index.ts
@@ -0,0 +1,7 @@
+/*
+ * Copyright OpenSearch Contributors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+export { CreateButton } from './create_button';
+export { DashboardListing } from './dashboard_listing';
diff --git a/src/plugins/dashboard/public/application/components/dashboard_top_nav.tsx b/src/plugins/dashboard/public/application/components/dashboard_top_nav/dashboard_top_nav.tsx
similarity index 93%
rename from src/plugins/dashboard/public/application/components/dashboard_top_nav.tsx
rename to src/plugins/dashboard/public/application/components/dashboard_top_nav/dashboard_top_nav.tsx
index 157e9a01967..1cc58c78ebc 100644
--- a/src/plugins/dashboard/public/application/components/dashboard_top_nav.tsx
+++ b/src/plugins/dashboard/public/application/components/dashboard_top_nav/dashboard_top_nav.tsx
@@ -7,12 +7,12 @@ import React, { memo, useState, useEffect } from 'react';
import { IndexPattern } from 'src/plugins/data/public';
import { useCallback } from 'react';
import { useLocation } from 'react-router-dom';
-import { useOpenSearchDashboards } from '../../../../opensearch_dashboards_react/public';
-import { getTopNavConfig } from '../top_nav/get_top_nav_config';
-import { DashboardAppStateContainer, DashboardAppState, DashboardServices } from '../../types';
-import { getNavActions } from '../utils/get_nav_actions';
-import { DashboardContainer } from '../embeddable';
-import { Dashboard } from '../../dashboard';
+import { useOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public';
+import { getTopNavConfig } from './top_nav';
+import { DashboardAppStateContainer, DashboardAppState, DashboardServices } from '../../../types';
+import { getNavActions } from '../../utils/get_nav_actions';
+import { DashboardContainer } from '../../embeddable';
+import { Dashboard } from '../../../dashboard';
interface DashboardTopNavProps {
isChromeVisible: boolean;
diff --git a/src/plugins/dashboard/public/application/components/dashboard_top_nav/index.ts b/src/plugins/dashboard/public/application/components/dashboard_top_nav/index.ts
new file mode 100644
index 00000000000..3e50001bd67
--- /dev/null
+++ b/src/plugins/dashboard/public/application/components/dashboard_top_nav/index.ts
@@ -0,0 +1,7 @@
+/*
+ * Copyright OpenSearch Contributors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+export * from './top_nav';
+export { DashboardTopNav, UrlParams } from './dashboard_top_nav';
diff --git a/src/plugins/dashboard/public/application/top_nav/__snapshots__/clone_modal.test.js.snap b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/__snapshots__/clone_modal.test.js.snap
similarity index 100%
rename from src/plugins/dashboard/public/application/top_nav/__snapshots__/clone_modal.test.js.snap
rename to src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/__snapshots__/clone_modal.test.js.snap
diff --git a/src/plugins/dashboard/public/application/top_nav/__snapshots__/save_modal.test.js.snap b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/__snapshots__/save_modal.test.js.snap
similarity index 100%
rename from src/plugins/dashboard/public/application/top_nav/__snapshots__/save_modal.test.js.snap
rename to src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/__snapshots__/save_modal.test.js.snap
diff --git a/src/plugins/dashboard/public/application/top_nav/clone_modal.test.js b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/clone_modal.test.js
similarity index 100%
rename from src/plugins/dashboard/public/application/top_nav/clone_modal.test.js
rename to src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/clone_modal.test.js
diff --git a/src/plugins/dashboard/public/application/top_nav/clone_modal.tsx b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/clone_modal.tsx
similarity index 100%
rename from src/plugins/dashboard/public/application/top_nav/clone_modal.tsx
rename to src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/clone_modal.tsx
diff --git a/src/plugins/dashboard/public/application/top_nav/get_top_nav_config.ts b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/get_top_nav_config.ts
similarity index 98%
rename from src/plugins/dashboard/public/application/top_nav/get_top_nav_config.ts
rename to src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/get_top_nav_config.ts
index aa7c2e2e425..f91f4d47a85 100644
--- a/src/plugins/dashboard/public/application/top_nav/get_top_nav_config.ts
+++ b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/get_top_nav_config.ts
@@ -29,9 +29,9 @@
*/
import { i18n } from '@osd/i18n';
-import { ViewMode } from '../../embeddable_plugin';
+import { ViewMode } from '../../../../../../embeddable/public';
import { TopNavIds } from './top_nav_ids';
-import { NavAction } from '../../types';
+import { NavAction } from '../../../../types';
/**
* @param actions - A mapping of TopNavIds to an action function that should run when the
diff --git a/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/index.ts b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/index.ts
new file mode 100644
index 00000000000..1fca9b941e4
--- /dev/null
+++ b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/index.ts
@@ -0,0 +1,12 @@
+/*
+ * Copyright OpenSearch Contributors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+export * from './clone_modal';
+export * from './get_top_nav_config';
+export * from './options';
+export * from './save_modal';
+export * from './show_clone_modal';
+export * from './show_options_popover';
+export * from './top_nav_ids';
diff --git a/src/plugins/dashboard/public/application/top_nav/options.tsx b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/options.tsx
similarity index 100%
rename from src/plugins/dashboard/public/application/top_nav/options.tsx
rename to src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/options.tsx
diff --git a/src/plugins/dashboard/public/application/top_nav/save_modal.test.js b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/save_modal.test.js
similarity index 96%
rename from src/plugins/dashboard/public/application/top_nav/save_modal.test.js
rename to src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/save_modal.test.js
index 91bdaebe4dc..daf1a8e351a 100644
--- a/src/plugins/dashboard/public/application/top_nav/save_modal.test.js
+++ b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/save_modal.test.js
@@ -31,7 +31,7 @@
import React from 'react';
import { shallowWithI18nProvider } from 'test_utils/enzyme_helpers';
-jest.mock('../../../../saved_objects/public', () => ({
+jest.mock('../../../../../../saved_objects/public', () => ({
SavedObjectSaveModal: () => null,
}));
diff --git a/src/plugins/dashboard/public/application/top_nav/save_modal.tsx b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/save_modal.tsx
similarity index 98%
rename from src/plugins/dashboard/public/application/top_nav/save_modal.tsx
rename to src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/save_modal.tsx
index 205a8e2222f..f8e0fe674df 100644
--- a/src/plugins/dashboard/public/application/top_nav/save_modal.tsx
+++ b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/save_modal.tsx
@@ -32,7 +32,7 @@ import React, { Fragment } from 'react';
import { FormattedMessage } from '@osd/i18n/react';
import { EuiFormRow, EuiTextArea, EuiSwitch } from '@elastic/eui';
-import { SavedObjectSaveModal } from '../../../../saved_objects/public';
+import { SavedObjectSaveModal } from '../../../../../../saved_objects/public';
interface SaveOptions {
newTitle: string;
diff --git a/src/plugins/dashboard/public/application/top_nav/show_clone_modal.tsx b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/show_clone_modal.tsx
similarity index 100%
rename from src/plugins/dashboard/public/application/top_nav/show_clone_modal.tsx
rename to src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/show_clone_modal.tsx
diff --git a/src/plugins/dashboard/public/application/top_nav/show_options_popover.tsx b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/show_options_popover.tsx
similarity index 100%
rename from src/plugins/dashboard/public/application/top_nav/show_options_popover.tsx
rename to src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/show_options_popover.tsx
diff --git a/src/plugins/dashboard/public/application/top_nav/top_nav_ids.ts b/src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/top_nav_ids.ts
similarity index 100%
rename from src/plugins/dashboard/public/application/top_nav/top_nav_ids.ts
rename to src/plugins/dashboard/public/application/components/dashboard_top_nav/top_nav/top_nav_ids.ts
diff --git a/src/plugins/dashboard/public/application/components/index.ts b/src/plugins/dashboard/public/application/components/index.ts
index 27f7e46ad74..23eeb5e7531 100644
--- a/src/plugins/dashboard/public/application/components/index.ts
+++ b/src/plugins/dashboard/public/application/components/index.ts
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-export { DashboardListing } from './dashboard_listing';
+export { DashboardListing, CreateButton } from './dashboard_listing';
export { DashboardEditor } from './dashboard_editor';
export { DashboardNoMatch } from './dashboard_no_match';
export { DashboardTopNav } from './dashboard_top_nav';
diff --git a/src/plugins/dashboard/public/application/dashboard_strings.ts b/src/plugins/dashboard/public/application/dashboard_strings.ts
index ead76e48da7..96713b3fe95 100644
--- a/src/plugins/dashboard/public/application/dashboard_strings.ts
+++ b/src/plugins/dashboard/public/application/dashboard_strings.ts
@@ -29,7 +29,7 @@
*/
import { i18n } from '@osd/i18n';
-import { ViewMode } from '../embeddable_plugin';
+import { ViewMode } from '../../../embeddable/public';
/**
* @param title {string} the current title of the dashboard
diff --git a/src/plugins/dashboard/public/application/embeddable/_dashboard_container.scss b/src/plugins/dashboard/public/application/embeddable/_dashboard_container.scss
index 30774d469b8..e72e52515ef 100644
--- a/src/plugins/dashboard/public/application/embeddable/_dashboard_container.scss
+++ b/src/plugins/dashboard/public/application/embeddable/_dashboard_container.scss
@@ -1,4 +1,5 @@
@import "../../../../embeddable/public/variables";
+@import "./empty/index";
@import "./grid/index";
@import "./panel/index";
@import "./viewport/index";
diff --git a/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx b/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx
index 4daeb276717..faed32d60d2 100644
--- a/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx
+++ b/src/plugins/dashboard/public/application/embeddable/dashboard_container.test.tsx
@@ -28,18 +28,32 @@
* under the License.
*/
+import { I18nProvider } from '@osd/i18n/react';
import { nextTick } from 'test_utils/enzyme_helpers';
-import { isErrorEmbeddable, ViewMode } from '../../embeddable_plugin';
-import { DashboardContainer, DashboardContainerOptions } from './dashboard_container';
-import { getSampleDashboardInput, getSampleDashboardPanel } from '../test_helpers';
+import {
+ CONTEXT_MENU_TRIGGER,
+ EmbeddablePanel,
+ isErrorEmbeddable,
+ ViewMode,
+} from '../../../../embeddable/public';
import {
CONTACT_CARD_EMBEDDABLE,
ContactCardEmbeddableFactory,
ContactCardEmbeddableInput,
ContactCardEmbeddable,
ContactCardEmbeddableOutput,
-} from '../../embeddable_plugin_test_samples';
+ createEditModeAction,
+} from '../../../../embeddable/public/lib/test_samples';
import { embeddablePluginMock } from 'src/plugins/embeddable/public/mocks';
+import { DashboardContainer, DashboardContainerOptions } from './dashboard_container';
+import { getSampleDashboardInput, getSampleDashboardPanel } from '../test_helpers';
+import { inspectorPluginMock } from 'src/plugins/inspector/public/mocks';
+import { uiActionsPluginMock } from 'src/plugins/ui_actions/public/mocks';
+import { applicationServiceMock } from '../../../../../core/public/mocks';
+import React from 'react';
+import { OpenSearchDashboardsContextProvider } from 'src/plugins/opensearch_dashboards_react/public';
+import { mount } from 'enzyme';
+import { findTestSubject } from 'test_utils/helpers';
const options: DashboardContainerOptions = {
application: {} as any,
@@ -145,3 +159,88 @@ test('Container view mode change propagates to new children', async () => {
expect(embeddable.getInput().viewMode).toBe(ViewMode.EDIT);
});
+
+test('DashboardContainer in edit mode shows edit mode actions', async () => {
+ const inspector = inspectorPluginMock.createStartContract();
+ const { setup, doStart } = embeddablePluginMock.createInstance();
+ const uiActionsSetup = uiActionsPluginMock.createSetupContract();
+
+ const editModeAction = createEditModeAction();
+ uiActionsSetup.registerAction(editModeAction);
+ uiActionsSetup.addTriggerAction(CONTEXT_MENU_TRIGGER, editModeAction);
+ setup.registerEmbeddableFactory(
+ CONTACT_CARD_EMBEDDABLE,
+ new ContactCardEmbeddableFactory((() => null) as any, {} as any)
+ );
+
+ const start = doStart();
+
+ const initialInput = getSampleDashboardInput({ viewMode: ViewMode.VIEW });
+ const containerOptions: DashboardContainerOptions = {
+ application: applicationServiceMock.createStartContract(),
+ embeddable: start,
+ notifications: {} as any,
+ overlays: {} as any,
+ inspector: {} as any,
+ SavedObjectFinder: () => null,
+ ExitFullScreenButton: () => null,
+ uiActions: {} as any,
+ };
+ const container = new DashboardContainer(initialInput, containerOptions);
+
+ const embeddable = await container.addNewEmbeddable<
+ ContactCardEmbeddableInput,
+ ContactCardEmbeddableOutput,
+ ContactCardEmbeddable
+ >(CONTACT_CARD_EMBEDDABLE, {
+ firstName: 'Bob',
+ });
+
+ const component = mount(
+
+
+ Promise.resolve([])}
+ getAllEmbeddableFactories={(() => []) as any}
+ getEmbeddableFactory={(() => null) as any}
+ notifications={{} as any}
+ application={containerOptions.application}
+ overlays={{} as any}
+ inspector={inspector}
+ SavedObjectFinder={() => null}
+ />
+
+
+ );
+
+ const button = findTestSubject(component, 'embeddablePanelToggleMenuIcon');
+
+ expect(button.length).toBe(1);
+ findTestSubject(component, 'embeddablePanelToggleMenuIcon').simulate('click');
+
+ expect(findTestSubject(component, `embeddablePanelContextMenuOpen`).length).toBe(1);
+
+ const editAction = findTestSubject(component, `embeddablePanelAction-${editModeAction.id}`);
+
+ expect(editAction.length).toBe(0);
+
+ container.updateInput({ viewMode: ViewMode.EDIT });
+ await nextTick();
+ component.update();
+ findTestSubject(component, 'embeddablePanelToggleMenuIcon').simulate('click');
+ await nextTick();
+ component.update();
+ expect(findTestSubject(component, 'embeddablePanelContextMenuOpen').length).toBe(0);
+ findTestSubject(component, 'embeddablePanelToggleMenuIcon').simulate('click');
+ await nextTick();
+ component.update();
+ expect(findTestSubject(component, 'embeddablePanelContextMenuOpen').length).toBe(1);
+
+ await nextTick();
+ component.update();
+
+ // TODO: Address this.
+ // const action = findTestSubject(component, `embeddablePanelAction-${editModeAction.id}`);
+ // expect(action.length).toBe(1);
+});
diff --git a/src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx b/src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx
index c87c3478558..db647c2760a 100644
--- a/src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx
+++ b/src/plugins/dashboard/public/application/embeddable/dashboard_container.tsx
@@ -37,7 +37,6 @@ import { RefreshInterval, TimeRange, Query, Filter } from 'src/plugins/data/publ
import { CoreStart } from 'src/core/public';
import { Start as InspectorStartContract } from 'src/plugins/inspector/public';
import uuid from 'uuid';
-import { UiActionsStart } from '../../ui_actions_plugin';
import {
Container,
ContainerInput,
@@ -47,7 +46,10 @@ import {
IEmbeddable,
EmbeddableStart,
PanelState,
-} from '../../embeddable_plugin';
+ EmbeddableStateTransfer,
+ EmbeddableOutput,
+} from '../../../../embeddable/public';
+import { UiActionsStart } from '../../../../ui_actions/public';
import { DASHBOARD_CONTAINER_TYPE } from './dashboard_constants';
import { createPanelState } from './panel';
import { DashboardPanelState } from './types';
@@ -59,7 +61,6 @@ import {
} from '../../../../opensearch_dashboards_react/public';
import { PLACEHOLDER_EMBEDDABLE } from './placeholder';
import { PanelPlacementMethod, IPanelPlacementArgs } from './panel/dashboard_panel_placement';
-import { EmbeddableStateTransfer, EmbeddableOutput } from '../../../../embeddable/public';
export interface DashboardContainerInput extends ContainerInput {
viewMode: ViewMode;
diff --git a/src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx b/src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx
index bbfd0f30dd3..b50f561ddab 100644
--- a/src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx
+++ b/src/plugins/dashboard/public/application/embeddable/dashboard_container_factory.tsx
@@ -32,13 +32,14 @@ import { i18n } from '@osd/i18n';
import { UiActionsStart } from 'src/plugins/ui_actions/public';
import { CoreStart, ScopedHistory } from 'src/core/public';
import { Start as InspectorStartContract } from 'src/plugins/inspector/public';
-import { EmbeddableFactory, EmbeddableStart } from '../../../../embeddable/public';
import {
ContainerOutput,
EmbeddableFactoryDefinition,
ErrorEmbeddable,
Container,
-} from '../../embeddable_plugin';
+ EmbeddableFactory,
+ EmbeddableStart,
+} from '../../../../embeddable/public';
import { DashboardContainer, DashboardContainerInput } from './dashboard_container';
import { DASHBOARD_CONTAINER_TYPE } from './dashboard_constants';
diff --git a/src/plugins/dashboard/public/application/__snapshots__/dashboard_empty_screen.test.tsx.snap b/src/plugins/dashboard/public/application/embeddable/empty/__snapshots__/dashboard_empty_screen.test.tsx.snap
similarity index 100%
rename from src/plugins/dashboard/public/application/__snapshots__/dashboard_empty_screen.test.tsx.snap
rename to src/plugins/dashboard/public/application/embeddable/empty/__snapshots__/dashboard_empty_screen.test.tsx.snap
diff --git a/src/plugins/dashboard/public/application/embeddable/empty/_index.scss b/src/plugins/dashboard/public/application/embeddable/empty/_index.scss
new file mode 100644
index 00000000000..e6977a94c5b
--- /dev/null
+++ b/src/plugins/dashboard/public/application/embeddable/empty/_index.scss
@@ -0,0 +1 @@
+@import "./dashboard_empty_screen";
diff --git a/src/plugins/dashboard/public/application/dashboard_empty_screen.scss b/src/plugins/dashboard/public/application/embeddable/empty/dashboard_empty_screen.scss
similarity index 100%
rename from src/plugins/dashboard/public/application/dashboard_empty_screen.scss
rename to src/plugins/dashboard/public/application/embeddable/empty/dashboard_empty_screen.scss
diff --git a/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx b/src/plugins/dashboard/public/application/embeddable/empty/dashboard_empty_screen.test.tsx
similarity index 96%
rename from src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx
rename to src/plugins/dashboard/public/application/embeddable/empty/dashboard_empty_screen.test.tsx
index fd4291b2945..b2c04284ad0 100644
--- a/src/plugins/dashboard/public/application/dashboard_empty_screen.test.tsx
+++ b/src/plugins/dashboard/public/application/embeddable/empty/dashboard_empty_screen.test.tsx
@@ -31,8 +31,8 @@
import React from 'react';
import { mountWithIntl } from 'test_utils/enzyme_helpers';
import { DashboardEmptyScreen, DashboardEmptyScreenProps } from './dashboard_empty_screen';
-import { findTestSubject } from '@elastic/eui/lib/test';
-import { coreMock } from '../../../../core/public/mocks';
+import { findTestSubject } from 'test_utils/helpers';
+import { coreMock } from '../../../../../../core/public/mocks';
describe('DashboardEmptyScreen', () => {
const setupMock = coreMock.createSetup();
diff --git a/src/plugins/dashboard/public/application/dashboard_empty_screen.tsx b/src/plugins/dashboard/public/application/embeddable/empty/dashboard_empty_screen.tsx
similarity index 99%
rename from src/plugins/dashboard/public/application/dashboard_empty_screen.tsx
rename to src/plugins/dashboard/public/application/embeddable/empty/dashboard_empty_screen.tsx
index d7f4a725a6f..558fe0af5f6 100644
--- a/src/plugins/dashboard/public/application/dashboard_empty_screen.tsx
+++ b/src/plugins/dashboard/public/application/embeddable/empty/dashboard_empty_screen.tsx
@@ -28,7 +28,6 @@
* under the License.
*/
-import './dashboard_empty_screen.scss';
import React from 'react';
import { I18nProvider } from '@osd/i18n/react';
import {
diff --git a/src/plugins/dashboard/public/application/dashboard_empty_screen_constants.tsx b/src/plugins/dashboard/public/application/embeddable/empty/dashboard_empty_screen_constants.tsx
similarity index 100%
rename from src/plugins/dashboard/public/application/dashboard_empty_screen_constants.tsx
rename to src/plugins/dashboard/public/application/embeddable/empty/dashboard_empty_screen_constants.tsx
diff --git a/src/plugins/dashboard/public/application/embeddable/empty/index.ts b/src/plugins/dashboard/public/application/embeddable/empty/index.ts
new file mode 100644
index 00000000000..16a579e89bc
--- /dev/null
+++ b/src/plugins/dashboard/public/application/embeddable/empty/index.ts
@@ -0,0 +1,6 @@
+/*
+ * Copyright OpenSearch Contributors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+export { DashboardEmptyScreen, DashboardEmptyScreenProps } from './dashboard_empty_screen';
diff --git a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx
index 48d1a4adc51..ce2dfec622a 100644
--- a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx
+++ b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.test.tsx
@@ -40,9 +40,9 @@ import { getSampleDashboardInput } from '../../test_helpers';
import {
CONTACT_CARD_EMBEDDABLE,
ContactCardEmbeddableFactory,
-} from '../../../embeddable_plugin_test_samples';
+} from '../../../../../embeddable/public/lib/test_samples';
+import { embeddablePluginMock } from '../../../../../embeddable/public/mocks';
import { OpenSearchDashboardsContextProvider } from '../../../../../opensearch_dashboards_react/public';
-import { embeddablePluginMock } from 'src/plugins/embeddable/public/mocks';
let dashboardContainer: DashboardContainer | undefined;
diff --git a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx
index 064a1c5f408..374e20e715d 100644
--- a/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx
+++ b/src/plugins/dashboard/public/application/embeddable/grid/dashboard_grid.tsx
@@ -39,8 +39,8 @@ import _ from 'lodash';
import React from 'react';
import { Subscription } from 'rxjs';
import ReactGridLayout, { Layout, ReactGridLayoutProps } from 'react-grid-layout';
+import { ViewMode, EmbeddableChildPanel, EmbeddableStart } from '../../../../../embeddable/public';
import { GridData } from '../../../../common';
-import { ViewMode, EmbeddableChildPanel, EmbeddableStart } from '../../../embeddable_plugin';
import { DASHBOARD_GRID_COLUMN_COUNT, DASHBOARD_GRID_HEIGHT } from '../dashboard_constants';
import { DashboardPanelState } from '../types';
import { withOpenSearchDashboards } from '../../../../../opensearch_dashboards_react/public';
diff --git a/src/plugins/dashboard/public/application/embeddable/index.ts b/src/plugins/dashboard/public/application/embeddable/index.ts
index 1b5017bee94..b3a8b4cc8d7 100644
--- a/src/plugins/dashboard/public/application/embeddable/index.ts
+++ b/src/plugins/dashboard/public/application/embeddable/index.ts
@@ -36,6 +36,7 @@ export { DashboardContainer, DashboardContainerInput } from './dashboard_contain
export { createPanelState } from './panel';
export * from './types';
+export * from './empty';
export {
DASHBOARD_GRID_COLUMN_COUNT,
diff --git a/src/plugins/dashboard/public/application/embeddable/panel/create_panel_state.test.ts b/src/plugins/dashboard/public/application/embeddable/panel/create_panel_state.test.ts
index 43d15e2d377..b6bfdc1c004 100644
--- a/src/plugins/dashboard/public/application/embeddable/panel/create_panel_state.test.ts
+++ b/src/plugins/dashboard/public/application/embeddable/panel/create_panel_state.test.ts
@@ -31,8 +31,8 @@
import { DEFAULT_PANEL_HEIGHT, DEFAULT_PANEL_WIDTH } from '../dashboard_constants';
import { DashboardPanelState } from '../types';
import { createPanelState } from './create_panel_state';
-import { EmbeddableInput } from '../../../embeddable_plugin';
-import { CONTACT_CARD_EMBEDDABLE } from '../../../embeddable_plugin_test_samples';
+import { EmbeddableInput } from '../../../../../embeddable/public';
+import { CONTACT_CARD_EMBEDDABLE } from '../../../../../embeddable/public/lib/test_samples';
interface TestInput extends EmbeddableInput {
test: string;
diff --git a/src/plugins/dashboard/public/application/embeddable/panel/create_panel_state.ts b/src/plugins/dashboard/public/application/embeddable/panel/create_panel_state.ts
index b99548a3e89..6fba7b8397c 100644
--- a/src/plugins/dashboard/public/application/embeddable/panel/create_panel_state.ts
+++ b/src/plugins/dashboard/public/application/embeddable/panel/create_panel_state.ts
@@ -28,7 +28,7 @@
* under the License.
*/
-import { PanelState, EmbeddableInput } from '../../../embeddable_plugin';
+import { PanelState, EmbeddableInput } from '../../../../../embeddable/public';
import { DEFAULT_PANEL_HEIGHT, DEFAULT_PANEL_WIDTH } from '../dashboard_constants';
import { DashboardPanelState } from '../types';
import {
diff --git a/src/plugins/dashboard/public/application/embeddable/panel/dashboard_panel_placement.ts b/src/plugins/dashboard/public/application/embeddable/panel/dashboard_panel_placement.ts
index 8cf277890cb..690c2e2b75c 100644
--- a/src/plugins/dashboard/public/application/embeddable/panel/dashboard_panel_placement.ts
+++ b/src/plugins/dashboard/public/application/embeddable/panel/dashboard_panel_placement.ts
@@ -29,7 +29,7 @@
*/
import _ from 'lodash';
-import { PanelNotFoundError } from '../../../embeddable_plugin';
+import { PanelNotFoundError } from '../../../../../embeddable/public';
import { GridData } from '../../../../common';
import { DashboardPanelState, DASHBOARD_GRID_COLUMN_COUNT } from '..';
diff --git a/src/plugins/dashboard/public/application/embeddable/placeholder/placeholder_embeddable.tsx b/src/plugins/dashboard/public/application/embeddable/placeholder/placeholder_embeddable.tsx
index 57ecde6b5ce..60882b17921 100644
--- a/src/plugins/dashboard/public/application/embeddable/placeholder/placeholder_embeddable.tsx
+++ b/src/plugins/dashboard/public/application/embeddable/placeholder/placeholder_embeddable.tsx
@@ -32,7 +32,7 @@ import React from 'react';
import ReactDOM from 'react-dom';
import { EuiLoadingChart } from '@elastic/eui';
import classNames from 'classnames';
-import { Embeddable, EmbeddableInput, IContainer } from '../../../embeddable_plugin';
+import { Embeddable, EmbeddableInput, IContainer } from '../../../../../embeddable/public';
export const PLACEHOLDER_EMBEDDABLE = 'placeholder';
diff --git a/src/plugins/dashboard/public/application/embeddable/placeholder/placeholder_embeddable_factory.ts b/src/plugins/dashboard/public/application/embeddable/placeholder/placeholder_embeddable_factory.ts
index 9cf93644307..e89a8efbfa0 100644
--- a/src/plugins/dashboard/public/application/embeddable/placeholder/placeholder_embeddable_factory.ts
+++ b/src/plugins/dashboard/public/application/embeddable/placeholder/placeholder_embeddable_factory.ts
@@ -34,7 +34,7 @@ import {
EmbeddableFactoryDefinition,
EmbeddableInput,
IContainer,
-} from '../../../embeddable_plugin';
+} from '../../../../../embeddable/public';
import { PlaceholderEmbeddable, PLACEHOLDER_EMBEDDABLE } from './placeholder_embeddable';
export class PlaceholderEmbeddableFactory implements EmbeddableFactoryDefinition {
diff --git a/src/plugins/dashboard/public/application/embeddable/types.ts b/src/plugins/dashboard/public/application/embeddable/types.ts
index ed4f90bc6eb..ffa810b6bc0 100644
--- a/src/plugins/dashboard/public/application/embeddable/types.ts
+++ b/src/plugins/dashboard/public/application/embeddable/types.ts
@@ -28,9 +28,12 @@
* under the License.
*/
-import { SavedObjectEmbeddableInput } from 'src/plugins/embeddable/public';
+import {
+ SavedObjectEmbeddableInput,
+ PanelState,
+ EmbeddableInput,
+} from '../../../../embeddable/public';
import { GridData } from '../../../common';
-import { PanelState, EmbeddableInput } from '../../embeddable_plugin';
export type PanelId = string;
export type SavedObjectId = string;
diff --git a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx
index bc1b56b64bf..f03ed95c9a3 100644
--- a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx
+++ b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.test.tsx
@@ -41,9 +41,9 @@ import { getSampleDashboardInput } from '../../test_helpers';
import {
CONTACT_CARD_EMBEDDABLE,
ContactCardEmbeddableFactory,
-} from '../../../embeddable_plugin_test_samples';
+} from '../../../../../embeddable/public/lib/test_samples';
+import { embeddablePluginMock } from '../../../../../embeddable/public/mocks';
import { OpenSearchDashboardsContextProvider } from '../../../../../opensearch_dashboards_react/public';
-import { embeddablePluginMock } from 'src/plugins/embeddable/public/mocks';
import { applicationServiceMock } from '../../../../../../core/public/mocks';
sizeMe.noPlaceholders = true;
diff --git a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx
index 2a98046b4d2..f89c1179cad 100644
--- a/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx
+++ b/src/plugins/dashboard/public/application/embeddable/viewport/dashboard_viewport.tsx
@@ -30,7 +30,7 @@
import React from 'react';
import { Subscription } from 'rxjs';
-import { PanelState, EmbeddableStart } from '../../../embeddable_plugin';
+import { PanelState, EmbeddableStart } from '../../../../../embeddable/public';
import { DashboardContainer, DashboardReactContextValue } from '../dashboard_container';
import { DashboardGrid } from '../grid';
import { context } from '../../../../../opensearch_dashboards_react/public';
diff --git a/src/plugins/dashboard/public/application/embeddable/viewport/index.ts b/src/plugins/dashboard/public/application/embeddable/viewport/index.ts
new file mode 100644
index 00000000000..62b87a15911
--- /dev/null
+++ b/src/plugins/dashboard/public/application/embeddable/viewport/index.ts
@@ -0,0 +1,6 @@
+/*
+ * Copyright OpenSearch Contributors
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+export { DashboardViewport, DashboardViewportProps } from './dashboard_viewport';
diff --git a/src/plugins/dashboard/public/application/index.scss b/src/plugins/dashboard/public/application/index.scss
index bc959543e40..c3d13ce4830 100644
--- a/src/plugins/dashboard/public/application/index.scss
+++ b/src/plugins/dashboard/public/application/index.scss
@@ -3,9 +3,6 @@
@import "./embeddable/panel/index";
@import "./embeddable/viewport/index";
-// Temporary hacks
-@import "./hacks";
-
// Prefix all styles with "dsh" to avoid conflicts.
// Examples
// dshChart
diff --git a/src/plugins/dashboard/public/application/index.tsx b/src/plugins/dashboard/public/application/index.tsx
index 366366eb83d..4b46fd058a3 100644
--- a/src/plugins/dashboard/public/application/index.tsx
+++ b/src/plugins/dashboard/public/application/index.tsx
@@ -8,7 +8,7 @@ import ReactDOM from 'react-dom';
import { Router } from 'react-router-dom';
import { AppMountParameters } from 'opensearch-dashboards/public';
import { OpenSearchDashboardsContextProvider } from '../../../opensearch_dashboards_react/public';
-import { addHelpMenuToAppChrome } from './help_menu/help_menu_util';
+import { addHelpMenuToAppChrome } from './utils';
import { DashboardApp } from './app';
import { DashboardServices } from '../types';
export * from './embeddable';
diff --git a/src/plugins/dashboard/public/application/lib/index.ts b/src/plugins/dashboard/public/application/lib/index.ts
deleted file mode 100644
index e64b0d4c0c4..00000000000
--- a/src/plugins/dashboard/public/application/lib/index.ts
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * SPDX-License-Identifier: Apache-2.0
- *
- * The OpenSearch Contributors require contributions made to
- * this file be licensed under the Apache-2.0 license or a
- * compatible open source license.
- *
- * Any modifications Copyright OpenSearch Contributors. See
- * GitHub history for details.
- */
-
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-export { saveDashboard } from './save_dashboard';
-export { getAppStateDefaults } from './get_app_state_defaults';
-export { migrateAppState } from './migrate_app_state';
-export { getDashboardIdFromUrl } from './url';
diff --git a/src/plugins/dashboard/public/application/listing/__snapshots__/dashboard_listing.test.js.snap b/src/plugins/dashboard/public/application/listing/__snapshots__/dashboard_listing.test.js.snap
deleted file mode 100644
index 8ad036fc120..00000000000
--- a/src/plugins/dashboard/public/application/listing/__snapshots__/dashboard_listing.test.js.snap
+++ /dev/null
@@ -1,743 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`after fetch hideWriteControls 1`] = `
-
-
-
-
-
- }
- />
-
- }
- tableColumns={
- Array [
- Object {
- "field": "title",
- "name": "Title",
- "render": [Function],
- "sortable": true,
- },
- Object {
- "dataType": "string",
- "field": "type",
- "name": "Type",
- "sortable": true,
- },
- Object {
- "dataType": "string",
- "field": "description",
- "name": "Description",
- "sortable": true,
- },
- Object {
- "data-test-subj": "updated-at",
- "dataType": "date",
- "description": "Last update of the saved object",
- "field": "updated_at",
- "name": "Last updated",
- "render": [Function],
- "sortable": true,
- },
- ]
- }
- tableListTitle="Dashboards"
- toastNotifications={Object {}}
- uiSettings={
- Object {
- "get": [MockFunction] {
- "calls": Array [
- Array [
- "dateFormat",
- ],
- ],
- "results": Array [
- Object {
- "type": "return",
- "value": 10,
- },
- ],
- },
- }
- }
- viewItem={null}
- />
-
-`;
-
-exports[`after fetch initialFilter 1`] = `
-
- }
- createItem={[Function]}
- deleteItems={[Function]}
- editItem={[Function]}
- entityName="dashboard"
- entityNamePlural="dashboards"
- findItems={[Function]}
- headingId="dashboardListingHeading"
- initialFilter="my dashboard"
- initialPageSize={10}
- listingLimit={1000}
- noItemsFragment={
-
-
-
-
- }
- body={
-
-
-
-
-
-
-
- ,
- }
- }
- />
-
-
- }
- iconType="dashboardApp"
- title={
-
-
-
- }
- />
-
- }
- tableColumns={
- Array [
- Object {
- "field": "title",
- "name": "Title",
- "render": [Function],
- "sortable": true,
- },
- Object {
- "dataType": "string",
- "field": "type",
- "name": "Type",
- "sortable": true,
- },
- Object {
- "dataType": "string",
- "field": "description",
- "name": "Description",
- "sortable": true,
- },
- Object {
- "data-test-subj": "updated-at",
- "dataType": "date",
- "description": "Last update of the saved object",
- "field": "updated_at",
- "name": "Last updated",
- "render": [Function],
- "sortable": true,
- },
- ]
- }
- tableListTitle="Dashboards"
- toastNotifications={Object {}}
- uiSettings={
- Object {
- "get": [MockFunction] {
- "calls": Array [
- Array [
- "dateFormat",
- ],
- ],
- "results": Array [
- Object {
- "type": "return",
- "value": 10,
- },
- ],
- },
- }
- }
- viewItem={[Function]}
- />
-
-`;
-
-exports[`after fetch renders call to action when no dashboards exist 1`] = `
-
- }
- createItem={[Function]}
- deleteItems={[Function]}
- editItem={[Function]}
- entityName="dashboard"
- entityNamePlural="dashboards"
- findItems={[Function]}
- headingId="dashboardListingHeading"
- initialFilter=""
- initialPageSize={10}
- listingLimit={1}
- noItemsFragment={
-
-
-
-
- }
- body={
-
-
-
-
-
-
-
- ,
- }
- }
- />
-
-
- }
- iconType="dashboardApp"
- title={
-
-
-
- }
- />
-
- }
- tableColumns={
- Array [
- Object {
- "field": "title",
- "name": "Title",
- "render": [Function],
- "sortable": true,
- },
- Object {
- "dataType": "string",
- "field": "type",
- "name": "Type",
- "sortable": true,
- },
- Object {
- "dataType": "string",
- "field": "description",
- "name": "Description",
- "sortable": true,
- },
- Object {
- "data-test-subj": "updated-at",
- "dataType": "date",
- "description": "Last update of the saved object",
- "field": "updated_at",
- "name": "Last updated",
- "render": [Function],
- "sortable": true,
- },
- ]
- }
- tableListTitle="Dashboards"
- toastNotifications={Object {}}
- uiSettings={
- Object {
- "get": [MockFunction] {
- "calls": Array [
- Array [
- "dateFormat",
- ],
- ],
- "results": Array [
- Object {
- "type": "return",
- "value": 10,
- },
- ],
- },
- }
- }
- viewItem={[Function]}
- />
-
-`;
-
-exports[`after fetch renders table rows 1`] = `
-
- }
- createItem={[Function]}
- deleteItems={[Function]}
- editItem={[Function]}
- entityName="dashboard"
- entityNamePlural="dashboards"
- findItems={[Function]}
- headingId="dashboardListingHeading"
- initialFilter=""
- initialPageSize={10}
- listingLimit={1000}
- noItemsFragment={
-
-
-
-
- }
- body={
-
-
-
-
-
-
-
- ,
- }
- }
- />
-
-
- }
- iconType="dashboardApp"
- title={
-
-
-
- }
- />
-
- }
- tableColumns={
- Array [
- Object {
- "field": "title",
- "name": "Title",
- "render": [Function],
- "sortable": true,
- },
- Object {
- "dataType": "string",
- "field": "type",
- "name": "Type",
- "sortable": true,
- },
- Object {
- "dataType": "string",
- "field": "description",
- "name": "Description",
- "sortable": true,
- },
- Object {
- "data-test-subj": "updated-at",
- "dataType": "date",
- "description": "Last update of the saved object",
- "field": "updated_at",
- "name": "Last updated",
- "render": [Function],
- "sortable": true,
- },
- ]
- }
- tableListTitle="Dashboards"
- toastNotifications={Object {}}
- uiSettings={
- Object {
- "get": [MockFunction] {
- "calls": Array [
- Array [
- "dateFormat",
- ],
- ],
- "results": Array [
- Object {
- "type": "return",
- "value": 10,
- },
- ],
- },
- }
- }
- viewItem={[Function]}
- />
-
-`;
-
-exports[`after fetch renders warning when listingLimit is exceeded 1`] = `
-
- }
- createItem={[Function]}
- deleteItems={[Function]}
- editItem={[Function]}
- entityName="dashboard"
- entityNamePlural="dashboards"
- findItems={[Function]}
- headingId="dashboardListingHeading"
- initialFilter=""
- initialPageSize={10}
- listingLimit={1}
- noItemsFragment={
-
-
-
-
- }
- body={
-
-
-
-
-
-
-
- ,
- }
- }
- />
-
-
- }
- iconType="dashboardApp"
- title={
-
-
-
- }
- />
-
- }
- tableColumns={
- Array [
- Object {
- "field": "title",
- "name": "Title",
- "render": [Function],
- "sortable": true,
- },
- Object {
- "dataType": "string",
- "field": "type",
- "name": "Type",
- "sortable": true,
- },
- Object {
- "dataType": "string",
- "field": "description",
- "name": "Description",
- "sortable": true,
- },
- Object {
- "data-test-subj": "updated-at",
- "dataType": "date",
- "description": "Last update of the saved object",
- "field": "updated_at",
- "name": "Last updated",
- "render": [Function],
- "sortable": true,
- },
- ]
- }
- tableListTitle="Dashboards"
- toastNotifications={Object {}}
- uiSettings={
- Object {
- "get": [MockFunction] {
- "calls": Array [
- Array [
- "dateFormat",
- ],
- ],
- "results": Array [
- Object {
- "type": "return",
- "value": 10,
- },
- ],
- },
- }
- }
- viewItem={[Function]}
- />
-
-`;
-
-exports[`renders empty page in before initial fetch to avoid flickering 1`] = `
-
- }
- createItem={[Function]}
- deleteItems={[Function]}
- editItem={[Function]}
- entityName="dashboard"
- entityNamePlural="dashboards"
- findItems={[Function]}
- headingId="dashboardListingHeading"
- initialFilter=""
- initialPageSize={10}
- listingLimit={1000}
- noItemsFragment={
-
-
-
-
- }
- body={
-
-
-
-
-
-
-
- ,
- }
- }
- />
-
-
- }
- iconType="dashboardApp"
- title={
-
-
-
- }
- />
-
- }
- tableColumns={
- Array [
- Object {
- "field": "title",
- "name": "Title",
- "render": [Function],
- "sortable": true,
- },
- Object {
- "dataType": "string",
- "field": "type",
- "name": "Type",
- "sortable": true,
- },
- Object {
- "dataType": "string",
- "field": "description",
- "name": "Description",
- "sortable": true,
- },
- Object {
- "data-test-subj": "updated-at",
- "dataType": "date",
- "description": "Last update of the saved object",
- "field": "updated_at",
- "name": "Last updated",
- "render": [Function],
- "sortable": true,
- },
- ]
- }
- tableListTitle="Dashboards"
- toastNotifications={Object {}}
- uiSettings={
- Object {
- "get": [MockFunction] {
- "calls": Array [
- Array [
- "dateFormat",
- ],
- ],
- "results": Array [
- Object {
- "type": "return",
- "value": 10,
- },
- ],
- },
- }
- }
- viewItem={[Function]}
- />
-
-`;
diff --git a/src/plugins/dashboard/public/application/test_helpers/get_sample_dashboard_input.ts b/src/plugins/dashboard/public/application/test_helpers/get_sample_dashboard_input.ts
index 931c2395cd5..1cfddf2a571 100644
--- a/src/plugins/dashboard/public/application/test_helpers/get_sample_dashboard_input.ts
+++ b/src/plugins/dashboard/public/application/test_helpers/get_sample_dashboard_input.ts
@@ -28,7 +28,7 @@
* under the License.
*/
-import { ViewMode, EmbeddableInput } from '../../embeddable_plugin';
+import { ViewMode, EmbeddableInput } from '../../../../embeddable/public';
import { DashboardContainerInput, DashboardPanelState } from '../embeddable';
export function getSampleDashboardInput(
diff --git a/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx b/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx
deleted file mode 100644
index d3198f6e1e3..00000000000
--- a/src/plugins/dashboard/public/application/tests/dashboard_container.test.tsx
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * SPDX-License-Identifier: Apache-2.0
- *
- * The OpenSearch Contributors require contributions made to
- * this file be licensed under the Apache-2.0 license or a
- * compatible open source license.
- *
- * Any modifications Copyright OpenSearch Contributors. See
- * GitHub history for details.
- */
-
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-import { findTestSubject } from '@elastic/eui/lib/test';
-import React from 'react';
-import { mount } from 'enzyme';
-import { nextTick } from 'test_utils/enzyme_helpers';
-import { I18nProvider } from '@osd/i18n/react';
-import { ViewMode, CONTEXT_MENU_TRIGGER, EmbeddablePanel } from '../../embeddable_plugin';
-import { DashboardContainer, DashboardContainerOptions } from '../embeddable/dashboard_container';
-import { getSampleDashboardInput } from '../test_helpers';
-import {
- CONTACT_CARD_EMBEDDABLE,
- ContactCardEmbeddableFactory,
- ContactCardEmbeddableInput,
- ContactCardEmbeddable,
- ContactCardEmbeddableOutput,
- createEditModeAction,
-} from '../../embeddable_plugin_test_samples';
-import { embeddablePluginMock } from '../../../../embeddable/public/mocks';
-import { inspectorPluginMock } from '../../../../inspector/public/mocks';
-import { OpenSearchDashboardsContextProvider } from '../../../../opensearch_dashboards_react/public';
-import { uiActionsPluginMock } from '../../../../ui_actions/public/mocks';
-import { applicationServiceMock } from '../../../../../core/public/mocks';
-
-test('DashboardContainer in edit mode shows edit mode actions', async () => {
- const inspector = inspectorPluginMock.createStartContract();
- const { setup, doStart } = embeddablePluginMock.createInstance();
- const uiActionsSetup = uiActionsPluginMock.createSetupContract();
-
- const editModeAction = createEditModeAction();
- uiActionsSetup.registerAction(editModeAction);
- uiActionsSetup.addTriggerAction(CONTEXT_MENU_TRIGGER, editModeAction);
- setup.registerEmbeddableFactory(
- CONTACT_CARD_EMBEDDABLE,
- new ContactCardEmbeddableFactory((() => null) as any, {} as any)
- );
-
- const start = doStart();
-
- const initialInput = getSampleDashboardInput({ viewMode: ViewMode.VIEW });
- const options: DashboardContainerOptions = {
- application: applicationServiceMock.createStartContract(),
- embeddable: start,
- notifications: {} as any,
- overlays: {} as any,
- inspector: {} as any,
- SavedObjectFinder: () => null,
- ExitFullScreenButton: () => null,
- uiActions: {} as any,
- };
- const container = new DashboardContainer(initialInput, options);
-
- const embeddable = await container.addNewEmbeddable<
- ContactCardEmbeddableInput,
- ContactCardEmbeddableOutput,
- ContactCardEmbeddable
- >(CONTACT_CARD_EMBEDDABLE, {
- firstName: 'Bob',
- });
-
- const component = mount(
-
-
- Promise.resolve([])}
- getAllEmbeddableFactories={(() => []) as any}
- getEmbeddableFactory={(() => null) as any}
- notifications={{} as any}
- application={options.application}
- overlays={{} as any}
- inspector={inspector}
- SavedObjectFinder={() => null}
- />
-
-
- );
-
- const button = findTestSubject(component, 'embeddablePanelToggleMenuIcon');
-
- expect(button.length).toBe(1);
- findTestSubject(component, 'embeddablePanelToggleMenuIcon').simulate('click');
-
- expect(findTestSubject(component, `embeddablePanelContextMenuOpen`).length).toBe(1);
-
- const editAction = findTestSubject(component, `embeddablePanelAction-${editModeAction.id}`);
-
- expect(editAction.length).toBe(0);
-
- container.updateInput({ viewMode: ViewMode.EDIT });
- await nextTick();
- component.update();
- findTestSubject(component, 'embeddablePanelToggleMenuIcon').simulate('click');
- await nextTick();
- component.update();
- expect(findTestSubject(component, 'embeddablePanelContextMenuOpen').length).toBe(0);
- findTestSubject(component, 'embeddablePanelToggleMenuIcon').simulate('click');
- await nextTick();
- component.update();
- expect(findTestSubject(component, 'embeddablePanelContextMenuOpen').length).toBe(1);
-
- await nextTick();
- component.update();
-
- // TODO: Address this.
- // const action = findTestSubject(component, `embeddablePanelAction-${editModeAction.id}`);
- // expect(action.length).toBe(1);
-});
diff --git a/src/plugins/dashboard/public/application/utils/breadcrumbs.ts b/src/plugins/dashboard/public/application/utils/breadcrumbs.ts
index 55934ead7f3..fa9cef188e5 100644
--- a/src/plugins/dashboard/public/application/utils/breadcrumbs.ts
+++ b/src/plugins/dashboard/public/application/utils/breadcrumbs.ts
@@ -5,7 +5,7 @@
import { i18n } from '@osd/i18n';
import { DashboardConstants } from '../../dashboard_constants';
-import { ViewMode } from '../../embeddable_plugin';
+import { ViewMode } from '../../../../embeddable/public';
export function getLandingBreadcrumbs() {
return [
diff --git a/src/plugins/dashboard/public/application/utils/create_dashboard_app_state.tsx b/src/plugins/dashboard/public/application/utils/create_dashboard_app_state.tsx
index 09b541a5e29..bd6d55b8bc0 100644
--- a/src/plugins/dashboard/public/application/utils/create_dashboard_app_state.tsx
+++ b/src/plugins/dashboard/public/application/utils/create_dashboard_app_state.tsx
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { migrateAppState } from '../lib/migrate_app_state';
+import { migrateAppState } from '../utils/migrate_app_state';
import {
IOsdUrlStateStorage,
createStateContainer,
@@ -15,8 +15,8 @@ import {
DashboardAppStateInUrl,
DashboardServices,
} from '../../types';
-import { ViewMode } from '../../embeddable_plugin';
-import { getDashboardIdFromUrl } from '../lib';
+import { ViewMode } from '../../../../embeddable/public';
+import { getDashboardIdFromUrl } from '../utils';
import { syncQueryStateWithUrl } from '../../../../data/public';
import { SavedObjectDashboard } from '../../saved_dashboards';
diff --git a/src/plugins/dashboard/public/application/utils/create_dashboard_container.tsx b/src/plugins/dashboard/public/application/utils/create_dashboard_container.tsx
index 42ec3460ce2..1c5b06f54e5 100644
--- a/src/plugins/dashboard/public/application/utils/create_dashboard_container.tsx
+++ b/src/plugins/dashboard/public/application/utils/create_dashboard_container.tsx
@@ -24,6 +24,8 @@ import {
DashboardContainer,
DashboardContainerInput,
DashboardPanelState,
+ DashboardEmptyScreen,
+ DashboardEmptyScreenProps,
} from '../embeddable';
import {
ContainerOutput,
@@ -32,12 +34,11 @@ import {
ViewMode,
isErrorEmbeddable,
openAddPanelFlyout,
-} from '../../embeddable_plugin';
+} from '../../../../embeddable/public';
import {
convertPanelStateToSavedDashboardPanel,
convertSavedDashboardPanelToPanelState,
-} from '../lib/embeddable_saved_object_converters';
-import { DashboardEmptyScreen, DashboardEmptyScreenProps } from '../dashboard_empty_screen';
+} from '../utils/embeddable_saved_object_converters';
import {
DashboardAppState,
DashboardAppStateContainer,
@@ -47,7 +48,7 @@ import {
import { getSavedObjectFinder } from '../../../../saved_objects/public';
import { DashboardConstants } from '../../dashboard_constants';
import { SavedObjectDashboard } from '../../saved_dashboards';
-import { migrateLegacyQuery } from '../lib/migrate_legacy_query';
+import { migrateLegacyQuery } from '../utils/migrate_legacy_query';
import { Dashboard } from '../../dashboard';
export const createDashboardContainer = async ({
diff --git a/src/plugins/dashboard/public/application/lib/embeddable_saved_object_converters.test.ts b/src/plugins/dashboard/public/application/utils/embeddable_saved_object_converters.test.ts
similarity index 100%
rename from src/plugins/dashboard/public/application/lib/embeddable_saved_object_converters.test.ts
rename to src/plugins/dashboard/public/application/utils/embeddable_saved_object_converters.test.ts
diff --git a/src/plugins/dashboard/public/application/lib/embeddable_saved_object_converters.ts b/src/plugins/dashboard/public/application/utils/embeddable_saved_object_converters.ts
similarity index 97%
rename from src/plugins/dashboard/public/application/lib/embeddable_saved_object_converters.ts
rename to src/plugins/dashboard/public/application/utils/embeddable_saved_object_converters.ts
index 24630e40500..8087d236097 100644
--- a/src/plugins/dashboard/public/application/lib/embeddable_saved_object_converters.ts
+++ b/src/plugins/dashboard/public/application/utils/embeddable_saved_object_converters.ts
@@ -31,7 +31,7 @@
import { omit } from 'lodash';
import { SavedDashboardPanel } from '../../types';
import { DashboardPanelState } from '../embeddable';
-import { SavedObjectEmbeddableInput } from '../../embeddable_plugin';
+import { SavedObjectEmbeddableInput } from '../../../../embeddable/public';
export function convertSavedDashboardPanelToPanelState(
savedDashboardPanel: SavedDashboardPanel
diff --git a/src/plugins/dashboard/public/application/lib/filter_utils.ts b/src/plugins/dashboard/public/application/utils/filter_utils.ts
similarity index 100%
rename from src/plugins/dashboard/public/application/lib/filter_utils.ts
rename to src/plugins/dashboard/public/application/utils/filter_utils.ts
diff --git a/src/plugins/dashboard/public/application/lib/get_app_state_defaults.ts b/src/plugins/dashboard/public/application/utils/get_app_state_defaults.ts
similarity index 96%
rename from src/plugins/dashboard/public/application/lib/get_app_state_defaults.ts
rename to src/plugins/dashboard/public/application/utils/get_app_state_defaults.ts
index 95e5d70be43..a5bd1b0a1bd 100644
--- a/src/plugins/dashboard/public/application/lib/get_app_state_defaults.ts
+++ b/src/plugins/dashboard/public/application/utils/get_app_state_defaults.ts
@@ -28,7 +28,7 @@
* under the License.
*/
-import { ViewMode } from '../../embeddable_plugin';
+import { ViewMode } from '../../../../embeddable/public';
import { SavedObjectDashboard } from '../../saved_dashboards';
import { DashboardAppStateDefaults } from '../../types';
diff --git a/src/plugins/dashboard/public/application/utils/get_nav_actions.tsx b/src/plugins/dashboard/public/application/utils/get_nav_actions.tsx
index 748e593ac37..3f823f52676 100644
--- a/src/plugins/dashboard/public/application/utils/get_nav_actions.tsx
+++ b/src/plugins/dashboard/public/application/utils/get_nav_actions.tsx
@@ -14,22 +14,24 @@ import {
showSaveModal,
} from '../../../../saved_objects/public';
import { DashboardAppStateContainer, DashboardServices, NavAction } from '../../types';
-import { DashboardSaveModal } from '../top_nav/save_modal';
-import { TopNavIds } from '../top_nav/top_nav_ids';
+import {
+ DashboardSaveModal,
+ TopNavIds,
+ showCloneModal,
+ showOptionsPopover,
+ UrlParams,
+} from '../components/dashboard_top_nav';
import {
EmbeddableFactoryNotFoundError,
EmbeddableInput,
ViewMode,
isErrorEmbeddable,
openAddPanelFlyout,
-} from '../../embeddable_plugin';
-import { showCloneModal } from '../top_nav/show_clone_modal';
-import { showOptionsPopover } from '../top_nav/show_options_popover';
-import { saveDashboard } from '../lib';
+} from '../../../../embeddable/public';
+import { saveDashboard } from '../utils';
import { DashboardContainer } from '../embeddable/dashboard_container';
import { DashboardConstants, createDashboardEditUrl } from '../../dashboard_constants';
import { unhashUrl } from '../../../../opensearch_dashboards_utils/public';
-import { UrlParams } from '../components/dashboard_top_nav';
import { Dashboard } from '../../dashboard';
interface UrlParamsSelectedMap {
diff --git a/src/plugins/dashboard/public/application/help_menu/help_menu_util.ts b/src/plugins/dashboard/public/application/utils/help_menu_util.ts
similarity index 100%
rename from src/plugins/dashboard/public/application/help_menu/help_menu_util.ts
rename to src/plugins/dashboard/public/application/utils/help_menu_util.ts
diff --git a/src/plugins/dashboard/public/application/utils/index.ts b/src/plugins/dashboard/public/application/utils/index.ts
index 3f96a94264b..c39da5a9e6b 100644
--- a/src/plugins/dashboard/public/application/utils/index.ts
+++ b/src/plugins/dashboard/public/application/utils/index.ts
@@ -8,3 +8,9 @@ export * from './get_nav_actions';
export * from './get_no_items_message';
export * from './get_table_columns';
export * from './use';
+
+export { addHelpMenuToAppChrome } from './help_menu_util';
+export { saveDashboard } from './save_dashboard';
+export { getAppStateDefaults } from './get_app_state_defaults';
+export { migrateAppState } from './migrate_app_state';
+export { getDashboardIdFromUrl } from './url';
diff --git a/src/plugins/dashboard/public/application/lib/migrate_app_state.test.ts b/src/plugins/dashboard/public/application/utils/migrate_app_state.test.ts
similarity index 100%
rename from src/plugins/dashboard/public/application/lib/migrate_app_state.test.ts
rename to src/plugins/dashboard/public/application/utils/migrate_app_state.test.ts
diff --git a/src/plugins/dashboard/public/application/lib/migrate_app_state.ts b/src/plugins/dashboard/public/application/utils/migrate_app_state.ts
similarity index 100%
rename from src/plugins/dashboard/public/application/lib/migrate_app_state.ts
rename to src/plugins/dashboard/public/application/utils/migrate_app_state.ts
diff --git a/src/plugins/dashboard/public/application/lib/migrate_legacy_query.ts b/src/plugins/dashboard/public/application/utils/migrate_legacy_query.ts
similarity index 100%
rename from src/plugins/dashboard/public/application/lib/migrate_legacy_query.ts
rename to src/plugins/dashboard/public/application/utils/migrate_legacy_query.ts
diff --git a/src/plugins/dashboard/public/application/lib/save_dashboard.ts b/src/plugins/dashboard/public/application/utils/save_dashboard.ts
similarity index 100%
rename from src/plugins/dashboard/public/application/lib/save_dashboard.ts
rename to src/plugins/dashboard/public/application/utils/save_dashboard.ts
diff --git a/src/plugins/dashboard/public/application/utils/stubs.ts b/src/plugins/dashboard/public/application/utils/stubs.ts
index c101f30f4f1..6ed04ea2b00 100644
--- a/src/plugins/dashboard/public/application/utils/stubs.ts
+++ b/src/plugins/dashboard/public/application/utils/stubs.ts
@@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
-import { ViewMode } from '../../embeddable_plugin';
+import { ViewMode } from '../../../../embeddable/public';
import { DashboardAppState } from '../../types';
export const dashboardAppStateStub: DashboardAppState = {
diff --git a/src/plugins/dashboard/public/application/lib/update_saved_dashboard.ts b/src/plugins/dashboard/public/application/utils/update_saved_dashboard.ts
similarity index 100%
rename from src/plugins/dashboard/public/application/lib/update_saved_dashboard.ts
rename to src/plugins/dashboard/public/application/utils/update_saved_dashboard.ts
diff --git a/src/plugins/dashboard/public/application/lib/url.test.ts b/src/plugins/dashboard/public/application/utils/url.test.ts
similarity index 100%
rename from src/plugins/dashboard/public/application/lib/url.test.ts
rename to src/plugins/dashboard/public/application/utils/url.test.ts
diff --git a/src/plugins/dashboard/public/application/lib/url.ts b/src/plugins/dashboard/public/application/utils/url.ts
similarity index 100%
rename from src/plugins/dashboard/public/application/lib/url.ts
rename to src/plugins/dashboard/public/application/utils/url.ts
diff --git a/src/plugins/dashboard/public/application/utils/use/use_dashboard_app_state.tsx b/src/plugins/dashboard/public/application/utils/use/use_dashboard_app_state.tsx
index e8655a889e4..84be8484023 100644
--- a/src/plugins/dashboard/public/application/utils/use/use_dashboard_app_state.tsx
+++ b/src/plugins/dashboard/public/application/utils/use/use_dashboard_app_state.tsx
@@ -9,11 +9,11 @@ import { cloneDeep } from 'lodash';
import { map } from 'rxjs/operators';
import { Subscription, merge } from 'rxjs';
import { IndexPattern, connectToQueryState, opensearchFilters } from '../../../../../data/public';
-import { migrateLegacyQuery } from '../../lib/migrate_legacy_query';
+import { migrateLegacyQuery } from '../../utils/migrate_legacy_query';
import { DashboardServices } from '../../../types';
import { DashboardAppStateContainer } from '../../../types';
-import { migrateAppState, getAppStateDefaults } from '../../lib';
+import { migrateAppState, getAppStateDefaults } from '../../utils';
import { createDashboardGlobalAndAppState, updateStateUrl } from '../create_dashboard_app_state';
import { SavedObjectDashboard } from '../../../saved_dashboards';
import {
diff --git a/src/plugins/dashboard/public/application/utils/use/use_editor_updates.test.ts b/src/plugins/dashboard/public/application/utils/use/use_editor_updates.test.ts
index 35ef05c7445..0e19a01d9ce 100644
--- a/src/plugins/dashboard/public/application/utils/use/use_editor_updates.test.ts
+++ b/src/plugins/dashboard/public/application/utils/use/use_editor_updates.test.ts
@@ -14,7 +14,7 @@ import { createDashboardServicesMock } from '../mocks';
import { Dashboard } from '../../../dashboard';
import { convertToSerializedDashboard } from '../../../saved_dashboards/_saved_dashboard';
import { setBreadcrumbsForExistingDashboard, setBreadcrumbsForNewDashboard } from '../breadcrumbs';
-import { ViewMode } from '../../../embeddable_plugin';
+import { ViewMode } from '../../../../../embeddable/public';
describe('useEditorUpdates', () => {
const eventEmitter = new EventEmitter();
diff --git a/src/plugins/dashboard/public/attribute_service/attribute_service.tsx b/src/plugins/dashboard/public/attribute_service/attribute_service.tsx
index 2588793fe7f..2690ebc5e2e 100644
--- a/src/plugins/dashboard/public/attribute_service/attribute_service.tsx
+++ b/src/plugins/dashboard/public/attribute_service/attribute_service.tsx
@@ -39,7 +39,7 @@ import {
Container,
EmbeddableStart,
EmbeddableFactoryNotFoundError,
-} from '../embeddable_plugin';
+} from '../../../embeddable/public';
import { I18nStart, NotificationsStart } from '../../../../core/public';
import { SavedObjectSaveModal, OnSaveProps, SaveResult } from '../../../saved_objects/public';
diff --git a/src/plugins/dashboard/public/embeddable_plugin.ts b/src/plugins/dashboard/public/embeddable_plugin.ts
deleted file mode 100644
index 3ede8156ee8..00000000000
--- a/src/plugins/dashboard/public/embeddable_plugin.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * SPDX-License-Identifier: Apache-2.0
- *
- * The OpenSearch Contributors require contributions made to
- * this file be licensed under the Apache-2.0 license or a
- * compatible open source license.
- *
- * Any modifications Copyright OpenSearch Contributors. See
- * GitHub history for details.
- */
-
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-export * from '../../../plugins/embeddable/public';
diff --git a/src/plugins/dashboard/public/embeddable_plugin_test_samples.ts b/src/plugins/dashboard/public/embeddable_plugin_test_samples.ts
deleted file mode 100644
index a3fc916e830..00000000000
--- a/src/plugins/dashboard/public/embeddable_plugin_test_samples.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * SPDX-License-Identifier: Apache-2.0
- *
- * The OpenSearch Contributors require contributions made to
- * this file be licensed under the Apache-2.0 license or a
- * compatible open source license.
- *
- * Any modifications Copyright OpenSearch Contributors. See
- * GitHub history for details.
- */
-
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-export * from '../../../plugins/embeddable/public/lib/test_samples';
diff --git a/src/plugins/dashboard/public/types.ts b/src/plugins/dashboard/public/types.ts
index c888eb87c59..d8eaada6d62 100644
--- a/src/plugins/dashboard/public/types.ts
+++ b/src/plugins/dashboard/public/types.ts
@@ -52,8 +52,8 @@ import { SharePluginStart } from 'src/plugins/share/public';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/public';
import { UrlForwardingStart } from 'src/plugins/url_forwarding/public';
import { History } from 'history';
+import { EmbeddableStart, ViewMode } from '../../embeddable/public';
import { NavigationPublicPluginStart as NavigationStart } from '../../navigation/public';
-import { EmbeddableStart, ViewMode } from './embeddable_plugin';
import { SavedDashboardPanel730ToLatest } from '../common';
export interface DashboardCapabilities {
diff --git a/src/plugins/dashboard/public/ui_actions_plugin.ts b/src/plugins/dashboard/public/ui_actions_plugin.ts
deleted file mode 100644
index 7e4578a641e..00000000000
--- a/src/plugins/dashboard/public/ui_actions_plugin.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * SPDX-License-Identifier: Apache-2.0
- *
- * The OpenSearch Contributors require contributions made to
- * this file be licensed under the Apache-2.0 license or a
- * compatible open source license.
- *
- * Any modifications Copyright OpenSearch Contributors. See
- * GitHub history for details.
- */
-
-/*
- * Licensed to Elasticsearch B.V. under one or more contributor
- * license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright
- * ownership. Elasticsearch B.V. licenses this file to you under
- * the Apache License, Version 2.0 (the "License"); you may
- * not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-export * from '../../../plugins/ui_actions/public';