Fix crash when using empty groups, update user invite picker to be right aligned like others

This commit is contained in:
Andrew Kingston 2023-02-28 13:20:00 +00:00
parent 9f3176ce09
commit 75215f244a
1 changed files with 11 additions and 5 deletions

View File

@ -18,6 +18,7 @@
import { Constants, Utils } from "@budibase/frontend-core" import { Constants, Utils } from "@budibase/frontend-core"
import { emailValidator } from "helpers/validation" import { emailValidator } from "helpers/validation"
import CopyInput from "components/common/inputs/CopyInput.svelte" import CopyInput from "components/common/inputs/CopyInput.svelte"
import { roles } from "stores/backend"
let query = null let query = null
let loaded = false let loaded = false
@ -206,7 +207,7 @@
const enrichGroupRole = group => { const enrichGroupRole = group => {
return { return {
...group, ...group,
role: group.roles[ role: group.roles?.[
groups.actions.getGroupAppIds(group).find(x => x === prodAppId) groups.actions.getGroupAppIds(group).find(x => x === prodAppId)
], ],
} }
@ -373,8 +374,9 @@
} }
const getRoleFooter = user => { const getRoleFooter = user => {
if (!user.role && user.group) { if (user.group) {
return "This user has been given access via their group" const role = $roles.find(role => role._id === user.role)
return `This user has been given ${role?.name} access from the ${user.group} group`
} }
if (user.isBuilderOrAdmin) { if (user.isBuilderOrAdmin) {
return "This user's role grants admin access to all apps" return "This user's role grants admin access to all apps"
@ -489,6 +491,8 @@
on:remove={() => { on:remove={() => {
onUninviteAppUser(invite) onUninviteAppUser(invite)
}} }}
autoWidth
align="right"
/> />
</div> </div>
</div> </div>
@ -538,6 +542,8 @@
on:remove={() => { on:remove={() => {
onUpdateGroup(group) onUpdateGroup(group)
}} }}
autoWidth
align="right"
/> />
</div> </div>
</div> </div>
@ -645,7 +651,7 @@
} }
.auth-entity-access.muted :global(.spectrum-Picker-label), .auth-entity-access.muted :global(.spectrum-Picker-label),
.auth-entity-access.muted :global(.spectrum-StatusLight) { .auth-entity-access.muted :global(.spectrum-StatusLight) {
opacity: 0.7; opacity: 0.5;
} }
.auth-entity-header { .auth-entity-header {
@ -660,7 +666,7 @@
.auth-entity, .auth-entity,
.auth-entity-header { .auth-entity-header {
display: grid; display: grid;
grid-template-columns: 1fr 100px; grid-template-columns: 1fr 110px;
align-items: center; align-items: center;
gap: var(--spacing-xl); gap: var(--spacing-xl);
} }