Skip to content

Commit

Permalink
[MDS] Bug-fix Fix data source picker trigger local cluster call by de…
Browse files Browse the repository at this point in the history
…fault (#7528)

* Fux data source picker trigger local cluster call by default

Signed-off-by: Ryan Liang <jiallian@amazon.com>

* Changeset file for PR #7528 created/updated

* Fux data source picker trigger local cluster call by default 2

Signed-off-by: Ryan Liang <jiallian@amazon.com>

---------

Signed-off-by: Ryan Liang <jiallian@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
(cherry picked from commit 5f19c37)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent 7b1f742 commit e588d8b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
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

0 comments on commit e588d8b

Please sign in to comment.