[Fleet][Cloud] Enrollment token table may show an empty last page #167663 (#188049)

Fixes #167663 

## Summary

Fixes the creation of extra empty page at pagination of 5 rows


### Video 


cdac6a22-f239-4b70-b40c-93fc727418a6

Co-authored-by: Julien Lind <julien.lind@elastic.co>
This commit is contained in:
Pratham Shirbhate 2024-07-11 14:45:54 +05:30 committed by GitHub
parent 7950fb85ca
commit 1f7fdfdfe4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -128,6 +128,7 @@ export const EnrollmentTokenListPage: React.FunctionComponent<{}> = () => {
const agentPolicy = agentPoliciesById[enrollmentKey.policy_id];
return !agentPolicy?.is_managed;
}) || [];
const filteredTotal = rowItems.length;
const columns = [
{
@ -294,7 +295,7 @@ export const EnrollmentTokenListPage: React.FunctionComponent<{}> = () => {
pagination={{
pageIndex: pagination.currentPage - 1,
pageSize: pagination.pageSize,
totalItemCount: total,
totalItemCount: filteredTotal,
pageSizeOptions,
}}
onChange={({ page }: { page: { index: number; size: number } }) => {