remove add users button (#2235)

fixes: #1808
This commit is contained in:
Erik Jan de Wit 2022-03-16 10:09:27 +01:00 committed by GitHub
parent 6b993ea93a
commit ba4765fdc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,6 +1,5 @@
import React, { useState } from "react"; import React, { useState } from "react";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import { useHistory } from "react-router-dom";
import { import {
AlertVariant, AlertVariant,
Button, Button,
@ -10,12 +9,10 @@ import {
import type UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userRepresentation"; import type UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userRepresentation";
import { useAdminClient } from "../context/auth/AdminClient"; import { useAdminClient } from "../context/auth/AdminClient";
import { useRealm } from "../context/realm-context/RealmContext";
import { useAlerts } from "../components/alert/Alerts"; import { useAlerts } from "../components/alert/Alerts";
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState"; import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
import { emptyFormatter } from "../util"; import { emptyFormatter } from "../util";
import { toAddUser } from "../user/routes/AddUser";
import { differenceBy } from "lodash-es"; import { differenceBy } from "lodash-es";
type MemberModalProps = { type MemberModalProps = {
@ -29,10 +26,6 @@ export const MemberModal = ({ groupId, onClose }: MemberModalProps) => {
const { addAlert, addError } = useAlerts(); const { addAlert, addError } = useAlerts();
const [selectedRows, setSelectedRows] = useState<UserRepresentation[]>([]); const [selectedRows, setSelectedRows] = useState<UserRepresentation[]>([]);
const history = useHistory();
const { realm } = useRealm();
const goToCreate = () => history.push(toAddUser({ realm }));
const loader = async (first?: number, max?: number, search?: string) => { const loader = async (first?: number, max?: number, search?: string) => {
const members = await adminClient.groups.listMembers({ id: groupId }); const members = await adminClient.groups.listMembers({ id: groupId });
const params: { [name: string]: string | number } = { const params: { [name: string]: string | number } = {
@ -101,8 +94,6 @@ export const MemberModal = ({ groupId, onClose }: MemberModalProps) => {
<ListEmptyState <ListEmptyState
message={t("users:noUsersFound")} message={t("users:noUsersFound")}
instructions={t("users:emptyInstructions")} instructions={t("users:emptyInstructions")}
primaryActionText={t("users:createNewUser")}
onPrimaryAction={goToCreate}
/> />
} }
columns={[ columns={[