add first and max to group member query (#30327)

fixes: #30143

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2024-06-14 14:26:19 +02:00 committed by GitHub
parent 8fd6e069a8
commit 716e2d4e68
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 7 deletions

View file

@ -154,8 +154,8 @@ export const Members = () => {
<> <>
{addMembers && ( {addMembers && (
<MemberModal <MemberModal
membersQuery={async () => membersQuery={(first, max) =>
await adminClient.groups.listMembers({ id: id! }) adminClient.groups.listMembers({ id: id!, first, max })
} }
onAdd={async (selectedRows) => { onAdd={async (selectedRows) => {
try { try {

View file

@ -10,7 +10,7 @@ import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable
import { emptyFormatter } from "../util"; import { emptyFormatter } from "../util";
type MemberModalProps = { type MemberModalProps = {
membersQuery: () => Promise<UserRepresentation[]>; membersQuery: (first?: number, max?: number) => Promise<UserRepresentation[]>;
onAdd: (users: UserRepresentation[]) => Promise<void>; onAdd: (users: UserRepresentation[]) => Promise<void>;
onClose: () => void; onClose: () => void;
}; };
@ -27,7 +27,7 @@ export const MemberModal = ({
const [selectedRows, setSelectedRows] = useState<UserRepresentation[]>([]); const [selectedRows, setSelectedRows] = useState<UserRepresentation[]>([]);
const loader = async (first?: number, max?: number, search?: string) => { const loader = async (first?: number, max?: number, search?: string) => {
const members = await membersQuery(); const members = await membersQuery(first, max);
const params: { [name: string]: string | number } = { const params: { [name: string]: string | number } = {
first: first!, first: first!,
max: max! + members.length, max: max! + members.length,

View file

@ -72,9 +72,7 @@ export const Members = () => {
<PageSection variant="light"> <PageSection variant="light">
{openAddMembers && ( {openAddMembers && (
<MemberModal <MemberModal
membersQuery={async () => membersQuery={() => adminClient.organizations.listMembers({ orgId })}
await adminClient.organizations.listMembers({ orgId })
}
onAdd={async (selectedRows) => { onAdd={async (selectedRows) => {
try { try {
await Promise.all( await Promise.all(