diff --git a/public/components/datasources/components/__tests__/__snapshots__/data_connection.test.tsx.snap b/public/components/datasources/components/__tests__/__snapshots__/data_connection.test.tsx.snap index a0cc385e53..6a56e9ac87 100644 --- a/public/components/datasources/components/__tests__/__snapshots__/data_connection.test.tsx.snap +++ b/public/components/datasources/components/__tests__/__snapshots__/data_connection.test.tsx.snap @@ -359,8 +359,8 @@ exports[`Data Connection Page test Renders S3 data connection page with data 1`] > - -
- @@ -558,31 +506,38 @@ exports[`Data Connection Page test Renders S3 data connection page with data 1`] class="euiHorizontalRule euiHorizontalRule--full euiHorizontalRule--marginLarge" />
-
-
-

- Loading - databases -

+
+
+ Query access +
+
+ Admin only +
+
-
+
+
{ }); expect(container).toMatchSnapshot(); }); + + it('Does not render Associated Objects, Accelerations, and Installed Integrations tabs for Prometheus data source', async () => { + CatalogCacheManager.saveDataSourceCache(mockDataSourceCacheData); + CatalogCacheManager.saveAccelerationsCache(mockAccelerationCacheData); + + (coreRefs.http!.get as jest.Mock).mockResolvedValue(describePrometheusDataConnection); + + const { container, queryByText } = render(); + + await waitFor(() => { + expect(queryByText('Associated Objects')).not.toBeInTheDocument(); + expect(queryByText('Accelerations')).not.toBeInTheDocument(); + expect(queryByText('Installed Integrations')).not.toBeInTheDocument(); + + const accessControlTabs = Array.from(container.querySelectorAll('.euiTab__content')).filter( + (el) => el.textContent === 'Access control' + ); + expect(accessControlTabs.length).toBeGreaterThan(0); + }); + }); + + it('Renders all tabs for S3Glue data source', async () => { + CatalogCacheManager.saveDataSourceCache(mockDataSourceCacheData); + CatalogCacheManager.saveAccelerationsCache(mockAccelerationCacheData); + + (coreRefs.http!.get as jest.Mock).mockResolvedValue(describeS3Dataconnection); + + const { container, getByText } = render(); + + await waitFor(() => { + expect(getByText('Associated Objects')).toBeInTheDocument(); + expect(getByText('Accelerations')).toBeInTheDocument(); + expect(getByText('Installed Integrations')).toBeInTheDocument(); + + const accessControlTabs = Array.from(container.querySelectorAll('.euiTab__content')).filter( + (el) => el.textContent === 'Access control' + ); + expect(accessControlTabs.length).toBeGreaterThan(0); + }); + }); }); diff --git a/public/components/datasources/components/manage/data_connection.tsx b/public/components/datasources/components/manage/data_connection.tsx index a57c58840b..1a67284127 100644 --- a/public/components/datasources/components/manage/data_connection.tsx +++ b/public/components/datasources/components/manage/data_connection.tsx @@ -209,41 +209,7 @@ export const DataConnection = (props: { dataSource: string }) => { // eslint-disable-next-line react-hooks/exhaustive-deps }, [chrome, http]); - const tabs = [ - { - id: 'associated_objects', - name: 'Associated Objects', - disabled: false, - content: ( - - ), - }, - { - id: 'acceleration_table', - name: 'Accelerations', - disabled: false, - content: ( - - ), - }, - { - id: 'installed_integrations', - name: 'Installed Integrations', - disabled: false, - content: ( - - ), - }, + const genericTabs = [ { id: 'access_control', name: 'Access control', @@ -260,6 +226,51 @@ export const DataConnection = (props: { dataSource: string }) => { }, ]; + const conditionalTabs = + datasourceDetails.connector === 'S3GLUE' + ? [ + { + id: 'associated_objects', + name: 'Associated Objects', + disabled: false, + content: ( + + ), + }, + { + id: 'acceleration_table', + name: 'Accelerations', + disabled: false, + content: ( + + ), + }, + { + id: 'installed_integrations', + name: 'Installed Integrations', + disabled: false, + content: ( + + ), + }, + ] + : []; + + const tabs = [...conditionalTabs, ...genericTabs]; + const QueryOrAccelerateData = () => { switch (datasourceDetails.connector) { case 'S3GLUE':