Skip to content

Commit

Permalink
slight adjustments rendered items count
Browse files Browse the repository at this point in the history
  • Loading branch information
eokoneyo committed Jul 29, 2024
1 parent 6bc107d commit a3f3cda
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ export const SpaceAssignedRolesTable = ({

const tableHeader = useMemo<EuiInMemoryTableProps<Role>['childrenBetween']>(() => {
const pageSize = pagination.size;
const pageIndex = pagination.index;

return (
<EuiFlexGroup direction="column" gutterSize="none">
Expand All @@ -251,8 +252,11 @@ export const SpaceAssignedRolesTable = ({
defaultMessage:
'Showing: {pageItemLength} of {rolesInViewCount} | Selected: {selectedCount} roles',
values: {
pageItemLength:
rolesInView.length < pageSize ? rolesInView.length : pageSize,
pageItemLength: Math.floor(
rolesInView.length / (pageSize * (pageIndex + 1))
)
? pageSize * (pageIndex + 1)
: rolesInView.length % pageSize,
rolesInViewCount: rolesInView.length,
selectedCount: selectedRoles.length,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ interface Props {
export const filterRolesAssignedToSpace = (roles: Role[], space: Space) => {
return roles.filter((role) =>
role.kibana.reduce((acc, cur) => {
return (
(cur.spaces.includes(space.name) || cur.spaces.includes('*')) &&
Boolean(cur.base.length) &&
acc
);
return (cur.spaces.includes(space.name) || cur.spaces.includes('*')) && acc;
}, true)
);
};
Expand Down

0 comments on commit a3f3cda

Please sign in to comment.