diff --git a/packages/backend-core/src/users/users.ts b/packages/backend-core/src/users/users.ts index ea4a17214d..6dc8750b62 100644 --- a/packages/backend-core/src/users/users.ts +++ b/packages/backend-core/src/users/users.ts @@ -249,7 +249,8 @@ export const paginatedUsers = async ({ limit, }: SearchUsersRequest = {}) => { const db = getGlobalDB() - const pageLimit = limit ? limit + 1 : PAGE_LIMIT + 1 + const pageSize = limit ?? PAGE_LIMIT + const pageLimit = pageSize + 1 // get one extra document, to have the next page const opts: DatabaseQueryOpts = { include_docs: true, @@ -276,7 +277,7 @@ export const paginatedUsers = async ({ const response = await db.allDocs(getGlobalUserParams(null, opts)) userList = response.rows.map((row: any) => row.doc) } - return pagination(userList, pageLimit, { + return pagination(userList, pageSize, { paginate: true, property, getKey, diff --git a/packages/builder/src/pages/builder/portal/users/users/index.svelte b/packages/builder/src/pages/builder/portal/users/users/index.svelte index e1fc0ca7eb..ff8b749602 100644 --- a/packages/builder/src/pages/builder/portal/users/users/index.svelte +++ b/packages/builder/src/pages/builder/portal/users/users/index.svelte @@ -3,7 +3,6 @@ Heading, Body, Button, - ButtonGroup, Table, Layout, Modal, @@ -46,6 +45,10 @@ datasource: { type: "user", }, + options: { + paginate: true, + limit: 10, + }, }) let groupsLoaded = !$licensing.groupsEnabled || $groups?.length @@ -65,10 +68,12 @@ { column: "role", component: RoleTableRenderer }, ] let userData = [] + let invitesLoaded = false + let pendingInvites = [] + let parsedInvites = [] $: isOwner = $auth.accountPortalAccess && $admin.cloud $: readonly = !sdk.users.isAdmin($auth.user) || $features.isScimEnabled - $: debouncedUpdateFetch(searchEmail) $: schema = { email: { @@ -88,16 +93,6 @@ width: "1fr", }, } - - const getPendingSchema = tblSchema => { - if (!tblSchema) { - return {} - } - let pendingSchema = JSON.parse(JSON.stringify(tblSchema)) - pendingSchema.email.displayName = "Pending Invites" - return pendingSchema - } - $: pendingSchema = getPendingSchema(schema) $: userData = [] $: inviteUsersResponse = { successful: [], unsuccessful: [] } @@ -121,9 +116,15 @@ } }) } - let invitesLoaded = false - let pendingInvites = [] - let parsedInvites = [] + + const getPendingSchema = tblSchema => { + if (!tblSchema) { + return {} + } + let pendingSchema = JSON.parse(JSON.stringify(tblSchema)) + pendingSchema.email.displayName = "Pending Invites" + return pendingSchema + } const invitesToSchema = invites => { return invites.map(invite => { @@ -143,7 +144,9 @@ const updateFetch = email => { fetch.update({ query: { - email, + string: { + email, + }, }, }) } @@ -296,7 +299,7 @@ {/if}