|
|
@@ -4,12 +4,10 @@ import React, {
|
|
|
import { useTranslation } from 'react-i18next';
|
|
|
|
|
|
import UserGroupForm from '../UserGroup/UserGroupForm';
|
|
|
-import UserGroupTable from '../UserGroup/UserGroupTable';
|
|
|
import UserGroupDropdown from '../UserGroup/UserGroupDropdown';
|
|
|
import UserGroupUserTable from './UserGroupUserTable';
|
|
|
import UserGroupUserModal from './UserGroupUserModal';
|
|
|
import UserGroupPageList from './UserGroupPageList';
|
|
|
-
|
|
|
import { withUnstatedContainers } from '../../UnstatedUtils';
|
|
|
import AppContainer from '~/client/services/AppContainer';
|
|
|
import {
|
|
|
@@ -20,15 +18,10 @@ import { IPageHasId } from '~/interfaces/page';
|
|
|
import {
|
|
|
IUserGroup, IUserGroupHasId, IUserGroupRelation,
|
|
|
} from '~/interfaces/user';
|
|
|
-import {
|
|
|
- useSWRxUserGroupPages, useSWRxUserGroupRelations, useSWRxChildUserGroupList, useSWRxSelectableUserGroups,
|
|
|
-} from '~/stores/user-group';
|
|
|
+import { useSWRxUserGroupPages, useSWRxUserGroupRelations, useSWRxSelectableUserGroups } from '~/stores/user-group';
|
|
|
|
|
|
-type Props = {
|
|
|
- appContainer: AppContainer,
|
|
|
-};
|
|
|
|
|
|
-const UserGroupDetailPage: FC<Props> = (props: Props) => {
|
|
|
+const UserGroupDetailPage: FC = () => {
|
|
|
const rootElem = document.getElementById('admin-user-group-detail');
|
|
|
const { t } = useTranslation();
|
|
|
|
|
|
@@ -36,7 +29,11 @@ const UserGroupDetailPage: FC<Props> = (props: Props) => {
|
|
|
* State (from AdminUserGroupDetailContainer)
|
|
|
*/
|
|
|
const [userGroup, setUserGroup] = useState<IUserGroupHasId>(JSON.parse(rootElem?.getAttribute('data-user-group') || 'null'));
|
|
|
+
|
|
|
+ // TODO 85062: /_api/v3/user-groups/children?include_grand_child=boolean
|
|
|
+ const [childUserGroups, setChildUserGroups] = useState<IUserGroupHasId[]>([]); // TODO 85062: fetch data on init (findChildGroupsByParentIds) For child group list
|
|
|
const [grandChildUserGroups, setGrandChildUserGroups] = useState<IUserGroupHasId[]>([]); // TODO 85062: fetch data on init (findChildGroupsByParentIds) For child group list
|
|
|
+
|
|
|
const [childUserGroupRelations, setChildUserGroupRelations] = useState<IUserGroupRelation[]>([]); // TODO 85062: fetch data on init (findRelationsByGroupIds) For child group list
|
|
|
const [relatedPages, setRelatedPages] = useState<IPageHasId[]>([]); // For page list
|
|
|
const [isUserGroupUserModalOpen, setUserGroupUserModalOpen] = useState<boolean>(false);
|
|
|
@@ -49,7 +46,6 @@ const UserGroupDetailPage: FC<Props> = (props: Props) => {
|
|
|
*/
|
|
|
const { data: userGroupPages } = useSWRxUserGroupPages(userGroup._id, 10, 0);
|
|
|
const { data: userGroupRelations, mutate: mutateUserGroupRelations } = useSWRxUserGroupRelations(userGroup._id);
|
|
|
- const { data: childUserGroups, mutate: mutateChildUserGroups } = useSWRxChildUserGroupList([userGroup._id], false);
|
|
|
const { data: selectableUserGroups, mutate: mutateSelectableUserGroups } = useSWRxSelectableUserGroups(userGroup._id);
|
|
|
|
|
|
/*
|
|
|
@@ -116,10 +112,9 @@ const UserGroupDetailPage: FC<Props> = (props: Props) => {
|
|
|
name: selectedUserGroup.name,
|
|
|
description: selectedUserGroup.description,
|
|
|
parentId: userGroup._id,
|
|
|
- forceUpdateParents: true, // TODO 87748: Make forceUpdateParents optionally selectable
|
|
|
+ forceUpdateParents: false, // TODO 87748: Make forceUpdateParents optionally selectable
|
|
|
});
|
|
|
mutateSelectableUserGroups();
|
|
|
- mutateChildUserGroups();
|
|
|
toastSuccess(t('toaster.update_successed', { target: t('UserGroup') }));
|
|
|
}
|
|
|
catch (err) {
|
|
|
@@ -166,15 +161,6 @@ const UserGroupDetailPage: FC<Props> = (props: Props) => {
|
|
|
onClickCreateUserGroupButtonHandler={() => onClickCreateChildGroupButtonHandler()}
|
|
|
/>
|
|
|
|
|
|
- {/* <UserGroupTable
|
|
|
- appContainer={props.appContainer}
|
|
|
- userGroups={userGroups}
|
|
|
- childUserGroups={childUserGroups}
|
|
|
- isAclEnabled={isAclEnabled}
|
|
|
- onDelete={showDeleteModal}
|
|
|
- userGroupRelations={userGroupRelations}
|
|
|
- /> */}
|
|
|
-
|
|
|
<h2 className="admin-setting-header mt-4">{t('Page')}</h2>
|
|
|
<div className="page-list">
|
|
|
<UserGroupPageList />
|