/* eslint-disable */ // @ts-nocheck import OrganizationRepresentation from "@keycloak/keycloak-admin-client/lib/defs/organizationRepresentation"; import UserRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userRepresentation"; import { KeycloakDataTable } from "../../shared/keycloak-ui-shared"; import { Button, Modal, ModalVariant } from "../../shared/@patternfly/react-core"; import { TableText } from "../../shared/@patternfly/react-table"; import { differenceBy } from "lodash-es"; import { useState } from "react"; import { useTranslation } from "react-i18next"; import { useAdminClient } from "../admin-client"; type OrganizationModalProps = { isJoin?: boolean; existingOrgs: OrganizationRepresentation[]; onAdd: (orgs: OrganizationRepresentation[]) => Promise; onClose: () => void; }; export const OrganizationModal = ({ isJoin = true, existingOrgs, onAdd, onClose, }: OrganizationModalProps) => { const { adminClient } = useAdminClient(); const { t } = useTranslation(); const [selectedRows, setSelectedRows] = useState([]); const loader = async (first?: number, max?: number, search?: string) => { const params = { first, search, max: max! + existingOrgs.length, }; const orgs = await adminClient.organizations.find(params); return differenceBy(orgs, existingOrgs, "id"); }; return ( { await onAdd(selectedRows); onClose(); }} > {isJoin ? t("join") : t("send")} , , ]} > setSelectedRows([...rows])} columns={[ { name: "name", displayKey: "organizationName", }, { name: "description", cellRenderer: (row) => ( {row.description} ), }, ]} /> ); };