Merge branch 'fix/roles-management' into 'main'
Fixed role management while changing own role and removed No access from dashboard dropdown role Closes #55 and #56 See merge request stackspin/dashboard!33
This commit is contained in:
commit
e202197b9a
1 changed files with 33 additions and 34 deletions
|
@ -122,7 +122,8 @@ export const UserModal = ({ open, onClose, userId, setUserId }: UserModalProps)
|
||||||
<div className="sm:col-span-3">
|
<div className="sm:col-span-3">
|
||||||
<Input control={control} name="email" label="Email" type="email" onKeyPress={handleKeyPress} />
|
<Input control={control} name="email" label="Email" type="email" onKeyPress={handleKeyPress} />
|
||||||
</div>
|
</div>
|
||||||
|
{isAdmin && (
|
||||||
|
<>
|
||||||
<div className="sm:col-span-3">
|
<div className="sm:col-span-3">
|
||||||
{fields
|
{fields
|
||||||
.filter((field) => field.name === 'dashboard')
|
.filter((field) => field.name === 'dashboard')
|
||||||
|
@ -133,15 +134,12 @@ export const UserModal = ({ open, onClose, userId, setUserId }: UserModalProps)
|
||||||
name={`app_roles.${index}.role`}
|
name={`app_roles.${index}.role`}
|
||||||
label="Role"
|
label="Role"
|
||||||
options={[
|
options={[
|
||||||
{ value: UserRole.NoAccess, name: 'No access' },
|
|
||||||
{ value: UserRole.User, name: 'User' },
|
{ value: UserRole.User, name: 'User' },
|
||||||
{ value: UserRole.Admin, name: 'Admin' },
|
{ value: UserRole.Admin, name: 'Admin' },
|
||||||
]}
|
]}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{isAdmin && (
|
|
||||||
<div className="sm:col-span-3 opacity-40 cursor-default pointer-events-none select-none">
|
<div className="sm:col-span-3 opacity-40 cursor-default pointer-events-none select-none">
|
||||||
<label htmlFor="status" className="block text-sm font-medium text-gray-700">
|
<label htmlFor="status" className="block text-sm font-medium text-gray-700">
|
||||||
Status
|
Status
|
||||||
|
@ -158,6 +156,7 @@ export const UserModal = ({ open, onClose, userId, setUserId }: UserModalProps)
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue