From 0b2bb1b6b6f85e27ebdadcc61328d019d2ea8602 Mon Sep 17 00:00:00 2001 From: Kapian1234 Date: Mon, 30 Sep 2024 13:23:27 +0800 Subject: [PATCH 1/8] refactor association panel Signed-off-by: Kapian1234 --- .../workspace_creator_form.tsx | 20 +++++++++++++------ .../select_data_source_panel.tsx | 6 +++--- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx b/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx index 459ed4085920..ccaf6b3408d7 100644 --- a/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx +++ b/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx @@ -4,7 +4,15 @@ */ import React, { useCallback, useRef } from 'react'; -import { EuiSpacer, EuiTitle, EuiForm, EuiText, EuiFlexItem, EuiFlexGroup } from '@elastic/eui'; +import { + EuiSpacer, + EuiTitle, + EuiForm, + EuiText, + EuiFlexItem, + EuiFlexGroup, + EuiPanel, +} from '@elastic/eui'; import { i18n } from '@osd/i18n'; import { useWorkspaceForm, @@ -109,7 +117,7 @@ export const WorkspaceCreatorForm = (props: WorkspaceCreatorFormProps) => { {/* SelectDataSourcePanel is only visible for dashboard admin and when data source is enabled*/} {isDashboardAdmin && isDataSourceEnabled && ( - <> + { {i18n.translate('workspace.creator.form.associateDataSourceDescription', { defaultMessage: - 'Add data sources that will be available in the workspace. If a selected OpenSearch connection has embedded Direct Query connection, they will also be available in the workspace.', + 'Add at least one data source that will be available in the workspace. If a selected OpenSearch connection has related Direct Query connections, they will also be available in the workspace.', })} { data-test-subj={`workspaceForm-dataSourcePanel`} showDataSourceManagement={true} /> - - - + )} + + {permissionEnabled && ( <> {i18n.translate('workspace.form.selectDataSourcePanel.addNew', { - defaultMessage: 'Add OpenSearch connections', + defaultMessage: 'Associate OpenSearch connections', })} ); @@ -94,7 +94,7 @@ export const SelectDataSourcePanel = ({ data-test-subj="workspace-creator-dqc-assign-button" > {i18n.translate('workspace.form.selectDataSourcePanel.addNewDQCs', { - defaultMessage: 'Add direct query connections', + defaultMessage: 'Associate direct query connections', })} ); @@ -130,7 +130,7 @@ export const SelectDataSourcePanel = ({ {addDirectQueryConnectionsButton} )} - + {assignedDataSourceConnections.length > 0 && } {assignedDataSourceConnections.length > 0 && renderTableContent()} From 0c5b90f94704919149bab74bb47051411d7dba4d Mon Sep 17 00:00:00 2001 From: "opensearch-changeset-bot[bot]" <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> Date: Mon, 30 Sep 2024 05:28:59 +0000 Subject: [PATCH 2/8] Changeset file for PR #8383 created/updated --- changelogs/fragments/8383.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelogs/fragments/8383.yml diff --git a/changelogs/fragments/8383.yml b/changelogs/fragments/8383.yml new file mode 100644 index 000000000000..db594be75661 --- /dev/null +++ b/changelogs/fragments/8383.yml @@ -0,0 +1,2 @@ +feat: +- Refactor data source association panel ([#8383](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8383)) \ No newline at end of file From 2165f38431532f6674acd05f86cdf2db5fb0adbd Mon Sep 17 00:00:00 2001 From: Kapian1234 Date: Mon, 30 Sep 2024 13:54:48 +0800 Subject: [PATCH 3/8] resolve some issues Signed-off-by: Kapian1234 --- .../workspace_creator_form.tsx | 54 ++++++++++--------- .../select_data_source_panel.tsx | 4 +- .../workspace_permission_setting_input.tsx | 3 +- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx b/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx index ccaf6b3408d7..de681c235955 100644 --- a/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx +++ b/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx @@ -117,34 +117,36 @@ export const WorkspaceCreatorForm = (props: WorkspaceCreatorFormProps) => { {/* SelectDataSourcePanel is only visible for dashboard admin and when data source is enabled*/} {isDashboardAdmin && isDataSourceEnabled && ( - - -

- {i18n.translate('workspace.creator.form.associateDataSourceTitle', { - defaultMessage: 'Associate data sources', + <> + + +

+ {i18n.translate('workspace.creator.form.associateDataSourceTitle', { + defaultMessage: 'Associate data sources', + })} +

+
+ + {i18n.translate('workspace.creator.form.associateDataSourceDescription', { + defaultMessage: + 'Add at least one data source that will be available in the workspace. If a selected OpenSearch connection has related Direct Query connections, they will also be available in the workspace.', })} -

-
- - {i18n.translate('workspace.creator.form.associateDataSourceDescription', { - defaultMessage: - 'Add at least one data source that will be available in the workspace. If a selected OpenSearch connection has related Direct Query connections, they will also be available in the workspace.', - })} - - -
+ + + + + + )} - - {permissionEnabled && ( <> {assignedDataSourceConnections.length > 0 && } - - {assignedDataSourceConnections.length > 0 && renderTableContent()} - + {assignedDataSourceConnections.length > 0 && renderTableContent()} {modalVisible && chrome && ( Date: Mon, 30 Sep 2024 14:08:46 +0800 Subject: [PATCH 4/8] update title style Signed-off-by: Kapian1234 --- .../components/workspace_creator/workspace_creator_form.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx b/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx index de681c235955..dca2ad6b7100 100644 --- a/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx +++ b/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx @@ -123,11 +123,11 @@ export const WorkspaceCreatorForm = (props: WorkspaceCreatorFormProps) => { {...generateRightSidebarScrollProps(RightSidebarScrollField.DataSource)} size="s" > -

+

{i18n.translate('workspace.creator.form.associateDataSourceTitle', { defaultMessage: 'Associate data sources', })} -

+
{i18n.translate('workspace.creator.form.associateDataSourceDescription', { From 57bcdff98c1f024c512494126c49efb301760b0b Mon Sep 17 00:00:00 2001 From: Kapian1234 Date: Mon, 30 Sep 2024 15:59:24 +0800 Subject: [PATCH 5/8] update title style Signed-off-by: Kapian1234 --- .../components/workspace_creator/workspace_creator_form.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx b/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx index dca2ad6b7100..d0df618c091b 100644 --- a/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx +++ b/src/plugins/workspace/public/components/workspace_creator/workspace_creator_form.tsx @@ -119,7 +119,7 @@ export const WorkspaceCreatorForm = (props: WorkspaceCreatorFormProps) => { {isDashboardAdmin && isDataSourceEnabled && ( <> - @@ -128,7 +128,7 @@ export const WorkspaceCreatorForm = (props: WorkspaceCreatorFormProps) => { defaultMessage: 'Associate data sources', })} - + {i18n.translate('workspace.creator.form.associateDataSourceDescription', { defaultMessage: From 892fe168683999e969643b520aca9a13e1be6e84 Mon Sep 17 00:00:00 2001 From: Kapian1234 Date: Mon, 30 Sep 2024 17:31:43 +0800 Subject: [PATCH 6/8] update placeholder Signed-off-by: Kapian1234 --- .../workspace_form/workspace_permission_setting_input.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/workspace/public/components/workspace_form/workspace_permission_setting_input.tsx b/src/plugins/workspace/public/components/workspace_form/workspace_permission_setting_input.tsx index ee856cbe7b1b..60a554035ae4 100644 --- a/src/plugins/workspace/public/components/workspace_form/workspace_permission_setting_input.tsx +++ b/src/plugins/workspace/public/components/workspace_form/workspace_permission_setting_input.tsx @@ -174,7 +174,7 @@ export const WorkspacePermissionSettingInput = ({ placeholder={ type === WorkspacePermissionItemType.User ? i18n.translate('workspaceForm.permissionSetting.selectUser', { - defaultMessage: 'Enter user name or email address', + defaultMessage: 'Enter user name or user ID', }) : i18n.translate('workspaceForm.permissionSetting.selectUserGroup', { defaultMessage: 'Enter group name or group ID', From 416d935c2721e35d55fa48f5043182313b3ad480 Mon Sep 17 00:00:00 2001 From: Kapian1234 Date: Mon, 30 Sep 2024 17:34:15 +0800 Subject: [PATCH 7/8] update placeholder Signed-off-by: Kapian1234 --- .../workspace_form/workspace_permission_setting_input.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/workspace/public/components/workspace_form/workspace_permission_setting_input.tsx b/src/plugins/workspace/public/components/workspace_form/workspace_permission_setting_input.tsx index 60a554035ae4..ba99c31bd3e0 100644 --- a/src/plugins/workspace/public/components/workspace_form/workspace_permission_setting_input.tsx +++ b/src/plugins/workspace/public/components/workspace_form/workspace_permission_setting_input.tsx @@ -174,7 +174,7 @@ export const WorkspacePermissionSettingInput = ({ placeholder={ type === WorkspacePermissionItemType.User ? i18n.translate('workspaceForm.permissionSetting.selectUser', { - defaultMessage: 'Enter user name or user ID', + defaultMessage: 'Enter user name or uer ID', }) : i18n.translate('workspaceForm.permissionSetting.selectUserGroup', { defaultMessage: 'Enter group name or group ID', From b768623041f7d0719aa3a4986f7009a64f90200d Mon Sep 17 00:00:00 2001 From: Kapian1234 Date: Mon, 30 Sep 2024 17:35:40 +0800 Subject: [PATCH 8/8] / Signed-off-by: Kapian1234 --- .../workspace_form/workspace_permission_setting_input.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/workspace/public/components/workspace_form/workspace_permission_setting_input.tsx b/src/plugins/workspace/public/components/workspace_form/workspace_permission_setting_input.tsx index ba99c31bd3e0..cece5fe4100c 100644 --- a/src/plugins/workspace/public/components/workspace_form/workspace_permission_setting_input.tsx +++ b/src/plugins/workspace/public/components/workspace_form/workspace_permission_setting_input.tsx @@ -9,6 +9,7 @@ import { EuiFlexItem, EuiButtonIcon, EuiSuperSelect, + EuiSuperSelectOption, EuiFieldText, } from '@elastic/eui'; import { i18n } from '@osd/i18n';