change(ui) - validation based on ee

This commit is contained in:
Shekar Siri 2022-05-13 11:19:23 +02:00
parent 4f1a686787
commit 34947d8ef7
2 changed files with 4 additions and 4 deletions

View file

@ -94,7 +94,7 @@ function UserForm(props: Props) {
</label>
</div>
{ !isEnterprise && (
{ isEnterprise && (
<div className="form-group">
<label htmlFor="role">{ 'Role' }</label>
<Select
@ -115,7 +115,7 @@ function UserForm(props: Props) {
<div className="flex items-center mr-auto">
<Button
onClick={ onSave }
disabled={ !user.valid() || isSaving }
disabled={ !user.valid(isEnterprise) || isSaving }
loading={ isSaving }
primary
marginRight

View file

@ -95,8 +95,8 @@ export default class User implements IUser {
}
}
valid() {
return validateName(this.name, { empty: false }) && validateEmail(this.email) && !!this.roleId;
valid(isEnterprise: boolean = false) {
return validateName(this.name, { empty: false }) && validateEmail(this.email) && (isEnterprise ? !!this.roleId : true);
}
exists() {