UI : Fix pagination issue in test case (#9271)

* Fix pagination issue in test case

* minor changes

* fix cypress issue

Co-authored-by: Chirag Madlani <12962843+chirag-madlani@users.noreply.github.com>
This commit is contained in:
Ashish Gupta 2022-12-13 23:18:41 +05:30 committed by GitHub
parent c6b98751af
commit 3ca393f3f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 18 deletions

View File

@ -294,10 +294,7 @@ describe('Data Quality and Profiler should work properly', () => {
) )
.should('be.visible'); .should('be.visible');
cy.get('[data-testid="view-service-button"]').scrollIntoView().click(); cy.get('[data-testid="view-service-button"]').scrollIntoView().click();
cy.get('.ant-table-row').should('contain', "id_columnValueLengthsToBeBetween");
cy.get('[data-row-key="id_columnValueLengthsToBeBetween"]').should(
'be.visible'
);
}); });
it('Edit column test case should work properly', () => { it('Edit column test case should work properly', () => {

View File

@ -13,8 +13,9 @@
import { Button, Row, Space, Table, Tooltip } from 'antd'; import { Button, Row, Space, Table, Tooltip } from 'antd';
import { ColumnsType } from 'antd/lib/table'; import { ColumnsType } from 'antd/lib/table';
import { isUndefined } from 'lodash'; import { isEmpty, isUndefined } from 'lodash';
import React, { useMemo, useState } from 'react'; import React, { useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { ReactComponent as ArrowDown } from '../../../assets/svg/arrow-down.svg'; import { ReactComponent as ArrowDown } from '../../../assets/svg/arrow-down.svg';
import { ReactComponent as ArrowRight } from '../../../assets/svg/arrow-right.svg'; import { ReactComponent as ArrowRight } from '../../../assets/svg/arrow-right.svg';
@ -44,6 +45,7 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
deletedTable = false, deletedTable = false,
onTestUpdate, onTestUpdate,
}) => { }) => {
const { t } = useTranslation();
const [selectedTestCase, setSelectedTestCase] = useState<TestCase>(); const [selectedTestCase, setSelectedTestCase] = useState<TestCase>();
const [editTestCase, setEditTestCase] = useState<TestCase>(); const [editTestCase, setEditTestCase] = useState<TestCase>();
const { isAdminUser } = useAuth(); const { isAdminUser } = useAuth();
@ -54,7 +56,7 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
const columns: ColumnsType<TestCase> = useMemo(() => { const columns: ColumnsType<TestCase> = useMemo(() => {
return [ return [
{ {
title: 'Last Run Result', title: t('label.last-run-result'),
dataIndex: 'testCaseResult', dataIndex: 'testCaseResult',
key: 'testCaseResult', key: 'testCaseResult',
render: (result: TestCaseResult) => ( render: (result: TestCaseResult) => (
@ -62,7 +64,7 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
{result?.testCaseStatus && ( {result?.testCaseStatus && (
<SVGIcons <SVGIcons
alt="result" alt="result"
className="tw-w-4" className="w-4"
icon={getTestResultBadgeIcon(result.testCaseStatus)} icon={getTestResultBadgeIcon(result.testCaseStatus)}
/> />
)} )}
@ -71,7 +73,7 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
), ),
}, },
{ {
title: 'Last Run', title: t('label.last-run'),
dataIndex: 'testCaseResult', dataIndex: 'testCaseResult',
key: 'lastRun', key: 'lastRun',
render: (result: TestCaseResult) => render: (result: TestCaseResult) =>
@ -80,18 +82,19 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
: '--', : '--',
}, },
{ {
title: 'Name', title: t('label.name'),
dataIndex: 'name', dataIndex: 'name',
key: 'name', key: 'name',
render: (name: string) => <span data-testid={name}>{name}</span>, render: (name: string) => <span data-testid={name}>{name}</span>,
}, },
{ {
title: 'Description', title: t('label.description'),
dataIndex: 'description', dataIndex: 'description',
key: 'description', key: 'description',
render: (text) => (isEmpty(text) ? '--' : text),
}, },
{ {
title: 'Test Suite', title: t('label.test-suite'),
dataIndex: 'testSuite', dataIndex: 'testSuite',
key: 'testSuite', key: 'testSuite',
render: (value) => { render: (value) => {
@ -105,7 +108,7 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
}, },
}, },
{ {
title: 'Table', title: t('label.table'),
dataIndex: 'entityLink', dataIndex: 'entityLink',
key: 'table', key: 'table',
render: (entityLink) => { render: (entityLink) => {
@ -122,7 +125,7 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
}, },
}, },
{ {
title: 'Column', title: t('label.column'),
dataIndex: 'entityLink', dataIndex: 'entityLink',
key: 'column', key: 'column',
render: (entityLink) => { render: (entityLink) => {
@ -143,7 +146,7 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
}, },
}, },
{ {
title: 'Actions', title: t('label.actions'),
dataIndex: 'actions', dataIndex: 'actions',
key: 'actions', key: 'actions',
width: 100, width: 100,
@ -161,7 +164,7 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
icon={ icon={
<SVGIcons <SVGIcons
alt="edit" alt="edit"
className="tw-h-4" className="h-4"
icon={Icons.EDIT} icon={Icons.EDIT}
title="Edit" title="Edit"
/> />
@ -177,15 +180,17 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
)} )}
<Tooltip <Tooltip
placement="bottomLeft" placement="bottomLeft"
title={hasAccess ? 'Delete' : NO_PERMISSION_FOR_ACTION}> title={
hasAccess ? t('label.delete') : NO_PERMISSION_FOR_ACTION
}>
<Button <Button
className="flex-center" className="flex-center"
data-testid={`delete-${record.name}`} data-testid={`delete-${record.name}`}
disabled={!hasAccess} disabled={!hasAccess}
icon={ icon={
<SVGIcons <SVGIcons
alt="Delete" alt={t('label.delete')}
className="tw-h-4" className="h-4"
icon={Icons.DELETE} icon={Icons.DELETE}
/> />
} }
@ -243,6 +248,7 @@ const DataQualityTab: React.FC<DataQualityTabProps> = ({
spinning: isLoading, spinning: isLoading,
}} }}
pagination={false} pagination={false}
rowKey="id"
size="small" size="small"
/> />
<EditTestCaseModal <EditTestCaseModal

View File

@ -475,6 +475,8 @@
"test-suite": "Test Suite", "test-suite": "Test Suite",
"enter-entity": "Enter {{entity}}", "enter-entity": "Enter {{entity}}",
"test-suite-status": "Test Suite Status", "test-suite-status": "Test Suite Status",
"last-run-result": "Last Run Result",
"last-run": "Last Run",
"search-entity": "Search {{entity}}", "search-entity": "Search {{entity}}",
"more": "More", "more": "More",
"update": "Update" "update": "Update"