Merge pull request #10469 from Budibase/feature/portal-pending-users-section
Pending user invites displayed in the user page.
This commit is contained in:
commit
66c6b82a8a
|
@ -22,6 +22,7 @@
|
||||||
export let rowCount
|
export let rowCount
|
||||||
export let disableSorting = false
|
export let disableSorting = false
|
||||||
export let customPlaceholder = false
|
export let customPlaceholder = false
|
||||||
|
export let allowClickRows
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
|
@ -110,6 +111,7 @@
|
||||||
{disableSorting}
|
{disableSorting}
|
||||||
{customPlaceholder}
|
{customPlaceholder}
|
||||||
showAutoColumns={!hideAutocolumns}
|
showAutoColumns={!hideAutocolumns}
|
||||||
|
{allowClickRows}
|
||||||
on:clickrelationship={e => selectRelationship(e.detail)}
|
on:clickrelationship={e => selectRelationship(e.detail)}
|
||||||
on:sort
|
on:sort
|
||||||
>
|
>
|
||||||
|
|
|
@ -696,7 +696,7 @@
|
||||||
max-width: calc(100vw - 40px);
|
max-width: calc(100vw - 40px);
|
||||||
background: var(--background);
|
background: var(--background);
|
||||||
border-left: var(--border-light);
|
border-left: var(--border-light);
|
||||||
z-index: 3;
|
z-index: 999;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
|
|
|
@ -88,6 +88,16 @@
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getPendingSchema = tblSchema => {
|
||||||
|
if (!tblSchema) {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
let pendingSchema = JSON.parse(JSON.stringify(tblSchema))
|
||||||
|
pendingSchema.email.displayName = "Pending Invites"
|
||||||
|
return pendingSchema
|
||||||
|
}
|
||||||
|
|
||||||
|
$: pendingSchema = getPendingSchema(schema)
|
||||||
$: userData = []
|
$: userData = []
|
||||||
$: inviteUsersResponse = { successful: [], unsuccessful: [] }
|
$: inviteUsersResponse = { successful: [], unsuccessful: [] }
|
||||||
$: {
|
$: {
|
||||||
|
@ -110,6 +120,24 @@
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
let invitesLoaded = false
|
||||||
|
let pendingInvites = []
|
||||||
|
let parsedInvites = []
|
||||||
|
|
||||||
|
const invitesToSchema = invites => {
|
||||||
|
return invites.map(invite => {
|
||||||
|
const { admin, builder, userGroups, apps } = invite.info
|
||||||
|
|
||||||
|
return {
|
||||||
|
email: invite.email,
|
||||||
|
builder,
|
||||||
|
admin,
|
||||||
|
userGroups: userGroups,
|
||||||
|
apps: apps ? [...new Set(Object.keys(apps))] : undefined,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
$: parsedInvites = invitesToSchema(pendingInvites)
|
||||||
|
|
||||||
const updateFetch = email => {
|
const updateFetch = email => {
|
||||||
fetch.update({
|
fetch.update({
|
||||||
|
@ -144,6 +172,7 @@
|
||||||
}))
|
}))
|
||||||
try {
|
try {
|
||||||
inviteUsersResponse = await users.invite(payload)
|
inviteUsersResponse = await users.invite(payload)
|
||||||
|
pendingInvites = await users.getInvites()
|
||||||
inviteConfirmationModal.show()
|
inviteConfirmationModal.show()
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error inviting user")
|
notifications.error("Error inviting user")
|
||||||
|
@ -232,6 +261,9 @@
|
||||||
try {
|
try {
|
||||||
await groups.actions.init()
|
await groups.actions.init()
|
||||||
groupsLoaded = true
|
groupsLoaded = true
|
||||||
|
|
||||||
|
pendingInvites = await users.getInvites()
|
||||||
|
invitesLoaded = true
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
notifications.error("Error fetching user group data")
|
notifications.error("Error fetching user group data")
|
||||||
}
|
}
|
||||||
|
@ -324,6 +356,15 @@
|
||||||
goToNextPage={fetch.nextPage}
|
goToNextPage={fetch.nextPage}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
<Table
|
||||||
|
schema={pendingSchema}
|
||||||
|
data={parsedInvites}
|
||||||
|
allowEditColumns={false}
|
||||||
|
allowEditRows={false}
|
||||||
|
{customRenderers}
|
||||||
|
loading={!invitesLoaded}
|
||||||
|
allowClickRows={false}
|
||||||
|
/>
|
||||||
</Layout>
|
</Layout>
|
||||||
|
|
||||||
<Modal bind:this={createUserModal}>
|
<Modal bind:this={createUserModal}>
|
||||||
|
|
Loading…
Reference in New Issue