Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MDS] Bug-fix Fix data source picker trigger local cluster call by default #7528

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelogs/fragments/7528.yml
Original file line number Diff line number Diff line change
@@ -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))
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,14 @@ export const ManageDirectQueryDataConnectionsTable: React.FC<ManageDirectQueryDa
const [isModalVisible, setIsModalVisible] = useState(false);
const [modalLayout, setModalLayout] = useState(<EuiOverlayMask />);
const [selectedConnection, setSelectedConnection] = useState<string | undefined>(undefined);
const [selectedDataSourceId, setSelectedDataSourceId] = useState<string | undefined>('');
const [selectedDataSourceId, setSelectedDataSourceId] = useState<string | undefined>(undefined);
const [searchText, setSearchText] = useState<string>('');
const [isLoading, setIsLoading] = useState<boolean>(false);
const history = useHistory();

const fetchDataSources = useCallback(() => {
if (featureFlagStatus && selectedDataSourceId === undefined) return;

const endpoint =
featureFlagStatus && selectedDataSourceId !== undefined
? `${DATACONNECTIONS_BASE}/dataSourceMDSId=${selectedDataSourceId}`
Expand Down Expand Up @@ -113,7 +115,7 @@ export const ManageDirectQueryDataConnectionsTable: React.FC<ManageDirectQueryDa

const deleteDataSources = useCallback(
(connectionName: string | undefined) => {
if (!connectionName) return;
if (!connectionName || (featureFlagStatus && selectedDataSourceId === undefined)) return;

const endpoint =
featureFlagStatus && selectedDataSourceId !== undefined
Expand Down Expand Up @@ -150,7 +152,7 @@ export const ManageDirectQueryDataConnectionsTable: React.FC<ManageDirectQueryDa
}, [fetchDataSources]);

const handleSelectedDataSourceChange = (e: DataSourceOption[]) => {
const dataSourceId = e[0] ? e[0].id : '';
const dataSourceId = e[0] ? e[0].id : undefined;
setSelectedDataSourceId(dataSourceId);
};

Expand Down Expand Up @@ -203,7 +205,7 @@ export const ManageDirectQueryDataConnectionsTable: React.FC<ManageDirectQueryDa
onClick: (datasource: DataConnection) => {
renderCreateAccelerationFlyout({
dataSourceName: datasource.name,
dataSourceMDSId: selectedDataSourceId,
dataSourceMDSId: selectedDataSourceId ?? '',
});
},
'data-test-subj': 'action-accelerate',
Expand Down Expand Up @@ -266,7 +268,7 @@ export const ManageDirectQueryDataConnectionsTable: React.FC<ManageDirectQueryDa
<EuiLink
data-test-subj={`${record.name}DataConnectionsLink`}
onClick={() =>
history.push(`/manage/${record.name}?dataSourceMDSId=${selectedDataSourceId}`)
history.push(`/manage/${record.name}?dataSourceMDSId=${selectedDataSourceId ?? ''}`)
}
>
{truncate(record.name, 100)}
Expand Down Expand Up @@ -307,6 +309,7 @@ export const ManageDirectQueryDataConnectionsTable: React.FC<ManageDirectQueryDa
disabled={false}
compressed={true}
hideLocalCluster={getHideLocalCluster().enabled}
isClearable={false}
/>
</EuiFlexItem>
)}
Expand Down
Loading