Skip to content

Commit

Permalink
Fix the installed integration table content
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Liang <[email protected]>
  • Loading branch information
RyanL1997 committed Sep 5, 2024
1 parent 0bf5a58 commit 85c3f72
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,20 +153,31 @@ export const DirectQueryDataConnectionDetail: React.FC<DirectQueryDataConnection
const searchDataSourcePattern = new RegExp(
`flint_${escapeRegExp(datasourceDetails.name)}_default_.*`
);

const findIntegrations = async () => {
const result: { data: IntegrationInstancesSearchResult } = await http!.get(
INTEGRATIONS_BASE + `/store`
);

if (result.data?.hits) {
setDataSourceIntegrations(
result.data.hits.filter((res) => res.dataSource.match(searchDataSourcePattern))
let filteredIntegrations = result.data.hits.filter((res) =>
res.dataSource.match(searchDataSourcePattern)

Check warning on line 164 in src/plugins/data_source_management/public/components/direct_query_data_sources_components/connection_detail/direct_query_connection_detail.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/data_source_management/public/components/direct_query_data_sources_components/connection_detail/direct_query_connection_detail.tsx#L163-L164

Added lines #L163 - L164 were not covered by tests
);

if (featureFlagStatus) {
filteredIntegrations = filteredIntegrations.filter((res) => {

Check warning on line 168 in src/plugins/data_source_management/public/components/direct_query_data_sources_components/connection_detail/direct_query_connection_detail.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/data_source_management/public/components/direct_query_data_sources_components/connection_detail/direct_query_connection_detail.tsx#L168

Added line #L168 was not covered by tests
return res.references && res.references.some((ref) => ref.id === dataSourceMDSId);
});
}

setDataSourceIntegrations(filteredIntegrations);

Check warning on line 173 in src/plugins/data_source_management/public/components/direct_query_data_sources_components/connection_detail/direct_query_connection_detail.tsx

View check run for this annotation

Codecov / codecov/patch

src/plugins/data_source_management/public/components/direct_query_data_sources_components/connection_detail/direct_query_connection_detail.tsx#L173

Added line #L173 was not covered by tests
} else {
setDataSourceIntegrations([]);
}
};

findIntegrations();
}, [http, datasourceDetails.name, refreshIntegrationsFlag]);
}, [http, datasourceDetails.name, refreshIntegrationsFlag, featureFlagStatus, dataSourceMDSId]);

const [showIntegrationsFlyout, setShowIntegrationsFlyout] = useState(false);
const onclickIntegrationsCard = () => {
Expand Down Expand Up @@ -448,6 +459,7 @@ export const DirectQueryDataConnectionDetail: React.FC<DirectQueryDataConnection
refreshInstances={refreshInstances}
http={http}
selectedDataSourceId={featureFlagStatus ? dataSourceMDSId ?? undefined : undefined}
selectedClusterName={clusterTitle}
/>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,15 @@ export const InstalledIntegrationsTable = ({
refreshInstances,
http,
selectedDataSourceId,
selectedClusterName,
}: {
integrations: IntegrationInstanceResult[];
datasourceType: DatasourceType;
datasourceName: string;
refreshInstances: () => void;
http: HttpStart;
selectedDataSourceId?: string;
selectedClusterName?: string;
}) => {
const basePathLink = (link: string): string => {
if (http.basePath) {
Expand Down Expand Up @@ -284,6 +286,8 @@ export const InstalledIntegrationsTable = ({
datasourceName={datasourceName}
refreshInstances={refreshInstances}
http={http}
selectedDataSourceId={selectedDataSourceId}
selectedClusterName={selectedClusterName}
/>
) : null}
</>
Expand Down

0 comments on commit 85c3f72

Please sign in to comment.