From 85c3f72a3f53613ec64767b36e5d4c03484f157b Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Wed, 4 Sep 2024 19:18:45 -0700 Subject: [PATCH] Fix the installed integration table content Signed-off-by: Ryan Liang --- .../direct_query_connection_detail.tsx | 18 +++++++++++++++--- .../installed_integrations_table.tsx | 4 ++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/connection_detail/direct_query_connection_detail.tsx b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/connection_detail/direct_query_connection_detail.tsx index aca6ce095555..c9d68b563d8e 100644 --- a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/connection_detail/direct_query_connection_detail.tsx +++ b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/connection_detail/direct_query_connection_detail.tsx @@ -153,20 +153,31 @@ export const DirectQueryDataConnectionDetail: React.FC { 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) ); + + if (featureFlagStatus) { + filteredIntegrations = filteredIntegrations.filter((res) => { + return res.references && res.references.some((ref) => ref.id === dataSourceMDSId); + }); + } + + setDataSourceIntegrations(filteredIntegrations); } else { setDataSourceIntegrations([]); } }; + findIntegrations(); - }, [http, datasourceDetails.name, refreshIntegrationsFlag]); + }, [http, datasourceDetails.name, refreshIntegrationsFlag, featureFlagStatus, dataSourceMDSId]); const [showIntegrationsFlyout, setShowIntegrationsFlyout] = useState(false); const onclickIntegrationsCard = () => { @@ -448,6 +459,7 @@ export const DirectQueryDataConnectionDetail: React.FC ), }, diff --git a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/integrations/installed_integrations_table.tsx b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/integrations/installed_integrations_table.tsx index 8bf10909965d..69070372e1cc 100644 --- a/src/plugins/data_source_management/public/components/direct_query_data_sources_components/integrations/installed_integrations_table.tsx +++ b/src/plugins/data_source_management/public/components/direct_query_data_sources_components/integrations/installed_integrations_table.tsx @@ -193,6 +193,7 @@ export const InstalledIntegrationsTable = ({ refreshInstances, http, selectedDataSourceId, + selectedClusterName, }: { integrations: IntegrationInstanceResult[]; datasourceType: DatasourceType; @@ -200,6 +201,7 @@ export const InstalledIntegrationsTable = ({ refreshInstances: () => void; http: HttpStart; selectedDataSourceId?: string; + selectedClusterName?: string; }) => { const basePathLink = (link: string): string => { if (http.basePath) { @@ -284,6 +286,8 @@ export const InstalledIntegrationsTable = ({ datasourceName={datasourceName} refreshInstances={refreshInstances} http={http} + selectedDataSourceId={selectedDataSourceId} + selectedClusterName={selectedClusterName} /> ) : null}