1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-18 21:09:40 +02:00

fix(kubernetes): Display more than 10 workloads under Helm expandable in the Applications view [R8S-339] (#781)

This commit is contained in:
Cara Ryan 2025-06-09 15:12:24 +12:00 committed by GitHub
parent 9a85246631
commit c9e3717ce3
3 changed files with 47 additions and 2 deletions

View file

@ -25,7 +25,7 @@ interface Props<D extends DefaultType> extends AutomationTestingProps {
initialTableState?: Partial<TableState>;
isLoading?: boolean;
initialSortBy?: BasicTableSettings['sortBy'];
enablePagination?: boolean;
/**
* keyword to filter by
*/
@ -42,6 +42,7 @@ export function NestedDatatable<D extends DefaultType>({
initialTableState = {},
isLoading,
initialSortBy,
enablePagination = true,
search,
'data-cy': dataCy,
'aria-label': ariaLabel,
@ -65,7 +66,7 @@ export function NestedDatatable<D extends DefaultType>({
getCoreRowModel: getCoreRowModel(),
getFilteredRowModel: getFilteredRowModel(),
getSortedRowModel: getSortedRowModel(),
getPaginationRowModel: getPaginationRowModel(),
...(enablePagination && { getPaginationRowModel: getPaginationRowModel() }),
});
return (

View file

@ -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(<Wrapped dataset={mockApplications} hideStacks={false} />);
// Verify that all 11 rows are rendered
const rows = screen.getAllByRole('row');
// Subtract 1 for the header row
expect(rows.length - 1).toBe(11);
});
});

View file

@ -17,6 +17,7 @@ export function InnerTable({
dataset={dataset}
columns={columns}
data-cy="applications-nested-datatable"
enablePagination={false}
/>
);
}