mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
fixed permission edit ui
This commit is contained in:
parent
a8a7fb3886
commit
ef56a417b2
@ -62,7 +62,7 @@ function CreateDialog(props: {
|
||||
<>
|
||||
<InputField control={form.control} label="ID" name="id" />
|
||||
<InputField control={form.control} label="Description" name="description" />
|
||||
{permissions && <PermissionListField control={form.control} name="containPermissionIds" permissions={permissions} type="new" />}
|
||||
<PermissionListField control={form.control} name="containPermissionIds" permissions={permissions} type="new" />
|
||||
</>
|
||||
)}
|
||||
onSubmit={async (values) => {
|
||||
|
||||
@ -50,13 +50,13 @@ function EditDialog(props: {
|
||||
<>
|
||||
<InputField control={form.control} label="ID" name="id" />
|
||||
<InputField control={form.control} label="Description" name="description" />
|
||||
{permissions && <PermissionListField
|
||||
<PermissionListField
|
||||
control={form.control}
|
||||
name="containPermissionIds"
|
||||
permissions={permissions}
|
||||
type="edit"
|
||||
selectedPermissionId={props.selectedPermissionId}
|
||||
/>}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
onSubmit={async (values) => {
|
||||
|
||||
@ -158,7 +158,9 @@ export function PermissionListField<F extends FieldValues>(props: {
|
||||
// @ts-ignore
|
||||
}, [props.permissions, props.selectedPermissionId, props.type, props.user, props.team]);
|
||||
|
||||
if (!graph) return null;
|
||||
if (!graph || Object.values(graph.permissions).length <= 1) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const currentPermission = graph.permissions[PLACEHOLDER_ID];
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user