diff --git a/app/react/components/datatables/NestedDatatable.tsx b/app/react/components/datatables/NestedDatatable.tsx index dfa7f6d54..17081e166 100644 --- a/app/react/components/datatables/NestedDatatable.tsx +++ b/app/react/components/datatables/NestedDatatable.tsx @@ -25,7 +25,7 @@ interface Props extends AutomationTestingProps { initialTableState?: Partial; isLoading?: boolean; initialSortBy?: BasicTableSettings['sortBy']; - + enablePagination?: boolean; /** * keyword to filter by */ @@ -42,6 +42,7 @@ export function NestedDatatable({ initialTableState = {}, isLoading, initialSortBy, + enablePagination = true, search, 'data-cy': dataCy, 'aria-label': ariaLabel, @@ -65,7 +66,7 @@ export function NestedDatatable({ getCoreRowModel: getCoreRowModel(), getFilteredRowModel: getFilteredRowModel(), getSortedRowModel: getSortedRowModel(), - getPaginationRowModel: getPaginationRowModel(), + ...(enablePagination && { getPaginationRowModel: getPaginationRowModel() }), }); return ( diff --git a/app/react/kubernetes/applications/ListView/ApplicationsDatatable/InnerTable.test.tsx b/app/react/kubernetes/applications/ListView/ApplicationsDatatable/InnerTable.test.tsx new file mode 100644 index 000000000..85d432665 --- /dev/null +++ b/app/react/kubernetes/applications/ListView/ApplicationsDatatable/InnerTable.test.tsx @@ -0,0 +1,43 @@ +import { render, screen } from '@testing-library/react'; +import { vi } from 'vitest'; + +import { withTestQueryProvider } from '@/react/test-utils/withTestQuery'; +import { withTestRouter } from '@/react/test-utils/withRouter'; + +import { InnerTable } from './InnerTable'; +import { Application } from './types'; + +// Mock the necessary hooks +const mockUseEnvironmentId = vi.fn(() => 1); + +vi.mock('@/react/hooks/useEnvironmentId', () => ({ + useEnvironmentId: () => mockUseEnvironmentId(), +})); + +describe('InnerTable', () => { + it('should render all rows from the dataset', () => { + const mockApplications: Application[] = Array.from( + { length: 11 }, + (_, index) => ({ + Id: `app-${index}`, + Name: `Application ${index}`, + Image: `image-${index}`, + CreationDate: new Date().toISOString(), + ResourcePool: 'default', + ApplicationType: 'Deployment', + Status: 'Ready', + TotalPodsCount: 1, + RunningPodsCount: 1, + DeploymentType: 'Replicated', + }) + ); + + const Wrapped = withTestQueryProvider(withTestRouter(InnerTable)); + render(); + + // Verify that all 11 rows are rendered + const rows = screen.getAllByRole('row'); + // Subtract 1 for the header row + expect(rows.length - 1).toBe(11); + }); +}); diff --git a/app/react/kubernetes/applications/ListView/ApplicationsDatatable/InnerTable.tsx b/app/react/kubernetes/applications/ListView/ApplicationsDatatable/InnerTable.tsx index 03c5cb206..ccb1b2d0f 100644 --- a/app/react/kubernetes/applications/ListView/ApplicationsDatatable/InnerTable.tsx +++ b/app/react/kubernetes/applications/ListView/ApplicationsDatatable/InnerTable.tsx @@ -17,6 +17,7 @@ export function InnerTable({ dataset={dataset} columns={columns} data-cy="applications-nested-datatable" + enablePagination={false} /> ); }