Просмотр исходного кода

always show the Create Group button

Shun Miyazawa 4 лет назад
Родитель
Сommit
4406af61c3
1 измененных файлов с 24 добавлено и 21 удалено
  1. 24 21
      packages/app/src/components/Admin/UserGroup/UserGroupPage.tsx

+ 24 - 21
packages/app/src/components/Admin/UserGroup/UserGroupPage.tsx

@@ -104,10 +104,6 @@ const UserGroupPage: FC<Props> = (props: Props) => {
     }
   }, [mutateUserGroups, mutateUserGroupRelations]);
 
-  if (userGroups == null || userGroupRelations == null || childUserGroups == null) {
-    return <></>;
-  }
-
   return (
     <Fragment>
       {
@@ -129,23 +125,30 @@ const UserGroupPage: FC<Props> = (props: Props) => {
           t('admin:user_group_management.deny_create_group')
         )
       }
-      <UserGroupTable
-        appContainer={props.appContainer}
-        userGroups={userGroups}
-        childUserGroups={childUserGroups}
-        isAclEnabled={isAclEnabled}
-        onDelete={showDeleteModal}
-        userGroupRelations={userGroupRelations}
-      />
-      <UserGroupDeleteModal
-        appContainer={props.appContainer}
-        userGroups={userGroups}
-        deleteUserGroup={selectedUserGroup}
-        onDelete={deleteUserGroupById}
-        isShow={isDeleteModalShown}
-        onShow={showDeleteModal}
-        onHide={hideDeleteModal}
-      />
+
+      {
+        (userGroups != null && userGroupRelations != null && childUserGroups != null) && (
+          <>
+            <UserGroupTable
+              appContainer={props.appContainer}
+              userGroups={userGroups}
+              childUserGroups={childUserGroups}
+              isAclEnabled={isAclEnabled}
+              onDelete={showDeleteModal}
+              userGroupRelations={userGroupRelations}
+            />
+            <UserGroupDeleteModal
+              appContainer={props.appContainer}
+              userGroups={userGroups}
+              deleteUserGroup={selectedUserGroup}
+              onDelete={deleteUserGroupById}
+              isShow={isDeleteModalShown}
+              onShow={showDeleteModal}
+              onHide={hideDeleteModal}
+            />
+          </>
+        )
+      }
     </Fragment>
   );
 };