|
@@ -21,9 +21,12 @@ import {
|
|
|
useSWRxUserGroupPages, useSWRxUserGroupRelationList, useSWRxChildUserGroupList, useSWRxUserGroup,
|
|
useSWRxUserGroupPages, useSWRxUserGroupRelationList, useSWRxChildUserGroupList, useSWRxUserGroup,
|
|
|
useSWRxSelectableParentUserGroups, useSWRxSelectableChildUserGroups, useSWRxAncestorUserGroups, useSWRxUserGroupRelations,
|
|
useSWRxSelectableParentUserGroups, useSWRxSelectableChildUserGroups, useSWRxAncestorUserGroups, useSWRxUserGroupRelations,
|
|
|
} from '~/stores/user-group';
|
|
} from '~/stores/user-group';
|
|
|
|
|
+import loggerFactory from '~/utils/logger';
|
|
|
|
|
|
|
|
import styles from './UserGroupDetailPage.module.scss';
|
|
import styles from './UserGroupDetailPage.module.scss';
|
|
|
|
|
|
|
|
|
|
+const logger = loggerFactory('growi:services:AdminCustomizeContainer');
|
|
|
|
|
+
|
|
|
const UserGroupPageList = dynamic(() => import('./UserGroupPageList'), { ssr: false });
|
|
const UserGroupPageList = dynamic(() => import('./UserGroupPageList'), { ssr: false });
|
|
|
const UserGroupUserTable = dynamic(() => import('./UserGroupUserTable'), { ssr: false });
|
|
const UserGroupUserTable = dynamic(() => import('./UserGroupUserTable'), { ssr: false });
|
|
|
|
|
|
|
@@ -48,6 +51,7 @@ const UserGroupDetailPage = (props: Props): JSX.Element => {
|
|
|
const { userGroupId: currentUserGroupId } = props;
|
|
const { userGroupId: currentUserGroupId } = props;
|
|
|
|
|
|
|
|
const { data: currentUserGroup } = useSWRxUserGroup(currentUserGroupId);
|
|
const { data: currentUserGroup } = useSWRxUserGroup(currentUserGroupId);
|
|
|
|
|
+
|
|
|
const [searchType, setSearchType] = useState<SearchType>(SearchTypes.PARTIAL);
|
|
const [searchType, setSearchType] = useState<SearchType>(SearchTypes.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);
|
|
@@ -91,6 +95,7 @@ const UserGroupDetailPage = (props: Props): JSX.Element => {
|
|
|
|
|
|
|
|
const { open: openUpdateParentConfirmModal } = useUpdateUserGroupConfirmModal();
|
|
const { open: openUpdateParentConfirmModal } = useUpdateUserGroupConfirmModal();
|
|
|
|
|
|
|
|
|
|
+ const parentUserGroup = selectableParentUserGroups?.find(selectableParentUserGroup => selectableParentUserGroup._id === currentUserGroup?.parent);
|
|
|
/*
|
|
/*
|
|
|
* Function
|
|
* Function
|
|
|
*/
|
|
*/
|
|
@@ -135,9 +140,10 @@ const UserGroupDetailPage = (props: Props): JSX.Element => {
|
|
|
[t, updateUserGroup],
|
|
[t, updateUserGroup],
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- const onClickSubmitForm = useCallback(async(targetGroup: IUserGroupHasId, userGroupData: Partial<IUserGroupHasId>): Promise<void> => {
|
|
|
|
|
- if (typeof userGroupData?.parent === 'string') {
|
|
|
|
|
|
|
+ const onClickSubmitForm = useCallback(async(targetGroup: IUserGroupHasId, userGroupData: IUserGroupHasId) => {
|
|
|
|
|
+ if (typeof userGroupData.parent === 'string') {
|
|
|
toastError(t('Something went wrong. Please try again.'));
|
|
toastError(t('Something went wrong. Please try again.'));
|
|
|
|
|
+ logger.error('Something went wrong.');
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -356,6 +362,7 @@ const UserGroupDetailPage = (props: Props): JSX.Element => {
|
|
|
<div className="mt-4 form-box">
|
|
<div className="mt-4 form-box">
|
|
|
<UserGroupForm
|
|
<UserGroupForm
|
|
|
userGroup={currentUserGroup}
|
|
userGroup={currentUserGroup}
|
|
|
|
|
+ parentUserGroup={parentUserGroup}
|
|
|
selectableParentUserGroups={selectableParentUserGroups}
|
|
selectableParentUserGroups={selectableParentUserGroups}
|
|
|
submitButtonLabel={t('Update')}
|
|
submitButtonLabel={t('Update')}
|
|
|
onSubmit={onClickSubmitForm}
|
|
onSubmit={onClickSubmitForm}
|