Skip to content

Commit c7132ce

Browse files
committed
feat(FR-826): allow role setting when creating a new user (#3491)
Resolves #3490 ([FR-826](https://lablup.atlassian.net/browse/FR-826)) # Refactor form handling in FolderCreateModal and fix UserSettingModal role check This PR makes two improvements: 1. In `FolderCreateModal.tsx`, simplifies the mutation function by using the spread operator to pass form values instead of explicitly listing each field. 2. In `UserSettingModal.tsx`, fixes a potential bug by removing an unnecessary check for `user?.role` when determining whether to display the role selection dropdown. The condition now only depends on `currentUserRole` being defined and having appropriate permissions. **Checklist:** - [ ] Documentation - [ ] Minium required manager version - [ ] Specific setting for review (eg., KB link, endpoint or how to setup) - [ ] Minimum requirements to check during review - [ ] Test case(s) to demonstrate the difference of before/after [FR-826]: https://lablup.atlassian.net/browse/FR-826?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
1 parent f9fe4e4 commit c7132ce

2 files changed

Lines changed: 2 additions & 7 deletions

File tree

react/src/components/FolderCreateModal.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,7 @@ const FolderCreateModal: React.FC<FolderCreateModalProps> = ({
115115
>({
116116
mutationFn: (values) => {
117117
const body = {
118-
name: values.name,
119-
host: values.host,
120-
group: values.group,
121-
usage_mode: values.usage_mode,
122-
permission: values.permission,
118+
...values,
123119
cloneable: values.cloneable ?? false,
124120
};
125121
return baiRequestWithPromise({

react/src/components/UserSettingModal.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,7 @@ const UserSettingModal: React.FC<UserSettingModalProps> = ({
427427
})}
428428
/>
429429
</Form.Item>
430-
{!!user?.role &&
431-
!!currentUserRole &&
430+
{!!currentUserRole &&
432431
currentUserRole in permissionRangeOfRoleChanges && (
433432
<Form.Item name="role" label={t('credential.Role')}>
434433
<Select

0 commit comments

Comments
 (0)