diff --git a/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/DataQualityTab.tsx b/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/DataQualityTab.tsx index 9d6ec6862bfe..181ea3d9a98c 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/DataQualityTab.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/ProfilerDashboard/component/DataQualityTab.tsx @@ -27,6 +27,7 @@ import { TestCaseStatusModal } from 'components/DataQuality/TestCaseStatusModal/ import ConfirmationModal from 'components/Modals/ConfirmationModal/ConfirmationModal'; import { usePermissionProvider } from 'components/PermissionProvider/PermissionProvider'; import { ResourceEntity } from 'components/PermissionProvider/PermissionProvider.interface'; +import { compare } from 'fast-json-patch'; import { TestCaseStatus } from 'generated/configuration/testResultNotificationConfiguration'; import { Operation } from 'generated/entity/policies/policy'; import { isUndefined, sortBy } from 'lodash'; @@ -34,7 +35,7 @@ import QueryString from 'qs'; import React, { useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Link } from 'react-router-dom'; -import { putTestCaseResult, removeTestCaseFromTestSuite } from 'rest/testAPI'; +import { patchTestCaseResult, removeTestCaseFromTestSuite } from 'rest/testAPI'; import { formatDate, formatDateTime } from 'utils/date-time/DateTimeUtils'; import { getEntityName } from 'utils/EntityUtils'; import { checkPermission } from 'utils/PermissionsUtils'; @@ -115,14 +116,19 @@ const DataQualityTab: React.FC = ({ }; const handleStatusSubmit = async (data: TestCaseFailureStatus) => { - if (selectedTestCase?.data) { + if (selectedTestCase?.data?.testCaseResult) { + const timestamp = selectedTestCase.data?.testCaseResult.timestamp ?? 0; const updatedResult: TestCaseResult = { ...selectedTestCase.data?.testCaseResult, testCaseFailureStatus: data, }; const testCaseFqn = selectedTestCase.data?.fullyQualifiedName ?? ''; + const patch = compare( + selectedTestCase.data.testCaseResult, + updatedResult + ); try { - await putTestCaseResult(testCaseFqn, updatedResult); + await patchTestCaseResult({ testCaseFqn, patch, timestamp }); onTestCaseResultUpdate?.({ ...selectedTestCase.data, 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 4b8282ce0148..8c36e1aa5389 100644 --- a/openmetadata-ui/src/main/resources/ui/src/rest/testAPI.ts +++ b/openmetadata-ui/src/main/resources/ui/src/rest/testAPI.ts @@ -273,14 +273,23 @@ export const restoreTestSuite = async (id: string) => { // Test Result -export const putTestCaseResult = async ( - testCaseFqn: string, - data: TestCaseResult -) => { - const response = await APIClient.put< - TestCaseResult, - AxiosResponse - >(`${testCaseUrl}/${testCaseFqn}/testCaseResult`, data); +export const patchTestCaseResult = async ({ + testCaseFqn, + timestamp, + patch, +}: { + testCaseFqn: string; + timestamp: number; + patch: Operation[]; +}) => { + const configOptions = { + headers: { 'Content-type': 'application/json-patch+json' }, + }; + const response = await APIClient.patch>( + `${testCaseUrl}/${testCaseFqn}/testCaseResult/${timestamp}`, + patch, + configOptions + ); return response.data; };