Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src/components/access/EditGroupDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,10 @@ export function EditGroupDialog({ group, canManage, onClose }: t.EditGroupDialog
value={name}
onChange={(e) => setName(e.target.value)}
placeholder={localize('com_access_group_name_placeholder')}
disabled={!canManage}
readOnly={!canManage}
autoFocus
className="rounded-lg border border-(--cui-color-stroke-default) bg-(--cui-color-background-default) px-3 py-2 text-sm text-(--cui-color-text-default) placeholder:text-(--cui-color-text-disabled)"
className="rounded-lg border border-(--cui-color-stroke-default) bg-(--cui-color-background-default) px-3 py-2 text-sm text-(--cui-color-text-default) placeholder:text-(--cui-color-text-disabled) disabled:cursor-not-allowed disabled:opacity-50"
/>
</div>
<div className="flex flex-col gap-1.5">
Expand All @@ -179,7 +181,9 @@ export function EditGroupDialog({ group, canManage, onClose }: t.EditGroupDialog
value={description}
onChange={(e) => setDescription(e.target.value)}
placeholder={localize('com_access_group_desc_placeholder')}
className="rounded-lg border border-(--cui-color-stroke-default) bg-(--cui-color-background-default) px-3 py-2 text-sm text-(--cui-color-text-default) placeholder:text-(--cui-color-text-disabled)"
disabled={!canManage}
readOnly={!canManage}
className="rounded-lg border border-(--cui-color-stroke-default) bg-(--cui-color-background-default) px-3 py-2 text-sm text-(--cui-color-text-default) placeholder:text-(--cui-color-text-disabled) disabled:cursor-not-allowed disabled:opacity-50"
/>
</div>
</div>
Expand Down Expand Up @@ -250,7 +254,7 @@ export function EditGroupDialog({ group, canManage, onClose }: t.EditGroupDialog
<Button
type="primary"
label={localize('com_ui_save')}
disabled={!name.trim() || (!detailsDirty && !membersDirty) || mutation.isPending}
disabled={!canManage || !name.trim() || (!detailsDirty && !membersDirty) || mutation.isPending}
/>
</div>
</form>
Expand Down
10 changes: 7 additions & 3 deletions src/components/access/EditRoleDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,8 @@ export function EditRoleDialog({ role, canManage, onClose }: t.EditRoleDialogPro
value={name}
onChange={(e) => setName(e.target.value)}
placeholder={localize('com_access_role_name_placeholder')}
disabled={role?.isSystemRole}
disabled={role?.isSystemRole || !canManage}
readOnly={!canManage}
autoFocus
className="rounded-lg border border-(--cui-color-stroke-default) bg-(--cui-color-background-default) px-3 py-2 text-sm text-(--cui-color-text-default) placeholder:text-(--cui-color-text-disabled) disabled:cursor-not-allowed disabled:opacity-50"
/>
Expand All @@ -231,7 +232,9 @@ export function EditRoleDialog({ role, canManage, onClose }: t.EditRoleDialogPro
value={description}
onChange={(e) => setDescription(e.target.value)}
placeholder={localize('com_access_role_desc_placeholder')}
className="rounded-lg border border-(--cui-color-stroke-default) bg-(--cui-color-background-default) px-3 py-2 text-sm text-(--cui-color-text-default) placeholder:text-(--cui-color-text-disabled)"
disabled={!canManage}
readOnly={!canManage}
className="rounded-lg border border-(--cui-color-stroke-default) bg-(--cui-color-background-default) px-3 py-2 text-sm text-(--cui-color-text-default) placeholder:text-(--cui-color-text-disabled) disabled:cursor-not-allowed disabled:opacity-50"
/>
</div>
</div>
Expand Down Expand Up @@ -260,7 +263,7 @@ export function EditRoleDialog({ role, canManage, onClose }: t.EditRoleDialogPro
<RolePermissionsPanel
permissions={permissions}
onChange={setPermissions}
disabled={updateMutation.isPending}
disabled={!canManage || updateMutation.isPending}
/>
);
})()}
Expand Down Expand Up @@ -333,6 +336,7 @@ export function EditRoleDialog({ role, canManage, onClose }: t.EditRoleDialogPro
type="primary"
label={localize('com_ui_save')}
disabled={
!canManage ||
!name.trim() ||
(permissionsDirty && permissions === null) ||
(!detailsDirty && !permissionsDirty && !membersDirty) ||
Expand Down