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 { emailValidator } from "helpers/validation"
|
||||||
import { Constants } from "@budibase/frontend-core"
|
import { Constants } from "@budibase/frontend-core"
|
||||||
import { capitalise } from "helpers"
|
import { capitalise } from "helpers"
|
||||||
|
import { BudibaseRoleOptions } from "@budibase/frontend-core/src/constants"
|
||||||
|
|
||||||
const BYTES_IN_MB = 1000000
|
const BYTES_IN_MB = 1000000
|
||||||
const FILE_SIZE_LIMIT = BYTES_IN_MB * 5
|
const FILE_SIZE_LIMIT = BYTES_IN_MB * 5
|
||||||
|
@ -22,13 +23,16 @@
|
||||||
let userEmails = []
|
let userEmails = []
|
||||||
let userGroups = []
|
let userGroups = []
|
||||||
let usersRole = null
|
let usersRole = null
|
||||||
$: invalidEmails = []
|
|
||||||
|
|
||||||
|
$: invalidEmails = []
|
||||||
$: userCount = $licensing.userCount + userEmails.length
|
$: userCount = $licensing.userCount + userEmails.length
|
||||||
$: exceed = licensing.usersLimitExceeded(userCount)
|
$: exceed = licensing.usersLimitExceeded(userCount)
|
||||||
|
|
||||||
$: importDisabled =
|
$: importDisabled =
|
||||||
!userEmails.length || !validEmails(userEmails) || !usersRole || exceed
|
!userEmails.length || !validEmails(userEmails) || !usersRole || exceed
|
||||||
|
$: roleOptions = Constants.BudibaseRoleOptions.map(option => ({
|
||||||
|
...option,
|
||||||
|
label: `${option.label} - ${option.subtitle}`,
|
||||||
|
}))
|
||||||
|
|
||||||
const validEmails = userEmails => {
|
const validEmails = userEmails => {
|
||||||
if ($admin.cloud && userEmails.length > MAX_USERS_UPLOAD_LIMIT) {
|
if ($admin.cloud && userEmails.length > MAX_USERS_UPLOAD_LIMIT) {
|
||||||
|
@ -100,10 +104,7 @@
|
||||||
users. Upgrade your plan to add more users
|
users. Upgrade your plan to add more users
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<RadioGroup
|
<RadioGroup bind:value={usersRole} options={roleOptions} />
|
||||||
bind:value={usersRole}
|
|
||||||
options={Constants.BuilderRoleDescriptions}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{#if $licensing.groupsEnabled}
|
{#if $licensing.groupsEnabled}
|
||||||
<Multiselect
|
<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 = {
|
export const PlanType = {
|
||||||
FREE: "free",
|
FREE: "free",
|
||||||
TEAM: "team",
|
TEAM: "team",
|
||||||
|
|
Loading…
Reference in New Issue