Remove duplicated constants and add creator option to user import modal
This commit is contained in:
parent
820eeeafe5
commit
2cac5c9e8c
|
@ -11,6 +11,7 @@
|
|||
import { emailValidator } from "helpers/validation"
|
||||
import { Constants } from "@budibase/frontend-core"
|
||||
import { capitalise } from "helpers"
|
||||
import { BudibaseRoleOptions } from "@budibase/frontend-core/src/constants"
|
||||
|
||||
const BYTES_IN_MB = 1000000
|
||||
const FILE_SIZE_LIMIT = BYTES_IN_MB * 5
|
||||
|
@ -22,13 +23,16 @@
|
|||
let userEmails = []
|
||||
let userGroups = []
|
||||
let usersRole = null
|
||||
$: invalidEmails = []
|
||||
|
||||
$: invalidEmails = []
|
||||
$: userCount = $licensing.userCount + userEmails.length
|
||||
$: exceed = licensing.usersLimitExceeded(userCount)
|
||||
|
||||
$: importDisabled =
|
||||
!userEmails.length || !validEmails(userEmails) || !usersRole || exceed
|
||||
$: roleOptions = Constants.BudibaseRoleOptions.map(option => ({
|
||||
...option,
|
||||
label: `${option.label} - ${option.subtitle}`,
|
||||
}))
|
||||
|
||||
const validEmails = userEmails => {
|
||||
if ($admin.cloud && userEmails.length > MAX_USERS_UPLOAD_LIMIT) {
|
||||
|
@ -100,10 +104,7 @@
|
|||
users. Upgrade your plan to add more users
|
||||
</div>
|
||||
{/if}
|
||||
<RadioGroup
|
||||
bind:value={usersRole}
|
||||
options={Constants.BuilderRoleDescriptions}
|
||||
/>
|
||||
<RadioGroup bind:value={usersRole} options={roleOptions} />
|
||||
|
||||
{#if $licensing.groupsEnabled}
|
||||
<Multiselect
|
||||
|
|
|
@ -48,19 +48,6 @@ export const BudibaseRoleOptions = [
|
|||
},
|
||||
]
|
||||
|
||||
export const BuilderRoleDescriptions = [
|
||||
{
|
||||
value: BudibaseRoles.AppUser,
|
||||
icon: "User",
|
||||
label: "App user - Only has access to published apps",
|
||||
},
|
||||
{
|
||||
value: BudibaseRoles.Admin,
|
||||
icon: "Draw",
|
||||
label: "Admin - Full access",
|
||||
},
|
||||
]
|
||||
|
||||
export const PlanType = {
|
||||
FREE: "free",
|
||||
TEAM: "team",
|
||||
|
|
Loading…
Reference in New Issue