From e588d8b62fbe093b0961c1bec4dd540d697f73ee Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 29 Jul 2024 23:35:47 +0000 Subject: [PATCH] [MDS] Bug-fix Fix data source picker trigger local cluster call by default (#7528) * Fux data source picker trigger local cluster call by default Signed-off-by: Ryan Liang * Changeset file for PR #7528 created/updated * Fux data source picker trigger local cluster call by default 2 Signed-off-by: Ryan Liang --------- Signed-off-by: Ryan Liang Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com> (cherry picked from commit 5f19c37fadc98c05febc1010685280292fe58a0c) Signed-off-by: github-actions[bot] --- changelogs/fragments/7528.yml | 2 ++ .../manage_direct_query_data_connections_table.tsx | 13 ++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 changelogs/fragments/7528.yml diff --git a/changelogs/fragments/7528.yml b/changelogs/fragments/7528.yml new file mode 100644 index 000000000000..c027e977c4b2 --- /dev/null +++ b/changelogs/fragments/7528.yml @@ -0,0 +1,2 @@ +fix: +- Fix data source picker trigger local cluster call by default ([#7528](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/7528)) \ No newline at end of file diff --git a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_connection/manage_direct_query_data_connections_table.tsx b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_connection/manage_direct_query_data_connections_table.tsx index 27ba133b3507..1df5b7b87bb8 100644 --- a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_connection/manage_direct_query_data_connections_table.tsx +++ b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/direct_query_data_connection/manage_direct_query_data_connections_table.tsx @@ -80,12 +80,14 @@ export const ManageDirectQueryDataConnectionsTable: React.FC); const [selectedConnection, setSelectedConnection] = useState(undefined); - const [selectedDataSourceId, setSelectedDataSourceId] = useState(''); + const [selectedDataSourceId, setSelectedDataSourceId] = useState(undefined); const [searchText, setSearchText] = useState(''); const [isLoading, setIsLoading] = useState(false); const history = useHistory(); const fetchDataSources = useCallback(() => { + if (featureFlagStatus && selectedDataSourceId === undefined) return; + const endpoint = featureFlagStatus && selectedDataSourceId !== undefined ? `${DATACONNECTIONS_BASE}/dataSourceMDSId=${selectedDataSourceId}` @@ -113,7 +115,7 @@ export const ManageDirectQueryDataConnectionsTable: React.FC { - if (!connectionName) return; + if (!connectionName || (featureFlagStatus && selectedDataSourceId === undefined)) return; const endpoint = featureFlagStatus && selectedDataSourceId !== undefined @@ -150,7 +152,7 @@ export const ManageDirectQueryDataConnectionsTable: React.FC { - const dataSourceId = e[0] ? e[0].id : ''; + const dataSourceId = e[0] ? e[0].id : undefined; setSelectedDataSourceId(dataSourceId); }; @@ -203,7 +205,7 @@ export const ManageDirectQueryDataConnectionsTable: React.FC { renderCreateAccelerationFlyout({ dataSourceName: datasource.name, - dataSourceMDSId: selectedDataSourceId, + dataSourceMDSId: selectedDataSourceId ?? '', }); }, 'data-test-subj': 'action-accelerate', @@ -266,7 +268,7 @@ export const ManageDirectQueryDataConnectionsTable: React.FC - history.push(`/manage/${record.name}?dataSourceMDSId=${selectedDataSourceId}`) + history.push(`/manage/${record.name}?dataSourceMDSId=${selectedDataSourceId ?? ''}`) } > {truncate(record.name, 100)} @@ -307,6 +309,7 @@ export const ManageDirectQueryDataConnectionsTable: React.FC )}