ui: fixed ingestion button redirection issue, testCase api call issue (#12575)

* ui: fixed ingestion button redirection issue, testCase api call issue

* cypress fixed
This commit is contained in:
Shailesh Parmar 2023-07-25 00:06:07 +05:30 committed by GitHub
parent 0cdf2aa597
commit 80e2fc37d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 141 deletions

View File

@ -192,10 +192,10 @@ describe('Data Quality and Profiler should work properly', () => {
verifyResponseStatusCode('@getEntityDetails', 200);
verifyResponseStatusCode('@testCase', 200);
cy.get('[data-testid="profiler-tab-left-panel"]')
.contains('Data Quality')
.click();
verifyResponseStatusCode('@testCase', 200);
cy.contains(NEW_TABLE_TEST_CASE.name).should('be.visible');
});
@ -341,10 +341,10 @@ describe('Data Quality and Profiler should work properly', () => {
it('Edit column test case should work properly', () => {
interceptURL('GET', '/api/v1/dataQuality/testCases?*', 'testCase');
goToProfilerTab();
verifyResponseStatusCode('@testCase', 200);
cy.get('[data-testid="profiler-tab-left-panel"]')
.contains('Column Profile')
.click();
verifyResponseStatusCode('@testCase', 200);
cy.get('[data-testid="id-test-count"]')
.scrollIntoView()
.should('be.visible')
@ -385,11 +385,11 @@ describe('Data Quality and Profiler should work properly', () => {
it('Delete Column Test Case should work properly', () => {
interceptURL('GET', '/api/v1/dataQuality/testCases?*', 'testCase');
goToProfilerTab();
verifyResponseStatusCode('@testCase', 200);
cy.get('[data-testid="profiler-tab-left-panel"]')
.contains('Column Profile')
.should('be.visible')
.click();
verifyResponseStatusCode('@testCase', 200);
cy.get('[data-testid="id-test-count"]')
.scrollIntoView()
.should('be.visible')

View File

@ -28,12 +28,12 @@ import { DefaultOptionType } from 'antd/lib/select';
import { ReactComponent as DropDownIcon } from 'assets/svg/DropDown.svg';
import { AxiosError } from 'axios';
import classNames from 'classnames';
import { SummaryCard } from 'components/common/SummaryCard/SummaryCard.component';
import { SummaryCardProps } from 'components/common/SummaryCard/SummaryCard.interface';
import DatePickerMenu from 'components/DatePickerMenu/DatePickerMenu.component';
import { DateRangeObject } from 'components/ProfilerDashboard/component/TestSummary';
import TabsLabel from 'components/TabsLabel/TabsLabel.component';
import { useTourProvider } from 'components/TourProvider/TourProvider';
import { SummaryCard } from 'components/common/SummaryCard/SummaryCard.component';
import { SummaryCardProps } from 'components/common/SummaryCard/SummaryCard.interface';
import { mockDatasetData } from 'constants/mockTourData.constants';
import { Column } from 'generated/entity/data/container';
import {
@ -58,18 +58,18 @@ import React, {
import { useTranslation } from 'react-i18next';
import { Link, useHistory, useLocation, useParams } from 'react-router-dom';
import { getLatestTableProfileByFqn } from 'rest/tableAPI';
import { ListTestCaseParams, getListTestCase } from 'rest/testAPI';
import { getListTestCase, ListTestCaseParams } from 'rest/testAPI';
import { ReactComponent as ColumnProfileIcon } from '../../assets/svg/column-profile.svg';
import { ReactComponent as DataQualityIcon } from '../../assets/svg/data-quality.svg';
import { ReactComponent as SettingIcon } from '../../assets/svg/ic-settings-primery.svg';
import { ReactComponent as NoDataIcon } from '../../assets/svg/no-data-icon.svg';
import { ReactComponent as TableProfileIcon } from '../../assets/svg/table-profile.svg';
import { PAGE_HEADERS } from '../../constants/PageHeaders.constant';
import { API_RES_MAX_SIZE } from '../../constants/constants';
import { PAGE_HEADERS } from '../../constants/PageHeaders.constant';
import {
allowedServiceForOperationGraph,
DEFAULT_RANGE_DATA,
INITIAL_TEST_RESULT_SUMMARY,
allowedServiceForOperationGraph,
} from '../../constants/profiler.constant';
import { ProfilerDashboardType } from '../../enums/table.enum';
import { ProfileSampleType, Table } from '../../generated/entity/data/table';
@ -79,8 +79,8 @@ import { updateTestResults } from '../../utils/DataQualityAndProfilerUtils';
import { getAddDataQualityTableTestPath } from '../../utils/RouterUtils';
import { generateEntityLink } from '../../utils/TableUtils';
import { showErrorToast } from '../../utils/ToastUtils';
import { TableProfilerTab } from '../ProfilerDashboard/profilerDashboard.interface';
import PageHeader from '../header/PageHeader.component';
import { TableProfilerTab } from '../ProfilerDashboard/profilerDashboard.interface';
import ColumnPickerMenu from './Component/ColumnPickerMenu';
import ColumnProfileTable from './Component/ColumnProfileTable';
import ColumnSummary from './Component/ColumnSummary';
@ -462,10 +462,17 @@ const TableProfilerV1: FC<TableProfilerProps> = ({
}, [activeColumnFqn, columnTests]);
useEffect(() => {
if (!isUndefined(table) && viewTest && !isTourOpen) {
const fetchTest =
!isUndefined(table) &&
viewTest &&
!isTourOpen &&
!isTableProfile &&
isEmpty(allTests.current);
if (fetchTest) {
fetchAllTests();
}
}, [table, viewTest, isTourOpen]);
}, [table, viewTest, isTourOpen, isTableProfile, allTests]);
useEffect(() => {
if (!isTableDeleted && datasetFQN && !isTourOpen) {

View File

@ -1,88 +0,0 @@
/*
* Copyright 2022 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 { Button, Col, Row } from 'antd';
import { isUndefined } from 'lodash';
import React from 'react';
import { PAGE_SIZE } from '../../constants/constants';
import { Paging } from '../../generated/type/paging';
import NextPrevious from '../common/next-previous/NextPrevious';
interface Props {
buttonName: string;
hasAccess: boolean;
showButton?: boolean;
children?: JSX.Element;
paging?: Paging;
onButtonClick?: () => void;
currentPage?: number;
testCasePageHandler?: (
cursorValue: string | number,
activePage?: number | undefined
) => void;
isPaging?: boolean;
}
const TestCaseCommonTabContainer = ({
buttonName,
children,
paging,
currentPage,
testCasePageHandler,
onButtonClick,
showButton = true,
isPaging = false,
hasAccess,
}: Props) => {
const NextPreviousComponent = () => {
if (
isPaging &&
!isUndefined(paging) &&
paging?.total > PAGE_SIZE &&
!isUndefined(currentPage) &&
testCasePageHandler
) {
return (
<Col span={24}>
<NextPrevious
currentPage={currentPage}
pageSize={PAGE_SIZE}
paging={paging}
pagingHandler={testCasePageHandler}
totalCount={paging.total}
/>
</Col>
);
}
return null;
};
return (
<Row className="tw-mt-4" gutter={[16, 16]}>
{showButton && (
<Col className="d-flex tw-justify-end" span={24}>
{hasAccess && (
<Button type="primary" onClick={onButtonClick}>
{buttonName}
</Button>
)}
</Col>
)}
{children}
<NextPreviousComponent />
</Row>
);
};
export default TestCaseCommonTabContainer;

View File

@ -12,7 +12,7 @@
*/
import { CheckOutlined, PlusOutlined } from '@ant-design/icons';
import { Button, Col, Popover, Row, Space, Table, Tooltip } from 'antd';
import { Button, Popover, Row, Space, Table, Tooltip } from 'antd';
import { ColumnsType } from 'antd/lib/table';
import { ReactComponent as ExternalLinkIcon } from 'assets/svg/external-links.svg';
import { AxiosError } from 'axios';
@ -24,7 +24,6 @@ import EntityDeleteModal from 'components/Modals/EntityDeleteModal/EntityDeleteM
import KillIngestionModal from 'components/Modals/KillIngestionPipelineModal/KillIngestionPipelineModal';
import { usePermissionProvider } from 'components/PermissionProvider/PermissionProvider';
import { ResourceEntity } from 'components/PermissionProvider/PermissionProvider.interface';
import TestCaseCommonTabContainer from 'components/TestCaseCommonTabContainer/TestCaseCommonTabContainer.component';
import cronstrue from 'cronstrue';
import { ERROR_PLACEHOLDER_TYPE } from 'enums/common.enum';
import { EntityType } from 'enums/entity.enum';
@ -605,41 +604,29 @@ const TestSuitePipelineTab = ({ testSuite }: Props) => {
}
return (
<TestCaseCommonTabContainer
buttonName={t('label.add-entity', {
entity: t('label.ingestion'),
})}
hasAccess={createPermission}
showButton={testSuitePipelines.length === 0}
onButtonClick={() => {
history.push(getTestSuiteIngestionPath(testSuiteFQN));
}}>
<Col span={24}>
<Table
bordered
columns={pipelineColumns}
dataSource={testSuitePipelines.map((test) => ({
...test,
key: test.name,
}))}
locale={{ emptyText: errorPlaceholder }}
pagination={false}
rowKey="name"
scroll={{ x: 1200 }}
size="small"
/>
<EntityDeleteModal
entityName={deleteSelection.name}
entityType={t('label.ingestion-lowercase')}
loadingState={deleteSelection.state}
visible={isConfirmationModalOpen}
onCancel={handleCancelConfirmationModal}
onConfirm={() =>
handleDelete(deleteSelection.id, deleteSelection.name)
}
/>
</Col>
</TestCaseCommonTabContainer>
<div className="m-t-md">
<Table
bordered
columns={pipelineColumns}
dataSource={testSuitePipelines.map((test) => ({
...test,
key: test.name,
}))}
locale={{ emptyText: errorPlaceholder }}
pagination={false}
rowKey="name"
scroll={{ x: 1200 }}
size="small"
/>
<EntityDeleteModal
entityName={deleteSelection.name}
entityType={t('label.ingestion-lowercase')}
loadingState={deleteSelection.state}
visible={isConfirmationModalOpen}
onCancel={handleCancelConfirmationModal}
onConfirm={() => handleDelete(deleteSelection.id, deleteSelection.name)}
/>
</div>
);
};

View File

@ -30,10 +30,7 @@ import { getTestSuiteByName } from 'rest/testAPI';
import { getEntityName } from 'utils/EntityUtils';
import { IngestionPipeline } from '../../generated/entity/services/ingestionPipelines/ingestionPipeline';
import { TestSuite } from '../../generated/tests/testSuite';
import {
getDataQualityPagePath,
getTestSuitePath,
} from '../../utils/RouterUtils';
import { getDataQualityPagePath } from '../../utils/RouterUtils';
import { showErrorToast } from '../../utils/ToastUtils';
const TestSuiteIngestionPage = () => {
@ -111,7 +108,7 @@ const TestSuiteIngestionPage = () => {
};
const handleCancelBtn = () => {
history.push(getTestSuitePath(testSuiteFQN || ''));
history.goBack();
};
useEffect(() => {