diff --git a/openmetadata-ui/src/main/resources/ui/src/assets/svg/lampcharge.svg b/openmetadata-ui/src/main/resources/ui/src/assets/svg/lampcharge.svg
index ae255e0276b..4b6a3ad48de 100644
--- a/openmetadata-ui/src/main/resources/ui/src/assets/svg/lampcharge.svg
+++ b/openmetadata-ui/src/main/resources/ui/src/assets/svg/lampcharge.svg
@@ -1,5 +1,6 @@
-
+
\ No newline at end of file
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfiler.interface.ts b/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfiler.interface.ts
index 930462e18b9..43ed78570a3 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfiler.interface.ts
+++ b/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfiler.interface.ts
@@ -18,7 +18,6 @@ import {
ColumnProfilerConfig,
PartitionProfilerConfig,
ProfileSampleType,
- Table,
TableProfile,
TableProfilerConfig,
} from '../../generated/entity/data/table';
@@ -28,7 +27,6 @@ import { OperationPermission } from '../PermissionProvider/PermissionProvider.in
export interface TableProfilerProps {
isTableDeleted?: boolean;
permissions: OperationPermission;
- testSuite?: Table['testSuite'];
}
export type TableTestsType = {
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfilerV1.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfilerV1.test.tsx
index 6360599af48..05e5c6cb9ea 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfilerV1.test.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfilerV1.test.tsx
@@ -24,17 +24,21 @@ import { TEST_CASE } from '../../mocks/TableData.mock';
import { OperationPermission } from '../PermissionProvider/PermissionProvider.interface';
import { TableProfilerProps } from './TableProfiler.interface';
// internal imports
+import { TableProfilerTab } from 'components/ProfilerDashboard/profilerDashboard.interface';
+import { getTableDetailsByFQN } from 'rest/tableAPI';
import TableProfilerV1 from './TableProfilerV1';
+const mockLocation = {
+ search: '?activeTab=Table Profile',
+ pathname: '/table',
+};
+
// mock library imports
jest.mock('react-router-dom', () => ({
useHistory: jest.fn().mockImplementation(() => ({
push: jest.fn(),
})),
- useLocation: jest.fn().mockImplementation(() => ({
- search: '?activeTab=Table Profile',
- pathname: '/table',
- })),
+ useLocation: jest.fn().mockImplementation(() => mockLocation),
Link: jest
.fn()
.mockImplementation(({ children }) => {children}),
@@ -66,6 +70,14 @@ jest.mock('rest/testAPI', () => ({
.fn()
.mockImplementation(() => Promise.resolve(TEST_CASE)),
}));
+jest.mock('rest/tableAPI', () => ({
+ getTableDetailsByFQN: jest.fn().mockImplementation(() => Promise.resolve()),
+}));
+jest.mock('./QualityTab/QualityTab.component', () => ({
+ QualityTab: jest
+ .fn()
+ .mockImplementation(() =>
QualityTab.component
),
+}));
const mockProps: TableProfilerProps = {
permissions: {
@@ -138,4 +150,26 @@ describe('Test TableProfiler component', () => {
await screen.findByText('ProfilerSettingsModal.component')
).toBeInTheDocument();
});
+
+ it('should fetch testSuite details when data quality tab is active', async () => {
+ mockLocation.search = `?activeTab=${TableProfilerTab.DATA_QUALITY}`;
+
+ (getTableDetailsByFQN as jest.Mock).mockImplementationOnce(() =>
+ Promise.resolve({
+ name: 'test',
+ id: '123',
+ tableFqn: 'fqn',
+ testSuite: { name: 'testSuite1' },
+ })
+ );
+
+ await act(async () => {
+ render();
+ });
+
+ expect(getTableDetailsByFQN).toHaveBeenCalledWith(
+ 'sample_data.ecommerce_db.shopify.dim_address',
+ 'testSuite'
+ );
+ });
});
diff --git a/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfilerV1.tsx b/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfilerV1.tsx
index c40a479e5eb..f2b05f90fd3 100644
--- a/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfilerV1.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/components/TableProfiler/TableProfilerV1.tsx
@@ -35,6 +35,7 @@ import { DateRangeObject } from 'components/ProfilerDashboard/component/TestSumm
import TabsLabel from 'components/TabsLabel/TabsLabel.component';
import { useTourProvider } from 'components/TourProvider/TourProvider';
import { mockDatasetData } from 'constants/mockTourData.constants';
+import { TabSpecificField } from 'enums/entity.enum';
import { Column } from 'generated/entity/data/container';
import {
filter,
@@ -58,7 +59,10 @@ import React, {
} from 'react';
import { useTranslation } from 'react-i18next';
import { Link, useHistory, useLocation, useParams } from 'react-router-dom';
-import { getLatestTableProfileByFqn } from 'rest/tableAPI';
+import {
+ getLatestTableProfileByFqn,
+ getTableDetailsByFQN,
+} from 'rest/tableAPI';
import { getListTestCase, ListTestCaseParams } from 'rest/testAPI';
import { bytesToSize, getDecodedFqn } from 'utils/StringsUtils';
import { ReactComponent as ColumnProfileIcon } from '../../assets/svg/column-profile.svg';
@@ -96,7 +100,6 @@ import {
import './tableProfiler.less';
const TableProfilerV1: FC = ({
- testSuite,
isTableDeleted,
permissions,
}: TableProfilerProps) => {
@@ -138,6 +141,7 @@ const TableProfilerV1: FC = ({
const [isLoading, setIsLoading] = useState(true);
const [dateRangeObject, setDateRangeObject] =
useState(DEFAULT_RANGE_DATA);
+ const [testSuite, setTestSuite] = useState();
const isColumnProfile = activeTab === TableProfilerTab.COLUMN_PROFILE;
const isDataQuality = activeTab === TableProfilerTab.DATA_QUALITY;
@@ -472,6 +476,26 @@ const TableProfilerV1: FC = ({
return { statusDict, totalTests: temp.length };
}, [activeColumnFqn, columnTests]);
+ const fetchTestSuiteDetails = async () => {
+ setIsLoading(true);
+ try {
+ const details = await getTableDetailsByFQN(
+ datasetFQN,
+ TabSpecificField.TESTSUITE
+ );
+ setTestSuite(details.testSuite);
+ } catch (error) {
+ showErrorToast(error as AxiosError);
+ } finally {
+ setIsLoading(false);
+ }
+ };
+ useEffect(() => {
+ if (isDataQuality && isUndefined(testSuite)) {
+ fetchTestSuiteDetails();
+ }
+ }, [isDataQuality, testSuite]);
+
useEffect(() => {
const fetchTest =
viewTest && !isTourOpen && !isTableProfile && isEmpty(allTests.current);
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/TableDetailsPageV1/TableDetailsPageV1.test.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/TableDetailsPageV1/TableDetailsPageV1.test.tsx
index 1499b06373f..6ae1fe6c8fb 100644
--- a/openmetadata-ui/src/main/resources/ui/src/pages/TableDetailsPageV1/TableDetailsPageV1.test.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/TableDetailsPageV1/TableDetailsPageV1.test.tsx
@@ -212,7 +212,7 @@ describe('TestDetailsPageV1 component', () => {
expect(getTableDetailsByFQN).toHaveBeenCalledWith(
'fqn',
- `${COMMON_API_FIELDS},usageSummary,testSuite`
+ `${COMMON_API_FIELDS},usageSummary`
);
});
diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/TableDetailsPageV1/TableDetailsPageV1.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/TableDetailsPageV1/TableDetailsPageV1.tsx
index 627aac75bdb..e831e818a27 100644
--- a/openmetadata-ui/src/main/resources/ui/src/pages/TableDetailsPageV1/TableDetailsPageV1.tsx
+++ b/openmetadata-ui/src/main/resources/ui/src/pages/TableDetailsPageV1/TableDetailsPageV1.tsx
@@ -116,10 +116,7 @@ const TableDetailsPageV1 = () => {
() => tablePermissions.ViewAll || tablePermissions.ViewUsage,
[tablePermissions]
);
- const viewTestSuitePermission = useMemo(
- () => tablePermissions.ViewAll || tablePermissions.ViewTests,
- [tablePermissions]
- );
+
const tableFqn = useMemo(
() =>
encodeURIComponent(
@@ -139,9 +136,7 @@ const TableDetailsPageV1 = () => {
if (viewUsagePermission) {
fields += `,${TabSpecificField.USAGE_SUMMARY}`;
}
- if (viewTestSuitePermission) {
- fields += `,${TabSpecificField.TESTSUITE}`;
- }
+
const details = await getTableDetailsByFQN(tableFqn, fields);
setTableDetails(details);
@@ -635,7 +630,6 @@ const TableDetailsPageV1 = () => {
),
},