Merge branch 'master' into form-block-field-layout

This commit is contained in:
Andrew Kingston 2023-10-31 14:35:20 +00:00 committed by GitHub
commit 5d29046fea
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, limit,
}: SearchUsersRequest = {}) => { }: SearchUsersRequest = {}) => {
const db = getGlobalDB() 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 // get one extra document, to have the next page
const opts: DatabaseQueryOpts = { const opts: DatabaseQueryOpts = {
include_docs: true, include_docs: true,
@ -276,7 +277,7 @@ export const paginatedUsers = async ({
const response = await db.allDocs(getGlobalUserParams(null, opts)) const response = await db.allDocs(getGlobalUserParams(null, opts))
userList = response.rows.map((row: any) => row.doc) userList = response.rows.map((row: any) => row.doc)
} }
return pagination(userList, pageLimit, { return pagination(userList, pageSize, {
paginate: true, paginate: true,
property, property,
getKey, getKey,

View File

@ -3,7 +3,6 @@
Heading, Heading,
Body, Body,
Button, Button,
ButtonGroup,
Table, Table,
Layout, Layout,
Modal, Modal,
@ -46,6 +45,10 @@
datasource: { datasource: {
type: "user", type: "user",
}, },
options: {
paginate: true,
limit: 10,
},
}) })
let groupsLoaded = !$licensing.groupsEnabled || $groups?.length let groupsLoaded = !$licensing.groupsEnabled || $groups?.length
@ -65,10 +68,12 @@
{ column: "role", component: RoleTableRenderer }, { column: "role", component: RoleTableRenderer },
] ]
let userData = [] let userData = []
let invitesLoaded = false
let pendingInvites = []
let parsedInvites = []
$: isOwner = $auth.accountPortalAccess && $admin.cloud $: isOwner = $auth.accountPortalAccess && $admin.cloud
$: readonly = !sdk.users.isAdmin($auth.user) || $features.isScimEnabled $: readonly = !sdk.users.isAdmin($auth.user) || $features.isScimEnabled
$: debouncedUpdateFetch(searchEmail) $: debouncedUpdateFetch(searchEmail)
$: schema = { $: schema = {
email: { email: {
@ -88,16 +93,6 @@
width: "1fr", 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) $: pendingSchema = getPendingSchema(schema)
$: userData = [] $: userData = []
$: inviteUsersResponse = { successful: [], unsuccessful: [] } $: inviteUsersResponse = { successful: [], unsuccessful: [] }
@ -121,9 +116,15 @@
} }
}) })
} }
let invitesLoaded = false
let pendingInvites = [] const getPendingSchema = tblSchema => {
let parsedInvites = [] if (!tblSchema) {
return {}
}
let pendingSchema = JSON.parse(JSON.stringify(tblSchema))
pendingSchema.email.displayName = "Pending Invites"
return pendingSchema
}
const invitesToSchema = invites => { const invitesToSchema = invites => {
return invites.map(invite => { return invites.map(invite => {
@ -143,7 +144,9 @@
const updateFetch = email => { const updateFetch = email => {
fetch.update({ fetch.update({
query: { query: {
email, string: {
email,
},
}, },
}) })
} }
@ -296,7 +299,7 @@
{/if} {/if}
<div class="controls"> <div class="controls">
{#if !readonly} {#if !readonly}
<ButtonGroup> <div class="buttons">
<Button <Button
disabled={readonly} disabled={readonly}
on:click={$licensing.userLimitReached on:click={$licensing.userLimitReached
@ -315,7 +318,7 @@
> >
Import Import
</Button> </Button>
</ButtonGroup> </div>
{:else} {:else}
<ScimBanner /> <ScimBanner />
{/if} {/if}
@ -390,12 +393,15 @@
</Modal> </Modal>
<style> <style>
.buttons {
display: flex;
gap: 10px;
}
.pagination { .pagination {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: flex-end; justify-content: flex-end;
} }
.controls { .controls {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -403,7 +409,6 @@
align-items: center; align-items: center;
gap: var(--spacing-xl); gap: var(--spacing-xl);
} }
.controls-right { .controls-right {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -411,7 +416,6 @@
align-items: center; align-items: center;
gap: var(--spacing-xl); gap: var(--spacing-xl);
} }
.controls-right :global(.spectrum-Search) { .controls-right :global(.spectrum-Search) {
width: 200px; width: 200px;
} }