Merge branch 'master' into fix/relationship-issue-one-to-many

This commit is contained in:
Michael Drury 2023-10-31 14:27:52 +00:00 committed by GitHub
commit c0b2c9e448
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 23 deletions

View File

@ -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,

View File

@ -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,8 +144,10 @@
const updateFetch = email => {
fetch.update({
query: {
string: {
email,
},
},
})
}
const debouncedUpdateFetch = Utils.debounce(updateFetch, 250)
@ -296,7 +299,7 @@
{/if}
<div class="controls">
{#if !readonly}
<ButtonGroup>
<div class="buttons">
<Button
disabled={readonly}
on:click={$licensing.userLimitReached
@ -315,7 +318,7 @@
>
Import
</Button>
</ButtonGroup>
</div>
{:else}
<ScimBanner />
{/if}
@ -390,12 +393,15 @@
</Modal>
<style>
.buttons {
display: flex;
gap: 10px;
}
.pagination {
display: flex;
flex-direction: row;
justify-content: flex-end;
}
.controls {
display: flex;
flex-direction: row;
@ -403,7 +409,6 @@
align-items: center;
gap: var(--spacing-xl);
}
.controls-right {
display: flex;
flex-direction: row;
@ -411,7 +416,6 @@
align-items: center;
gap: var(--spacing-xl);
}
.controls-right :global(.spectrum-Search) {
width: 200px;
}