Realm roles: fix pagination by 10 (#367)

* fix pagination by 10

* fix types

* format

* format

* PR feedback from Erik
This commit is contained in:
Eugenia 2021-02-18 01:38:23 -05:00 committed by GitHub
parent 689e01b461
commit 93d5d21894
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -6,9 +6,9 @@ import { RolesList } from "./RolesList";
export const RealmRolesSection = () => { export const RealmRolesSection = () => {
const adminClient = useAdminClient(); const adminClient = useAdminClient();
const loader = async (to?: number, max?: number, search?: string) => { const loader = async (first?: number, max?: number, search?: string) => {
const params: { [name: string]: string | number } = { const params: { [name: string]: string | number } = {
to: to!, first: first!,
max: max!, max: max!,
search: search!, search: search!,
}; };

View file

@ -13,13 +13,13 @@ import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
import { emptyFormatter, boolFormatter } from "../util"; import { emptyFormatter, boolFormatter } from "../util";
type RolesListProps = { type RolesListProps = {
loader: ( paginated?: boolean;
parentRoleId?: string;
loader?: (
first?: number, first?: number,
max?: number, max?: number,
search?: string search?: string
) => Promise<RoleRepresentation[]>; ) => Promise<RoleRepresentation[]>;
paginated?: boolean;
parentRoleId?: string;
}; };
export const RolesList = ({ export const RolesList = ({
@ -75,7 +75,7 @@ export const RolesList = ({
<DeleteConfirm /> <DeleteConfirm />
<KeycloakDataTable <KeycloakDataTable
key={selectedRole ? selectedRole.id : "roleList"} key={selectedRole ? selectedRole.id : "roleList"}
loader={loader} loader={loader!}
ariaLabelKey="roles:roleList" ariaLabelKey="roles:roleList"
searchPlaceholderKey="roles:searchFor" searchPlaceholderKey="roles:searchFor"
isPaginated={paginated} isPaginated={paginated}