diff --git a/source/frontend/src/components/Table/Table.tsx b/source/frontend/src/components/Table/Table.tsx index 7381244822..e529694123 100644 --- a/source/frontend/src/components/Table/Table.tsx +++ b/source/frontend/src/components/Table/Table.tsx @@ -1,8 +1,6 @@ import './Table.scss'; -import classnames from 'classnames'; -import classNames from 'classnames'; -import clsx from 'classnames'; +import cx from 'classnames'; import { Form, Formik, FormikProps } from 'formik'; import keys from 'lodash/keys'; import map from 'lodash/map'; @@ -518,7 +516,7 @@ export const Table = ( {...(props.hideHeaders ? columnProps.getHeaderProps(noHeadersGetter) : columnProps.getHeaderProps(headerPropsGetter))} - className={classnames( + className={cx( 'th', columnProps.isSorted ? (columnProps.isSortedDesc ? 'sort-desc' : 'sort-asc') : '', )} @@ -635,7 +633,7 @@ export const Table = ( const renderRow = (row: Row, index: number) => { return (
-
+
{/* If canRowExpand prop is passed only allow expansions on those rows */} {props.canRowExpand && props.canRowExpand(row) && @@ -666,7 +664,7 @@ export const Table = (
( <>
@@ -769,7 +767,7 @@ export const Table = ( {canShowTotals && props.data.length > 0 && ( - {`${initialCount} - ${finalCount} of ${totalItems}`} + {`${initialCount} - ${finalCount} of ${totalItems}`} )} diff --git a/source/frontend/src/components/Table/__snapshots__/Table.test.tsx.snap b/source/frontend/src/components/Table/__snapshots__/Table.test.tsx.snap index d2d16b72d2..21e7cdf5da 100644 --- a/source/frontend/src/components/Table/__snapshots__/Table.test.tsx.snap +++ b/source/frontend/src/components/Table/__snapshots__/Table.test.tsx.snap @@ -218,7 +218,7 @@ exports[`Generic table component matches snapshot 1`] = ` class="align-self-center col-auto" > - 1 - 6 of 6 + 1 - 6 of 6
- 1 - 3 of 3 + 1 - 3 of 3
- 1 - 2 of 2 + 1 - 2 of 2
{ expect(deleteButtons[0]).toBeVisible(); }); - it('displays document delete button', async () => { - mockKeycloak({ claims: [Claims.DOCUMENT_VIEW, Claims.DOCUMENT_DELETE] }); - const { getAllByTestId } = setup({ - results: mockDocumentsResponse().map(x => DocumentRow.fromApi(x)), - }); - - const deleteButtons = await getAllByTestId('document-delete-button'); - expect(deleteButtons[0]).toBeVisible(); + it('displays default number of entries of 10', async () => { + mockKeycloak({ claims: [Claims.DOCUMENT_VIEW] }); + const largeDataset = Array.from({ length: 15 }, (id: number) => + DocumentRow.fromApi(mockDocumentResponse(id)), + ); + const { findByText } = setup({ results: largeDataset }); + expect(await findByText('1 - 10 of 15')).toBeVisible(); }); }); diff --git a/source/frontend/src/features/documents/list/DocumentResults/DocumentResults.tsx b/source/frontend/src/features/documents/list/DocumentResults/DocumentResults.tsx index 50098afc34..f49e116450 100644 --- a/source/frontend/src/features/documents/list/DocumentResults/DocumentResults.tsx +++ b/source/frontend/src/features/documents/list/DocumentResults/DocumentResults.tsx @@ -33,7 +33,7 @@ export const DocumentResults: React.FunctionComponent< externalSort={{ sort, setSort }} data={results ?? []} noRowsMessage="No matching Documents found" - pageSize={1} + pageSize={10} manualPagination={false} {...rest} > diff --git a/source/frontend/src/features/documents/list/DocumentResults/__snapshots__/DocumentResults.test.tsx.snap b/source/frontend/src/features/documents/list/DocumentResults/__snapshots__/DocumentResults.test.tsx.snap index b313829d4d..bbd9d1e1df 100644 --- a/source/frontend/src/features/documents/list/DocumentResults/__snapshots__/DocumentResults.test.tsx.snap +++ b/source/frontend/src/features/documents/list/DocumentResults/__snapshots__/DocumentResults.test.tsx.snap @@ -347,6 +347,97 @@ exports[`Document Results Table matches snapshot 1`] = `
+
+
+
+ MOTIPLAN +
+
+ + moti_plan.txt + +
+
+
+
+ Sep 8, 2022 +
+
+ + + + + + + +
+
+
+
+ Amended +
+
+
+
+
+
.c0 { @@ -360,7 +451,7 @@ exports[`Document Results Table matches snapshot 1`] = ` class="align-self-center col-auto" > - 1 - 1 of 2 + 1 - 2 of 2
  • - -
  • -
  • diff --git a/source/frontend/src/features/documents/list/__snapshots__/DocumentListView.test.tsx.snap b/source/frontend/src/features/documents/list/__snapshots__/DocumentListView.test.tsx.snap index ad5402b7c8..4ded50e830 100644 --- a/source/frontend/src/features/documents/list/__snapshots__/DocumentListView.test.tsx.snap +++ b/source/frontend/src/features/documents/list/__snapshots__/DocumentListView.test.tsx.snap @@ -779,6 +779,97 @@ exports[`Document List View renders as expected 1`] = `
  • +
    +
    +
    + MOTIPLAN +
    +
    + + moti_plan.txt + +
    +
    +
    +
    + Sep 8, 2022 +
    +
    + + + + + + + +
    +
    +
    +
    + Amended +
    +
    +
    +
    +
    +
    - 1 - 1 of 2 + 1 - 2 of 2
  • - -
  • -
  • diff --git a/source/frontend/src/features/leases/list/LeaseSearchResults/__snapshots__/LeaseSearchResults.test.tsx.snap b/source/frontend/src/features/leases/list/LeaseSearchResults/__snapshots__/LeaseSearchResults.test.tsx.snap index aa7ae68932..dcc0d88789 100644 --- a/source/frontend/src/features/leases/list/LeaseSearchResults/__snapshots__/LeaseSearchResults.test.tsx.snap +++ b/source/frontend/src/features/leases/list/LeaseSearchResults/__snapshots__/LeaseSearchResults.test.tsx.snap @@ -485,7 +485,7 @@ exports[`Lease Search Results Table matches snapshot 1`] = ` class="align-self-center col-auto" > - 1 - 2 of 2 + 1 - 2 of 2
  • - 1 - 4 of 4 + 1 - 4 of 4
    ({ + id, + parentId: 1, + isDisabled: false, + document: { + id: 21, + mayanDocumentId: 33, + documentType: { + id: 8, + documentType: 'MoTI Plan', + documentTypeDescription: 'MOTIPLAN', + mayanId: 24, + appCreateTimestamp: '2022-09-08T21:18:09.01', + appLastUpdateTimestamp: '2022-09-08T21:18:09.01', + appLastUpdateUserid: 'admin', + appCreateUserid: 'admin', + appLastUpdateUserGuid: '14c9a273-6f4a-4859-8d59-9264d3cee53f', + appCreateUserGuid: '14c9a273-6f4a-4859-8d59-9264d3cee53f', + rowVersion: 1, + isDisabled: false, + }, + statusTypeCode: { + id: 'AMENDD', + description: 'Amended', + isDisabled: false, + }, + fileName: 'moti_plan.txt', + appCreateTimestamp: '2022-09-08T21:18:54.057', + appLastUpdateTimestamp: '2022-09-08T21:18:54.057', + appLastUpdateUserid: 'admin', + appCreateUserid: 'admin', + appLastUpdateUserGuid: '14c9a273-6f4a-4859-8d59-9264d3cee53f', + appCreateUserGuid: '14c9a273-6f4a-4859-8d59-9264d3cee53f', + rowVersion: 1, + }, + relationshipType: DocumentRelationshipType.ACQUISITION_FILES, + appCreateTimestamp: '2022-09-08T21:18:54.057', + appLastUpdateTimestamp: '2022-09-08T21:18:54.057', + appLastUpdateUserid: 'admin', + appCreateUserid: 'admin', + appLastUpdateUserGuid: '14c9a273-6f4a-4859-8d59-9264d3cee53f', + appCreateUserGuid: '14c9a273-6f4a-4859-8d59-9264d3cee53f', + rowVersion: 1, +}); + export const mockDocumentsResponse = (): Api_DocumentRelationship[] => [ { id: 1,