From 716e2d4e6804bb770ee8897b873c7d6405f39d66 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Fri, 14 Jun 2024 14:26:19 +0200 Subject: [PATCH] add first and max to group member query (#30327) fixes: #30143 Signed-off-by: Erik Jan de Wit --- js/apps/admin-ui/src/groups/Members.tsx | 4 ++-- js/apps/admin-ui/src/groups/MembersModal.tsx | 4 ++-- js/apps/admin-ui/src/organizations/Members.tsx | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/js/apps/admin-ui/src/groups/Members.tsx b/js/apps/admin-ui/src/groups/Members.tsx index ea56774a46..84a2a1443c 100644 --- a/js/apps/admin-ui/src/groups/Members.tsx +++ b/js/apps/admin-ui/src/groups/Members.tsx @@ -154,8 +154,8 @@ export const Members = () => { <> {addMembers && ( - await adminClient.groups.listMembers({ id: id! }) + membersQuery={(first, max) => + adminClient.groups.listMembers({ id: id!, first, max }) } onAdd={async (selectedRows) => { try { diff --git a/js/apps/admin-ui/src/groups/MembersModal.tsx b/js/apps/admin-ui/src/groups/MembersModal.tsx index b2a92faf2c..1fb8cf34c9 100644 --- a/js/apps/admin-ui/src/groups/MembersModal.tsx +++ b/js/apps/admin-ui/src/groups/MembersModal.tsx @@ -10,7 +10,7 @@ import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable import { emptyFormatter } from "../util"; type MemberModalProps = { - membersQuery: () => Promise; + membersQuery: (first?: number, max?: number) => Promise; onAdd: (users: UserRepresentation[]) => Promise; onClose: () => void; }; @@ -27,7 +27,7 @@ export const MemberModal = ({ const [selectedRows, setSelectedRows] = useState([]); 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 } = { first: first!, max: max! + members.length, diff --git a/js/apps/admin-ui/src/organizations/Members.tsx b/js/apps/admin-ui/src/organizations/Members.tsx index 9a9912186b..91cd0d8f17 100644 --- a/js/apps/admin-ui/src/organizations/Members.tsx +++ b/js/apps/admin-ui/src/organizations/Members.tsx @@ -72,9 +72,7 @@ export const Members = () => { {openAddMembers && ( - await adminClient.organizations.listMembers({ orgId }) - } + membersQuery={() => adminClient.organizations.listMembers({ orgId })} onAdd={async (selectedRows) => { try { await Promise.all(