Skip to content

Commit

Permalink
small mistakes
Browse files Browse the repository at this point in the history
Signed-off-by: Qxisylolo <[email protected]>
  • Loading branch information
Qxisylolo committed Dec 11, 2024
1 parent c506daa commit 9b4259d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
import { fireEvent, render, screen, waitFor, act } from '@testing-library/react';
import { fireEvent, render, screen, waitFor } from '@testing-library/react';
import React from 'react';
import { IntlProvider } from 'react-intl';

Expand Down Expand Up @@ -78,7 +78,7 @@ const setupAssociationDataSourceModal = ({
id: 'ds1-dqc1',
name: 'dqc1',
type: 'Amazon S3',
connectionType: 1,
connectionType: DataSourceConnectionType.DirectQueryConnection,
parentId: 'ds1',
},
]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,12 @@ export const AssociationDataSourceModalContent = ({
openSearchConnections,
dataConnections,
} = convertDataSourcesToOpenSearchAndDataConnections(dataSourcesList);

const initialLoadingStatus = dataSourcesList.reduce((acc, ds) => {
acc[ds.id] = true;
// Only data source saved object type needs to fetch data source connections, data connection type object not, use loadingStatus to track the loading status of each data source connections
const initialLoadingStatus = [
...openSearchConnections.map((ds) => ({ id: ds.id, status: true })),
...dataConnections.map((ds) => ({ id: ds.id, status: false })),
].reduce((acc, { id, status }) => {
acc[id] = status;
return acc;
}, {} as Record<string, boolean>);

Expand All @@ -272,9 +275,8 @@ export const AssociationDataSourceModalContent = ({
return { openSearchConnections };
})
.then(({ openSearchConnections }) => {
// Only data source saved object type needs to fetch data source connections, data connection type object not.
openSearchConnections.forEach((ds) => {
// fetch direct query connections for each data source, and set loading status accordingly
// only fetch direct query connections for data source saved object, and set loading status accordingly
fetchDirectQueryConnectionsByIDs([ds.id], http, notifications)
.then((directQueryConnections) => {
setAllConnections((prev) => {
Expand Down

0 comments on commit 9b4259d

Please sign in to comment.