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
)}