Remove duplicated constants and add creator option to user import modal

This commit is contained in:
Andrew Kingston 2023-11-23 14:31:27 +00:00
parent 820eeeafe5
commit 2cac5c9e8c
2 changed files with 7 additions and 19 deletions

View File

@ -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

View File

@ -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",