Fix footer in fancy select and allow inviting creators from side panel
This commit is contained in:
parent
295965d1d3
commit
302f6f6106
|
@ -12,11 +12,13 @@
|
||||||
export let error = null
|
export let error = null
|
||||||
export let validate = null
|
export let validate = null
|
||||||
export let options = []
|
export let options = []
|
||||||
|
export let footer = null
|
||||||
export let isOptionEnabled = () => true
|
export let isOptionEnabled = () => true
|
||||||
export let getOptionLabel = option => extractProperty(option, "label")
|
export let getOptionLabel = option => extractProperty(option, "label")
|
||||||
export let getOptionValue = option => extractProperty(option, "value")
|
export let getOptionValue = option => extractProperty(option, "value")
|
||||||
export let getOptionSubtitle = option => extractProperty(option, "subtitle")
|
export let getOptionSubtitle = option => extractProperty(option, "subtitle")
|
||||||
export let getOptionColour = () => null
|
export let getOptionColour = () => null
|
||||||
|
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
let open = false
|
let open = false
|
||||||
|
@ -100,6 +102,7 @@
|
||||||
{error}
|
{error}
|
||||||
{disabled}
|
{disabled}
|
||||||
{options}
|
{options}
|
||||||
|
{footer}
|
||||||
{getOptionLabel}
|
{getOptionLabel}
|
||||||
{getOptionValue}
|
{getOptionValue}
|
||||||
{getOptionSubtitle}
|
{getOptionSubtitle}
|
||||||
|
|
|
@ -364,7 +364,10 @@
|
||||||
const payload = [
|
const payload = [
|
||||||
{
|
{
|
||||||
email: newUserEmail,
|
email: newUserEmail,
|
||||||
builder: { global: creationRoleType === Constants.BudibaseRoles.Admin },
|
builder: {
|
||||||
|
global: creationRoleType === Constants.BudibaseRoles.Admin,
|
||||||
|
creator: creationRoleType === Constants.BudibaseRoles.Creator,
|
||||||
|
},
|
||||||
admin: { global: creationRoleType === Constants.BudibaseRoles.Admin },
|
admin: { global: creationRoleType === Constants.BudibaseRoles.Admin },
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -517,6 +520,18 @@
|
||||||
}
|
}
|
||||||
return user.role
|
return user.role
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const checkAppAccess = e => {
|
||||||
|
// Ensure we don't get into an invalid combo of tenant role and app access
|
||||||
|
if (
|
||||||
|
e.detail === Constants.BudibaseRoles.AppUser &&
|
||||||
|
creationAccessType === Constants.Roles.CREATOR
|
||||||
|
) {
|
||||||
|
creationAccessType = Constants.Roles.BASIC
|
||||||
|
} else if (e.detail === Constants.BudibaseRoles.Admin) {
|
||||||
|
creationAccessType = Constants.Roles.CREATOR
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<svelte:window on:keydown={handleKeyDown} />
|
<svelte:window on:keydown={handleKeyDown} />
|
||||||
|
@ -802,28 +817,29 @@
|
||||||
option => option.value !== Constants.BudibaseRoles.Admin
|
option => option.value !== Constants.BudibaseRoles.Admin
|
||||||
)}
|
)}
|
||||||
label="Access"
|
label="Access"
|
||||||
|
on:change={checkAppAccess}
|
||||||
/>
|
/>
|
||||||
{#if creationRoleType !== Constants.BudibaseRoles.Admin}
|
<span class="role-wrap">
|
||||||
<span class="role-wrap">
|
<RoleSelect
|
||||||
<RoleSelect
|
placeholder={false}
|
||||||
placeholder={false}
|
bind:value={creationAccessType}
|
||||||
bind:value={creationAccessType}
|
allowPublic={false}
|
||||||
allowPublic={false}
|
allowCreator={creationRoleType !==
|
||||||
allowCreator={true}
|
Constants.BudibaseRoles.AppUser}
|
||||||
quiet={true}
|
quiet={true}
|
||||||
autoWidth
|
autoWidth
|
||||||
align="right"
|
align="right"
|
||||||
fancySelect
|
fancySelect
|
||||||
/>
|
allowedRoles={creationRoleType === Constants.BudibaseRoles.Admin
|
||||||
</span>
|
? [Constants.Roles.CREATOR]
|
||||||
{/if}
|
: null}
|
||||||
|
footer={getRoleFooter({
|
||||||
|
isAdminOrGlobalBuilder:
|
||||||
|
creationRoleType === Constants.BudibaseRoles.Admin,
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
</span>
|
||||||
</FancyForm>
|
</FancyForm>
|
||||||
{#if creationRoleType === Constants.BudibaseRoles.Admin}
|
|
||||||
<div class="admin-info">
|
|
||||||
<Icon name="Info" />
|
|
||||||
Admins will get full access to all apps and settings
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<span class="add-user">
|
<span class="add-user">
|
||||||
<Button
|
<Button
|
||||||
newStyles
|
newStyles
|
||||||
|
@ -864,16 +880,6 @@
|
||||||
display: grid;
|
display: grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
.admin-info {
|
|
||||||
margin-top: var(--spacing-xl);
|
|
||||||
padding: var(--spacing-l) var(--spacing-l) var(--spacing-l) var(--spacing-l);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: var(--spacing-xl);
|
|
||||||
height: 30px;
|
|
||||||
background-color: var(--background-alt);
|
|
||||||
}
|
|
||||||
|
|
||||||
.underlined {
|
.underlined {
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
Loading…
Reference in New Issue