From d0633f7c7cc154480f58ac4ad2187e96a93313f2 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Thu, 5 Sep 2024 02:11:18 +0000 Subject: [PATCH] [Workspace] Enable direct query connections to support in workspace (#7839) * add dqc Signed-off-by: yubonluo * add dircet query connections on the detail page Signed-off-by: yubonluo * Changeset file for PR #7839 created/updated * delete useless code Signed-off-by: yubonluo * optimize the code Signed-off-by: yubonluo * optimize the code Signed-off-by: yubonluo * Refactor association modal Signed-off-by: Kapian1234 * Integrate modal with workspace detail page Signed-off-by: Lin Wang * Fix parent data source unchecked Signed-off-by: Lin Wang * Remove all tab and sort connections by name alphabetical Signed-off-by: Lin Wang * optimzie Signed-off-by: yubonluo * Fix checked status disappear after modal tab change Signed-off-by: Lin Wang * optimize the dqc table Signed-off-by: yubonluo * optimize the code Signed-off-by: yubonluo * update the table css Signed-off-by: yubonluo * Simplify options update logic Signed-off-by: Lin Wang * Add unit tests for AssociationDataSourceModal Signed-off-by: Lin Wang * add unit test Signed-off-by: yubonluo * optimize the code Signed-off-by: yubonluo * Add nested support in associate data source modal Signed-off-by: Lin Wang * delete useless code Signed-off-by: yubonluo * Change back type Signed-off-by: Lin Wang * Update type in modal UT Signed-off-by: Lin Wang * optimize the code Signed-off-by: yubonluo --------- Signed-off-by: yubonluo Signed-off-by: Kapian1234 Signed-off-by: Lin Wang Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> Co-authored-by: Kapian1234 Co-authored-by: Lin Wang Co-authored-by: Yulong Ruan (cherry picked from commit 07988656279b7f696a2e008001300ca3c5c9ef2f) Signed-off-by: github-actions[bot] --- changelogs/fragments/7839.yml | 2 + .../data_source_management/public/index.ts | 3 +- src/plugins/workspace/common/constants.ts | 4 + src/plugins/workspace/common/types.ts | 15 + .../workspace/opensearch_dashboards.json | 2 +- .../public/assets/prometheus_logo.svg | 9 + .../workspace/public/assets/s3_logo.svg | 9 + .../workspace_detail.test.tsx.snap | 2 +- .../association_data_source_modal.test.tsx | 181 ++++++++++ .../association_data_source_modal.tsx | 256 +++++++++++--- .../data_source_connection_table.scss | 19 + .../data_source_connection_table.test.tsx | 188 ++++++++++ .../data_source_connection_table.tsx | 330 ++++++++++++++++++ .../opensearch_connections_table.tsx | 223 ------------ .../select_data_source_panel.test.tsx | 323 +++++++++++------ .../select_data_source_panel.tsx | 150 +++++++- .../workspace_detail.test.tsx | 4 +- .../workspace_detail/workspace_detail.tsx | 4 +- .../components/workspace_form/constants.ts | 2 +- .../direct_query_connection_icon.tsx | 21 ++ .../public/components/workspace_form/index.ts | 1 + .../public/components/workspace_form/types.ts | 2 +- .../public/components/workspace_form/utils.ts | 3 +- src/plugins/workspace/public/utils.ts | 74 +++- 24 files changed, 1426 insertions(+), 401 deletions(-) create mode 100644 changelogs/fragments/7839.yml create mode 100644 src/plugins/workspace/public/assets/prometheus_logo.svg create mode 100644 src/plugins/workspace/public/assets/s3_logo.svg create mode 100644 src/plugins/workspace/public/components/workspace_detail/association_data_source_modal.test.tsx create mode 100644 src/plugins/workspace/public/components/workspace_detail/data_source_connection_table.scss create mode 100644 src/plugins/workspace/public/components/workspace_detail/data_source_connection_table.test.tsx create mode 100644 src/plugins/workspace/public/components/workspace_detail/data_source_connection_table.tsx delete mode 100644 src/plugins/workspace/public/components/workspace_detail/opensearch_connections_table.tsx create mode 100644 src/plugins/workspace/public/components/workspace_form/direct_query_connection_icon.tsx diff --git a/changelogs/fragments/7839.yml b/changelogs/fragments/7839.yml new file mode 100644 index 000000000000..3ba2fdc290e2 --- /dev/null +++ b/changelogs/fragments/7839.yml @@ -0,0 +1,2 @@ +fix: +- Enable direct query connections to support in workspace ([#7839](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7839)) \ No newline at end of file diff --git a/src/plugins/data_source_management/public/index.ts b/src/plugins/data_source_management/public/index.ts index 35a0474947d2..11c2864ec86f 100644 --- a/src/plugins/data_source_management/public/index.ts +++ b/src/plugins/data_source_management/public/index.ts @@ -11,7 +11,7 @@ export function plugin() { return new DataSourceManagementPlugin(); } -export { DataSourceManagementPluginStart } from './types'; +export { DataSourceManagementPluginStart, DirectQueryDatasourceDetails } from './types'; export { DataSourceSelector, DataSourceOption } from './components/data_source_selector'; export { DataSourceMenu } from './components/data_source_menu'; export { DataSourceManagementPlugin, DataSourceManagementPluginSetup } from './plugin'; @@ -26,3 +26,4 @@ export { } from './components/data_source_menu'; export { DataSourceSelectionService } from './service/data_source_selection_service'; export { getDefaultDataSourceId, getDefaultDataSourceId$ } from './components/utils'; +export { DATACONNECTIONS_BASE, DatasourceTypeToDisplayName } from './constants'; diff --git a/src/plugins/workspace/common/constants.ts b/src/plugins/workspace/common/constants.ts index 9556fea42b89..f66f7ea71752 100644 --- a/src/plugins/workspace/common/constants.ts +++ b/src/plugins/workspace/common/constants.ts @@ -148,4 +148,8 @@ export const CURRENT_USER_PLACEHOLDER = '%me%'; export const MAX_WORKSPACE_NAME_LENGTH = 40; export const MAX_WORKSPACE_DESCRIPTION_LENGTH = 200; +export enum AssociationDataSourceModalMode { + OpenSearchConnections = 'opensearch-connections', + DirectQueryConnections = 'direction-query-connections', +} export const USE_CASE_PREFIX = 'use-case-'; diff --git a/src/plugins/workspace/common/types.ts b/src/plugins/workspace/common/types.ts index cf621a09143e..4b64f62d9e29 100644 --- a/src/plugins/workspace/common/types.ts +++ b/src/plugins/workspace/common/types.ts @@ -12,3 +12,18 @@ export type DataSource = Pick< // Id defined in SavedObjectAttribute could be single or array, here only should be single string. id: string; }; + +export enum DataSourceConnectionType { + OpenSearchConnection, + DirectQueryConnection, +} + +export interface DataSourceConnection { + id: string; + type: string | undefined; + parentId?: string; + connectionType: DataSourceConnectionType; + name: string; + description?: string; + relatedConnections?: DataSourceConnection[]; +} diff --git a/src/plugins/workspace/opensearch_dashboards.json b/src/plugins/workspace/opensearch_dashboards.json index 9818ab60966d..2cbdab7f012c 100644 --- a/src/plugins/workspace/opensearch_dashboards.json +++ b/src/plugins/workspace/opensearch_dashboards.json @@ -9,5 +9,5 @@ "navigation" ], "optionalPlugins": ["savedObjectsManagement","management","dataSourceManagement","contentManagement"], - "requiredBundles": ["opensearchDashboardsReact","dataSource","contentManagement"] + "requiredBundles": ["opensearchDashboardsReact","dataSource", "dataSourceManagement","contentManagement"] } diff --git a/src/plugins/workspace/public/assets/prometheus_logo.svg b/src/plugins/workspace/public/assets/prometheus_logo.svg new file mode 100644 index 000000000000..e21c6a7e2859 --- /dev/null +++ b/src/plugins/workspace/public/assets/prometheus_logo.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/plugins/workspace/public/assets/s3_logo.svg b/src/plugins/workspace/public/assets/s3_logo.svg new file mode 100644 index 000000000000..5b0c3a35aaad --- /dev/null +++ b/src/plugins/workspace/public/assets/s3_logo.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/src/plugins/workspace/public/components/workspace_detail/__snapshots__/workspace_detail.test.tsx.snap b/src/plugins/workspace/public/components/workspace_detail/__snapshots__/workspace_detail.test.tsx.snap index bb99a1438265..d8a0e9e00ec9 100644 --- a/src/plugins/workspace/public/components/workspace_detail/__snapshots__/workspace_detail.test.tsx.snap +++ b/src/plugins/workspace/public/components/workspace_detail/__snapshots__/workspace_detail.test.tsx.snap @@ -177,7 +177,7 @@ exports[`WorkspaceDetail render workspace detail page normally 1`] = ` - Data Sources + Data sources