theme.keycloak.v2.admin.resources.assets.MembersModal-BMzek0-s.js.map Maven / Gradle / Ivy
{"version":3,"file":"MembersModal-BMzek0-s.js","sources":["../../src/groups/MembersModal.tsx"],"sourcesContent":["import type UserRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/userRepresentation\";\nimport { Button, Modal, ModalVariant } from \"@patternfly/react-core\";\nimport { differenceBy } from \"lodash-es\";\nimport { useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { useAdminClient } from \"../admin-client\";\nimport { useAlerts } from \"../components/alert/Alerts\";\nimport { ListEmptyState } from \"../components/list-empty-state/ListEmptyState\";\nimport { KeycloakDataTable } from \"../components/table-toolbar/KeycloakDataTable\";\nimport { emptyFormatter } from \"../util\";\n\ntype MemberModalProps = {\n membersQuery: () => Promise;\n onAdd: (users: UserRepresentation[]) => Promise;\n onClose: () => void;\n};\n\nexport const MemberModal = ({\n membersQuery,\n onAdd,\n onClose,\n}: MemberModalProps) => {\n const { adminClient } = useAdminClient();\n\n const { t } = useTranslation();\n const { addError } = useAlerts();\n const [selectedRows, setSelectedRows] = useState([]);\n\n const loader = async (first?: number, max?: number, search?: string) => {\n const members = await membersQuery();\n const params: { [name: string]: string | number } = {\n first: first!,\n max: max! + members.length,\n search: search || \"\",\n };\n\n try {\n const users = await adminClient.users.find({ ...params });\n return differenceBy(users, members, \"id\").slice(0, max);\n } catch (error) {\n addError(\"noUsersFoundError\", error);\n return [];\n }\n };\n\n return (\n {\n await onAdd(selectedRows);\n onClose();\n }}\n >\n {t(\"add\")}\n ,\n ,\n ]}\n >\n setSelectedRows([...rows])}\n emptyState={\n \n }\n columns={[\n {\n name: \"username\",\n displayKey: \"username\",\n },\n {\n name: \"email\",\n displayKey: \"email\",\n },\n {\n name: \"lastName\",\n displayKey: \"lastName\",\n cellFormatters: [emptyFormatter()],\n },\n {\n name: \"firstName\",\n displayKey: \"firstName\",\n cellFormatters: [emptyFormatter()],\n },\n ]}\n />\n \n );\n};\n"],"names":["MemberModal","membersQuery","onAdd","onClose","adminClient","useAdminClient","t","useTranslation","addError","useAlerts","selectedRows","setSelectedRows","useState","loader","first","max","search","members","params","users","differenceBy","error","jsx","Modal","ModalVariant","Button","KeycloakDataTable","rows","ListEmptyState","emptyFormatter"],"mappings":"gRAiBO,MAAMA,EAAc,CAAC,CAC1B,aAAAC,EACA,MAAAC,EACA,QAAAC,CACF,IAAwB,CAChB,KAAA,CAAE,YAAAC,GAAgBC,IAElB,CAAE,EAAAC,GAAMC,IACR,CAAE,SAAAC,GAAaC,IACf,CAACC,EAAcC,CAAe,EAAIC,EAA+B,CAAE,CAAA,EAEnEC,EAAS,MAAOC,EAAgBC,EAAcC,IAAoB,CAChE,MAAAC,EAAU,MAAMhB,IAChBiB,EAA8C,CAClD,MAAAJ,EACA,IAAKC,EAAOE,EAAQ,OACpB,OAAQD,GAAU,EAAA,EAGhB,GAAA,CACI,MAAAG,EAAQ,MAAMf,EAAY,MAAM,KAAK,CAAE,GAAGc,EAAQ,EACxD,OAAOE,EAAaD,EAAOF,EAAS,IAAI,EAAE,MAAM,EAAGF,CAAG,QAC/CM,EAAO,CACd,OAAAb,EAAS,oBAAqBa,CAAK,EAC5B,EACT,CAAA,EAIA,OAAAC,EAACC,EAAA,CACC,QAASC,EAAa,MACtB,MAAOlB,EAAE,WAAW,EACpB,OAAM,GACN,QAAAH,EACA,QAAS,CACPmB,EAACG,EAAA,CACC,cAAY,MAEZ,QAAQ,UACR,QAAS,SAAY,CACnB,MAAMvB,EAAMQ,CAAY,EAChBP,GACV,EAEC,WAAE,KAAK,CAAA,EAPJ,SAQN,EACAmB,EAACG,EAAA,CACC,cAAY,SAEZ,QAAQ,OACR,QAAStB,EAER,WAAE,QAAQ,CAAA,EAJP,QAKN,CACF,EAEA,SAAAmB,EAACI,EAAA,CACC,OAAAb,EACA,YAAW,GACX,aAAa,aACb,qBAAqB,gBACrB,aAAY,GACZ,SAAWc,GAAShB,EAAgB,CAAC,GAAGgB,CAAI,CAAC,EAC7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