mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-26 17:34:41 +00:00
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
This commit is contained in:
parent
29cd58b628
commit
ad348e3658
@ -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<boolean>(false);
|
||||
const [isParameterEdit, setIsParameterEdit] = useState<boolean>(false);
|
||||
const { permissions } = usePermissionProvider();
|
||||
@ -210,6 +214,11 @@ const TestCaseResultTab = ({
|
||||
</Col>
|
||||
)}
|
||||
|
||||
{!isEmpty(additionalComponent) &&
|
||||
additionalComponent.map(({ Component, id }) => (
|
||||
<Component key={id} testCaseData={testCaseData} />
|
||||
))}
|
||||
|
||||
{testCaseData && isParameterEdit && (
|
||||
<EditTestCaseModal
|
||||
showOnlyParameter
|
||||
|
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright 2024 Collate.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { TestCase } from '../../../../generated/tests/testCase';
|
||||
|
||||
export interface AdditionalComponentInterface {
|
||||
id: string;
|
||||
Component: React.FC<{ testCaseData?: TestCase }>;
|
||||
}
|
||||
|
||||
class TestCaseResultTabClassBase {
|
||||
public getAdditionalComponents(): Array<AdditionalComponentInterface> {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
const testCaseResultTabClassBase = new TestCaseResultTabClassBase();
|
||||
|
||||
export default testCaseResultTabClassBase;
|
||||
export { TestCaseResultTabClassBase };
|
@ -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}
|
||||
|
@ -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<TableData>(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[] }
|
||||
|
Loading…
x
Reference in New Issue
Block a user