|
@@ -5,8 +5,9 @@ import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
|
|
import UserGroupForm from '../UserGroup/UserGroupForm';
|
|
import UserGroupForm from '../UserGroup/UserGroupForm';
|
|
|
import UserGroupTable from '../UserGroup/UserGroupTable';
|
|
import UserGroupTable from '../UserGroup/UserGroupTable';
|
|
|
-import UserGroupCreateModal from '../UserGroup/UserGroupCreateModal';
|
|
|
|
|
|
|
+import UserGroupModal from '../UserGroup/UserGroupModal';
|
|
|
import UserGroupDeleteModal from '../UserGroup/UserGroupDeleteModal';
|
|
import UserGroupDeleteModal from '../UserGroup/UserGroupDeleteModal';
|
|
|
|
|
+import UpdateParentConfirmModal from './UpdateParentConfirmModal';
|
|
|
import UserGroupDropdown from '../UserGroup/UserGroupDropdown';
|
|
import UserGroupDropdown from '../UserGroup/UserGroupDropdown';
|
|
|
import UserGroupUserTable from './UserGroupUserTable';
|
|
import UserGroupUserTable from './UserGroupUserTable';
|
|
|
import UserGroupUserModal from './UserGroupUserModal';
|
|
import UserGroupUserModal from './UserGroupUserModal';
|
|
@@ -21,9 +22,11 @@ import {
|
|
|
IUserGroup, IUserGroupHasId,
|
|
IUserGroup, IUserGroupHasId,
|
|
|
} from '~/interfaces/user';
|
|
} from '~/interfaces/user';
|
|
|
import {
|
|
import {
|
|
|
- useSWRxUserGroupPages, useSWRxUserGroupRelationList, useSWRxChildUserGroupList, useSWRxSelectableUserGroups, useSWRxAncestorUserGroups,
|
|
|
|
|
|
|
+ useSWRxUserGroupPages, useSWRxUserGroupRelationList, useSWRxChildUserGroupList,
|
|
|
|
|
+ useSWRxSelectableParentUserGroups, useSWRxSelectableChildUserGroups, useSWRxAncestorUserGroups,
|
|
|
} from '~/stores/user-group';
|
|
} from '~/stores/user-group';
|
|
|
import { useIsAclEnabled } from '~/stores/context';
|
|
import { useIsAclEnabled } from '~/stores/context';
|
|
|
|
|
+import { useUpdateUserGroupConfirmModal } from '~/stores/modal';
|
|
|
|
|
|
|
|
const UserGroupDetailPage: FC = () => {
|
|
const UserGroupDetailPage: FC = () => {
|
|
|
const { t } = useTranslation();
|
|
const { t } = useTranslation();
|
|
@@ -32,21 +35,22 @@ const UserGroupDetailPage: FC = () => {
|
|
|
/*
|
|
/*
|
|
|
* State (from AdminUserGroupDetailContainer)
|
|
* State (from AdminUserGroupDetailContainer)
|
|
|
*/
|
|
*/
|
|
|
- const [userGroup, setUserGroup] = useState<IUserGroupHasId>(JSON.parse(adminUserGroupDetailElem?.getAttribute('data-user-group') || 'null'));
|
|
|
|
|
|
|
+ const [currentUserGroup, setUserGroup] = useState<IUserGroupHasId>(JSON.parse(adminUserGroupDetailElem?.getAttribute('data-user-group') || 'null'));
|
|
|
const [relatedPages, setRelatedPages] = useState<IPageHasId[]>([]); // For page list
|
|
const [relatedPages, setRelatedPages] = useState<IPageHasId[]>([]); // For page list
|
|
|
const [searchType, setSearchType] = useState<string>('partial');
|
|
const [searchType, setSearchType] = useState<string>('partial');
|
|
|
const [isAlsoMailSearched, setAlsoMailSearched] = useState<boolean>(false);
|
|
const [isAlsoMailSearched, setAlsoMailSearched] = useState<boolean>(false);
|
|
|
const [isAlsoNameSearched, setAlsoNameSearched] = useState<boolean>(false);
|
|
const [isAlsoNameSearched, setAlsoNameSearched] = useState<boolean>(false);
|
|
|
const [selectedUserGroup, setSelectedUserGroup] = useState<IUserGroupHasId | undefined>(undefined); // not null but undefined (to use defaultProps in UserGroupDeleteModal)
|
|
const [selectedUserGroup, setSelectedUserGroup] = useState<IUserGroupHasId | undefined>(undefined); // not null but undefined (to use defaultProps in UserGroupDeleteModal)
|
|
|
const [isCreateModalShown, setCreateModalShown] = useState<boolean>(false);
|
|
const [isCreateModalShown, setCreateModalShown] = useState<boolean>(false);
|
|
|
|
|
+ const [isUpdateModalShown, setUpdateModalShown] = useState<boolean>(false);
|
|
|
const [isDeleteModalShown, setDeleteModalShown] = useState<boolean>(false);
|
|
const [isDeleteModalShown, setDeleteModalShown] = useState<boolean>(false);
|
|
|
|
|
|
|
|
/*
|
|
/*
|
|
|
* Fetch
|
|
* Fetch
|
|
|
*/
|
|
*/
|
|
|
- const { data: userGroupPages } = useSWRxUserGroupPages(userGroup._id, 10, 0);
|
|
|
|
|
|
|
+ const { data: userGroupPages } = useSWRxUserGroupPages(currentUserGroup._id, 10, 0);
|
|
|
|
|
|
|
|
- const { data: childUserGroupsList, mutate: mutateChildUserGroups } = useSWRxChildUserGroupList([userGroup._id], true);
|
|
|
|
|
|
|
+ const { data: childUserGroupsList, mutate: mutateChildUserGroups } = useSWRxChildUserGroupList([currentUserGroup._id], true);
|
|
|
const childUserGroups = childUserGroupsList != null ? childUserGroupsList.childUserGroups : [];
|
|
const childUserGroups = childUserGroupsList != null ? childUserGroupsList.childUserGroups : [];
|
|
|
const grandChildUserGroups = childUserGroupsList != null ? childUserGroupsList.grandChildUserGroups : [];
|
|
const grandChildUserGroups = childUserGroupsList != null ? childUserGroupsList.grandChildUserGroups : [];
|
|
|
const childUserGroupIds = childUserGroups.map(group => group._id);
|
|
const childUserGroupIds = childUserGroups.map(group => group._id);
|
|
@@ -54,12 +58,15 @@ const UserGroupDetailPage: FC = () => {
|
|
|
const { data: userGroupRelationList, mutate: mutateUserGroupRelations } = useSWRxUserGroupRelationList(childUserGroupIds);
|
|
const { data: userGroupRelationList, mutate: mutateUserGroupRelations } = useSWRxUserGroupRelationList(childUserGroupIds);
|
|
|
const childUserGroupRelations = userGroupRelationList != null ? userGroupRelationList : [];
|
|
const childUserGroupRelations = userGroupRelationList != null ? userGroupRelationList : [];
|
|
|
|
|
|
|
|
- const { data: selectableUserGroups, mutate: mutateSelectableUserGroups } = useSWRxSelectableUserGroups(userGroup._id);
|
|
|
|
|
|
|
+ const { data: selectableParentUserGroups, mutate: mutateSelectableParentUserGroups } = useSWRxSelectableParentUserGroups(currentUserGroup._id);
|
|
|
|
|
+ const { data: selectableChildUserGroups, mutate: mutateSelectableChildUserGroups } = useSWRxSelectableChildUserGroups(currentUserGroup._id);
|
|
|
|
|
|
|
|
- const { data: ancestorUserGroups } = useSWRxAncestorUserGroups(userGroup._id);
|
|
|
|
|
|
|
+ const { data: ancestorUserGroups, mutate: mutateAncestorUserGroups } = useSWRxAncestorUserGroups(currentUserGroup._id);
|
|
|
|
|
|
|
|
const { data: isAclEnabled } = useIsAclEnabled();
|
|
const { data: isAclEnabled } = useIsAclEnabled();
|
|
|
|
|
|
|
|
|
|
+ const { open: openUpdateParentConfirmModal } = useUpdateUserGroupConfirmModal();
|
|
|
|
|
+
|
|
|
/*
|
|
/*
|
|
|
* Function
|
|
* Function
|
|
|
*/
|
|
*/
|
|
@@ -77,20 +84,66 @@ const UserGroupDetailPage: FC = () => {
|
|
|
setSearchType(searchType);
|
|
setSearchType(searchType);
|
|
|
}, []);
|
|
}, []);
|
|
|
|
|
|
|
|
- const updateUserGroup = useCallback(async(param: Partial<IUserGroup>) => {
|
|
|
|
|
- try {
|
|
|
|
|
- const res = await apiv3Put<{ userGroup: IUserGroupHasId }>(`/user-groups/${userGroup._id}`, param);
|
|
|
|
|
- const { userGroup: newUserGroup } = res.data;
|
|
|
|
|
- setUserGroup(newUserGroup);
|
|
|
|
|
- toastSuccess(t('toaster.update_successed', { target: t('UserGroup') }));
|
|
|
|
|
|
|
+ const updateUserGroup = useCallback(async(userGroup: IUserGroupHasId, update: Partial<IUserGroupHasId>, forceUpdateParents: boolean) => {
|
|
|
|
|
+ if (update.parent == null) {
|
|
|
|
|
+ throw Error('"parent" attr must not be null');
|
|
|
}
|
|
}
|
|
|
- catch (err) {
|
|
|
|
|
- toastError(err);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const parentId = typeof update.parent === 'string' ? update.parent : update.parent?._id;
|
|
|
|
|
+ const res = await apiv3Put<{ userGroup: IUserGroupHasId }>(`/user-groups/${userGroup._id}`, {
|
|
|
|
|
+ name: update.name,
|
|
|
|
|
+ description: update.description,
|
|
|
|
|
+ parentId,
|
|
|
|
|
+ forceUpdateParents,
|
|
|
|
|
+ });
|
|
|
|
|
+ const { userGroup: updatedUserGroup } = res.data;
|
|
|
|
|
+
|
|
|
|
|
+ setUserGroup(updatedUserGroup);
|
|
|
|
|
+
|
|
|
|
|
+ // mutate
|
|
|
|
|
+ mutateAncestorUserGroups();
|
|
|
|
|
+ mutateSelectableChildUserGroups();
|
|
|
|
|
+ mutateSelectableParentUserGroups();
|
|
|
|
|
+ }, [setUserGroup, mutateAncestorUserGroups, mutateSelectableChildUserGroups, mutateSelectableParentUserGroups]);
|
|
|
|
|
+
|
|
|
|
|
+ const onSubmitUpdateGroup = useCallback(
|
|
|
|
|
+ async(targetGroup: IUserGroupHasId, userGroupData: Partial<IUserGroupHasId>, forceUpdateParents: boolean): Promise<void> => {
|
|
|
|
|
+ try {
|
|
|
|
|
+ await updateUserGroup(targetGroup, userGroupData, forceUpdateParents);
|
|
|
|
|
+ toastSuccess(t('toaster.update_successed', { target: t('UserGroup') }));
|
|
|
|
|
+ }
|
|
|
|
|
+ catch {
|
|
|
|
|
+ toastError(t('toaster.update_failed', { target: t('UserGroup') }));
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ [t, updateUserGroup],
|
|
|
|
|
+ );
|
|
|
|
|
+
|
|
|
|
|
+ const onClickSubmitForm = useCallback(async(targetGroup: IUserGroupHasId, userGroupData: Partial<IUserGroupHasId>): Promise<void> => {
|
|
|
|
|
+ if (userGroupData?.parent === undefined || typeof userGroupData?.parent === 'string') {
|
|
|
|
|
+ toastError(t('Something went wrong. Please try again.'));
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
- }, [t, userGroup._id, setUserGroup]);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ const prevParentId = typeof targetGroup.parent === 'string' ? targetGroup.parent : (targetGroup.parent?._id || null);
|
|
|
|
|
+ const newParentId = typeof userGroupData.parent?._id === 'string' ? userGroupData.parent?._id : null;
|
|
|
|
|
+
|
|
|
|
|
+ const shouldShowConfirmModal = prevParentId !== newParentId;
|
|
|
|
|
+
|
|
|
|
|
+ if (shouldShowConfirmModal) { // show confirm modal before submiting
|
|
|
|
|
+ await openUpdateParentConfirmModal(
|
|
|
|
|
+ targetGroup,
|
|
|
|
|
+ userGroupData,
|
|
|
|
|
+ onSubmitUpdateGroup,
|
|
|
|
|
+ );
|
|
|
|
|
+ }
|
|
|
|
|
+ else { // directly submit
|
|
|
|
|
+ await onSubmitUpdateGroup(targetGroup, userGroupData, false);
|
|
|
|
|
+ }
|
|
|
|
|
+ }, [t, openUpdateParentConfirmModal, onSubmitUpdateGroup]);
|
|
|
|
|
|
|
|
const fetchApplicableUsers = useCallback(async(searchWord) => {
|
|
const fetchApplicableUsers = useCallback(async(searchWord) => {
|
|
|
- const res = await apiv3Get(`/user-groups/${userGroup._id}/unrelated-users`, {
|
|
|
|
|
|
|
+ const res = await apiv3Get(`/user-groups/${currentUserGroup._id}/unrelated-users`, {
|
|
|
searchWord,
|
|
searchWord,
|
|
|
searchType,
|
|
searchType,
|
|
|
isAlsoMailSearched,
|
|
isAlsoMailSearched,
|
|
@@ -104,31 +157,55 @@ const UserGroupDetailPage: FC = () => {
|
|
|
|
|
|
|
|
// TODO 85062: will be used in UserGroupUserFormByInput
|
|
// TODO 85062: will be used in UserGroupUserFormByInput
|
|
|
const addUserByUsername = useCallback(async(username: string) => {
|
|
const addUserByUsername = useCallback(async(username: string) => {
|
|
|
- await apiv3Post(`/user-groups/${userGroup._id}/users/${username}`);
|
|
|
|
|
|
|
+ await apiv3Post(`/user-groups/${currentUserGroup._id}/users/${username}`);
|
|
|
mutateUserGroupRelations();
|
|
mutateUserGroupRelations();
|
|
|
- }, [userGroup, mutateUserGroupRelations]);
|
|
|
|
|
|
|
+ }, [currentUserGroup, mutateUserGroupRelations]);
|
|
|
|
|
|
|
|
const removeUserByUsername = useCallback(async(username: string) => {
|
|
const removeUserByUsername = useCallback(async(username: string) => {
|
|
|
- await apiv3Delete(`/user-groups/${userGroup._id}/users/${username}`);
|
|
|
|
|
|
|
+ await apiv3Delete(`/user-groups/${currentUserGroup._id}/users/${username}`);
|
|
|
mutateUserGroupRelations();
|
|
mutateUserGroupRelations();
|
|
|
- }, [userGroup, mutateUserGroupRelations]);
|
|
|
|
|
|
|
+ }, [currentUserGroup, mutateUserGroupRelations]);
|
|
|
|
|
+
|
|
|
|
|
+ const showUpdateModal = useCallback((group: IUserGroupHasId) => {
|
|
|
|
|
+ setUpdateModalShown(true);
|
|
|
|
|
+ setSelectedUserGroup(group);
|
|
|
|
|
+ }, [setUpdateModalShown]);
|
|
|
|
|
+
|
|
|
|
|
+ const hideUpdateModal = useCallback(() => {
|
|
|
|
|
+ setUpdateModalShown(false);
|
|
|
|
|
+ setSelectedUserGroup(undefined);
|
|
|
|
|
+ }, [setUpdateModalShown]);
|
|
|
|
|
|
|
|
- const onClickAddChildButtonHandler = async(selectedUserGroup: IUserGroupHasId) => {
|
|
|
|
|
|
|
+ const updateChildUserGroup = useCallback(async(userGroupData: IUserGroupHasId) => {
|
|
|
try {
|
|
try {
|
|
|
- await apiv3Put(`/user-groups/${selectedUserGroup._id}`, {
|
|
|
|
|
- name: selectedUserGroup.name,
|
|
|
|
|
- description: selectedUserGroup.description,
|
|
|
|
|
- parentId: userGroup._id,
|
|
|
|
|
- forceUpdateParents: false,
|
|
|
|
|
|
|
+ await apiv3Put(`/user-groups/${userGroupData._id}`, {
|
|
|
|
|
+ name: userGroupData.name,
|
|
|
|
|
+ description: userGroupData.description,
|
|
|
|
|
+ parentId: userGroupData.parent,
|
|
|
});
|
|
});
|
|
|
- mutateSelectableUserGroups();
|
|
|
|
|
- mutateChildUserGroups();
|
|
|
|
|
|
|
+
|
|
|
toastSuccess(t('toaster.update_successed', { target: t('UserGroup') }));
|
|
toastSuccess(t('toaster.update_successed', { target: t('UserGroup') }));
|
|
|
|
|
+
|
|
|
|
|
+ // mutate
|
|
|
|
|
+ mutateChildUserGroups();
|
|
|
|
|
+
|
|
|
|
|
+ hideUpdateModal();
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
toastError(err);
|
|
toastError(err);
|
|
|
}
|
|
}
|
|
|
- };
|
|
|
|
|
|
|
+ }, [t, mutateChildUserGroups, hideUpdateModal]);
|
|
|
|
|
+
|
|
|
|
|
+ const onClickAddExistingUserGroupButtonHandler = useCallback(async(selectedChild: IUserGroupHasId): Promise<void> => {
|
|
|
|
|
+ // show confirm modal before submiting
|
|
|
|
|
+ await openUpdateParentConfirmModal(
|
|
|
|
|
+ selectedChild,
|
|
|
|
|
+ {
|
|
|
|
|
+ parent: currentUserGroup._id,
|
|
|
|
|
+ },
|
|
|
|
|
+ onSubmitUpdateGroup,
|
|
|
|
|
+ );
|
|
|
|
|
+ }, [openUpdateParentConfirmModal, onSubmitUpdateGroup, currentUserGroup]);
|
|
|
|
|
|
|
|
const showCreateModal = useCallback(() => {
|
|
const showCreateModal = useCallback(() => {
|
|
|
setCreateModalShown(true);
|
|
setCreateModalShown(true);
|
|
@@ -143,15 +220,22 @@ const UserGroupDetailPage: FC = () => {
|
|
|
await apiv3Post('/user-groups', {
|
|
await apiv3Post('/user-groups', {
|
|
|
name: userGroupData.name,
|
|
name: userGroupData.name,
|
|
|
description: userGroupData.description,
|
|
description: userGroupData.description,
|
|
|
- parentId: userGroup._id,
|
|
|
|
|
|
|
+ parentId: currentUserGroup._id,
|
|
|
});
|
|
});
|
|
|
- mutateChildUserGroups();
|
|
|
|
|
|
|
+
|
|
|
toastSuccess(t('toaster.update_successed', { target: t('UserGroup') }));
|
|
toastSuccess(t('toaster.update_successed', { target: t('UserGroup') }));
|
|
|
|
|
+
|
|
|
|
|
+ // mutate
|
|
|
|
|
+ mutateChildUserGroups();
|
|
|
|
|
+ mutateSelectableChildUserGroups();
|
|
|
|
|
+ mutateSelectableParentUserGroups();
|
|
|
|
|
+
|
|
|
|
|
+ hideCreateModal();
|
|
|
}
|
|
}
|
|
|
catch (err) {
|
|
catch (err) {
|
|
|
toastError(err);
|
|
toastError(err);
|
|
|
}
|
|
}
|
|
|
- }, [t, userGroup, mutateChildUserGroups]);
|
|
|
|
|
|
|
+ }, [t, currentUserGroup, mutateChildUserGroups, mutateSelectableChildUserGroups, mutateSelectableParentUserGroups, hideCreateModal]);
|
|
|
|
|
|
|
|
const showDeleteModal = useCallback(async(group: IUserGroupHasId) => {
|
|
const showDeleteModal = useCallback(async(group: IUserGroupHasId) => {
|
|
|
setSelectedUserGroup(group);
|
|
setSelectedUserGroup(group);
|
|
@@ -186,48 +270,38 @@ const UserGroupDetailPage: FC = () => {
|
|
|
/*
|
|
/*
|
|
|
* Dependencies
|
|
* Dependencies
|
|
|
*/
|
|
*/
|
|
|
- if (userGroup == null) {
|
|
|
|
|
|
|
+ if (currentUserGroup == null) {
|
|
|
return <></>;
|
|
return <></>;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
return (
|
|
|
<div>
|
|
<div>
|
|
|
- <a href="/admin/user-groups" className="btn btn-outline-secondary">
|
|
|
|
|
- <i className="icon-fw ti-arrow-left" aria-hidden="true"></i>
|
|
|
|
|
- {t('admin:user_group_management.back_to_list')}
|
|
|
|
|
- </a>
|
|
|
|
|
-
|
|
|
|
|
- {
|
|
|
|
|
- userGroup?.parent != null && ancestorUserGroups != null && ancestorUserGroups.length > 0 && (
|
|
|
|
|
- <div className="btn-group ml-2">
|
|
|
|
|
- <a className="btn btn-outline-secondary" href={`/admin/user-group-detail/${userGroup.parent}`}>
|
|
|
|
|
- <i className="icon-fw ti-arrow-left" aria-hidden="true"></i>
|
|
|
|
|
- {t('admin:user_group_management.back_to_ancestors_group')}
|
|
|
|
|
- </a>
|
|
|
|
|
- <button
|
|
|
|
|
- type="button"
|
|
|
|
|
- className="btn btn-outline-secondary dropdown-toggle dropdown-toggle-split"
|
|
|
|
|
- data-toggle="dropdown"
|
|
|
|
|
- aria-haspopup="true"
|
|
|
|
|
- ria-expanded="false"
|
|
|
|
|
- >
|
|
|
|
|
- </button>
|
|
|
|
|
- <div className="dropdown-menu">
|
|
|
|
|
- {
|
|
|
|
|
- ancestorUserGroups.map(userGroup => (
|
|
|
|
|
- <a className="dropdown-item" key={userGroup._id} href={`/admin/user-group-detail/${userGroup._id}`}>{userGroup.name}</a>
|
|
|
|
|
- ))
|
|
|
|
|
- }
|
|
|
|
|
- </div>
|
|
|
|
|
- </div>
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ <nav aria-label="breadcrumb">
|
|
|
|
|
+ <ol className="breadcrumb">
|
|
|
|
|
+ <li className="breadcrumb-item"><a href="/admin/user-groups">{t('admin:user_group_management.group_list')}</a></li>
|
|
|
|
|
+ {
|
|
|
|
|
+ ancestorUserGroups != null && ancestorUserGroups.length > 0 && (
|
|
|
|
|
+ ancestorUserGroups.map((ancestorUserGroup: IUserGroupHasId) => (
|
|
|
|
|
+ // eslint-disable-next-line max-len
|
|
|
|
|
+ <li key={ancestorUserGroup._id} className={`breadcrumb-item ${ancestorUserGroup._id === currentUserGroup._id ? 'active' : ''}`} aria-current="page">
|
|
|
|
|
+ { ancestorUserGroup._id === currentUserGroup._id ? (
|
|
|
|
|
+ <>{ancestorUserGroup.name}</>
|
|
|
|
|
+ ) : (
|
|
|
|
|
+ <a href={`/admin/user-group-detail/${ancestorUserGroup._id}`}>{ancestorUserGroup.name}</a>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </li>
|
|
|
|
|
+ ))
|
|
|
|
|
+ )
|
|
|
|
|
+ }
|
|
|
|
|
+ </ol>
|
|
|
|
|
+ </nav>
|
|
|
|
|
|
|
|
<div className="mt-4 form-box">
|
|
<div className="mt-4 form-box">
|
|
|
<UserGroupForm
|
|
<UserGroupForm
|
|
|
- userGroup={userGroup}
|
|
|
|
|
|
|
+ userGroup={currentUserGroup}
|
|
|
|
|
+ selectableParentUserGroups={selectableParentUserGroups}
|
|
|
submitButtonLabel={t('Update')}
|
|
submitButtonLabel={t('Update')}
|
|
|
- onSubmit={updateUserGroup}
|
|
|
|
|
|
|
+ onSubmit={onClickSubmitForm}
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
<h2 className="admin-setting-header mt-4">{t('admin:user_group_management.user_list')}</h2>
|
|
<h2 className="admin-setting-header mt-4">{t('admin:user_group_management.user_list')}</h2>
|
|
@@ -236,29 +310,42 @@ const UserGroupDetailPage: FC = () => {
|
|
|
|
|
|
|
|
<h2 className="admin-setting-header mt-4">{t('admin:user_group_management.child_group_list')}</h2>
|
|
<h2 className="admin-setting-header mt-4">{t('admin:user_group_management.child_group_list')}</h2>
|
|
|
<UserGroupDropdown
|
|
<UserGroupDropdown
|
|
|
- selectableUserGroups={selectableUserGroups}
|
|
|
|
|
- onClickAddExistingUserGroupButtonHandler={onClickAddChildButtonHandler}
|
|
|
|
|
- onClickCreateUserGroupButtonHandler={showCreateModal}
|
|
|
|
|
|
|
+ selectableUserGroups={selectableChildUserGroups}
|
|
|
|
|
+ onClickAddExistingUserGroupButton={onClickAddExistingUserGroupButtonHandler}
|
|
|
|
|
+ onClickCreateUserGroupButton={showCreateModal}
|
|
|
/>
|
|
/>
|
|
|
- <UserGroupCreateModal
|
|
|
|
|
- onClickCreateButton={createChildUserGroup}
|
|
|
|
|
|
|
+
|
|
|
|
|
+ <UserGroupModal
|
|
|
|
|
+ userGroup={selectedUserGroup}
|
|
|
|
|
+ buttonLabel={t('Update')}
|
|
|
|
|
+ onClickSubmit={updateChildUserGroup}
|
|
|
|
|
+ isShow={isUpdateModalShown}
|
|
|
|
|
+ onHide={hideUpdateModal}
|
|
|
|
|
+ />
|
|
|
|
|
+
|
|
|
|
|
+ <UserGroupModal
|
|
|
|
|
+ buttonLabel={t('Create')}
|
|
|
|
|
+ onClickSubmit={createChildUserGroup}
|
|
|
isShow={isCreateModalShown}
|
|
isShow={isCreateModalShown}
|
|
|
onHide={hideCreateModal}
|
|
onHide={hideCreateModal}
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
|
|
+ <UpdateParentConfirmModal />
|
|
|
|
|
+
|
|
|
<UserGroupTable
|
|
<UserGroupTable
|
|
|
userGroups={childUserGroups}
|
|
userGroups={childUserGroups}
|
|
|
childUserGroups={grandChildUserGroups}
|
|
childUserGroups={grandChildUserGroups}
|
|
|
isAclEnabled={isAclEnabled ?? false}
|
|
isAclEnabled={isAclEnabled ?? false}
|
|
|
|
|
+ onEdit={showUpdateModal}
|
|
|
onDelete={showDeleteModal}
|
|
onDelete={showDeleteModal}
|
|
|
userGroupRelations={childUserGroupRelations}
|
|
userGroupRelations={childUserGroupRelations}
|
|
|
/>
|
|
/>
|
|
|
|
|
+
|
|
|
<UserGroupDeleteModal
|
|
<UserGroupDeleteModal
|
|
|
userGroups={childUserGroups}
|
|
userGroups={childUserGroups}
|
|
|
deleteUserGroup={selectedUserGroup}
|
|
deleteUserGroup={selectedUserGroup}
|
|
|
onDelete={deleteChildUserGroupById}
|
|
onDelete={deleteChildUserGroupById}
|
|
|
isShow={isDeleteModalShown}
|
|
isShow={isDeleteModalShown}
|
|
|
- onShow={showDeleteModal}
|
|
|
|
|
onHide={hideDeleteModal}
|
|
onHide={hideDeleteModal}
|
|
|
/>
|
|
/>
|
|
|
|
|
|