From ad348e3658be43d4b022c4065ac0ccea34ba7ff9 Mon Sep 17 00:00:00 2001 From: Shailesh Parmar Date: Wed, 17 Apr 2024 17:41:21 +0530 Subject: [PATCH] Minor: Introduced support to add additional component in the incident manager details page (#15915) * Minor: Introduced support to add additional component in the incident manager details page * added delete method for test case sample data * added data-testid * addressing comments --- .../TestCaseResultTab.component.tsx | 9 ++++++ .../TestCaseResultTabClassBase.ts | 29 +++++++++++++++++++ .../IncidentManager/IncidentManagerPage.tsx | 1 + .../src/main/resources/ui/src/rest/testAPI.ts | 15 ++++++++++ 4 files changed, 54 insertions(+) create mode 100644 openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTabClassBase.ts diff --git a/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTab.component.tsx b/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTab.component.tsx index 80a704f369b..950f72b93b4 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTab.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/DataQuality/IncidentManager/TestCaseResultTab/TestCaseResultTab.component.tsx @@ -28,6 +28,7 @@ import { ResourceEntity } from '../../../../context/PermissionProvider/Permissio import { CSMode } from '../../../../enums/codemirror.enum'; import { EntityType } from '../../../../enums/entity.enum'; import { Operation } from '../../../../generated/entity/policies/policy'; + import { TestCaseParameterValue } from '../../../../generated/tests/testCase'; import { updateTestCaseById } from '../../../../rest/testAPI'; import { checkPermission } from '../../../../utils/PermissionsUtils'; @@ -39,12 +40,15 @@ import EditTestCaseModal from '../../AddDataQualityTest/EditTestCaseModal'; import '../incident-manager.style.less'; import './test-case-result-tab.style.less'; import { TestCaseResultTabProps } from './TestCaseResultTab.interface'; +import testCaseResultTabClassBase from './TestCaseResultTabClassBase'; const TestCaseResultTab = ({ testCaseData, onTestCaseUpdate, }: TestCaseResultTabProps) => { const { t } = useTranslation(); + const additionalComponent = + testCaseResultTabClassBase.getAdditionalComponents(); const [isDescriptionEdit, setIsDescriptionEdit] = useState(false); const [isParameterEdit, setIsParameterEdit] = useState(false); const { permissions } = usePermissionProvider(); @@ -210,6 +214,11 @@ const TestCaseResultTab = ({ )} + {!isEmpty(additionalComponent) && + additionalComponent.map(({ Component, id }) => ( + + ))} + {testCaseData && isParameterEdit && ( ; +} + +class TestCaseResultTabClassBase { + public getAdditionalComponents(): Array { + return []; + } +} + +const testCaseResultTabClassBase = new TestCaseResultTabClassBase(); + +export default testCaseResultTabClassBase; +export { TestCaseResultTabClassBase }; diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/IncidentManager/IncidentManagerPage.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/IncidentManager/IncidentManagerPage.tsx index 8ecb0a8d45c..f7d36f8266d 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/IncidentManager/IncidentManagerPage.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/IncidentManager/IncidentManagerPage.tsx @@ -492,6 +492,7 @@ const IncidentManagerPage = () => { showSearch api={searchTestCases} className="w-min-20" + data-testid="test-case-select" options={testCaseInitialOptions} placeholder={t('label.test-case')} suffixIcon={undefined} diff --git a/openmetadata-ui/src/main/resources/ui/src/rest/testAPI.ts b/openmetadata-ui/src/main/resources/ui/src/rest/testAPI.ts index eeeac29f85a..6df8480da4f 100644 --- a/openmetadata-ui/src/main/resources/ui/src/rest/testAPI.ts +++ b/openmetadata-ui/src/main/resources/ui/src/rest/testAPI.ts @@ -18,6 +18,7 @@ import { SORT_ORDER } from '../enums/common.enum'; import { CreateTestCase } from '../generated/api/tests/createTestCase'; import { CreateTestSuite } from '../generated/api/tests/createTestSuite'; import { + TableData, TestCase, TestCaseResult, TestCaseStatus, @@ -138,6 +139,20 @@ export const getListTestCaseResults = async ( return response.data; }; +export const getTestCaseFailedSampleData = async (id: string) => { + const url = `${testCaseUrl}/${id}/failedRowsSample`; + const response = await APIClient.get(url); + + return response.data; +}; + +export const deleteTestCaseFailedSampleData = async (id: string) => { + const url = `${testCaseUrl}/${id}/failedRowsSample`; + const response = await APIClient.delete(url); + + return response.data; +}; + export const getTestCaseByFqn = async ( fqn: string, params?: { fields?: string[] }