Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
theme.keycloak.v2.admin.resources.assets.CreateRealmRole-3423f0b0.js.map Maven / Gradle / Ivy
Go to download
The user inferface to administrate the Keycloak server.
{"version":3,"file":"CreateRealmRole-3423f0b0.js","sources":["../../src/realm-roles/CreateRealmRole.tsx"],"sourcesContent":["import type RoleRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/roleRepresentation\";\nimport { AlertVariant } from \"@patternfly/react-core\";\nimport { SubmitHandler, useForm } from \"react-hook-form\";\nimport { useTranslation } from \"react-i18next\";\nimport { useNavigate } from \"react-router-dom\";\n\nimport { adminClient } from \"../admin-client\";\nimport { useAlerts } from \"../components/alert/Alerts\";\nimport { AttributeForm } from \"../components/key-value-form/AttributeForm\";\nimport { RoleForm } from \"../components/role-form/RoleForm\";\nimport { useRealm } from \"../context/realm-context/RealmContext\";\nimport { toRealmRole } from \"./routes/RealmRole\";\nimport { toRealmRoles } from \"./routes/RealmRoles\";\n\nexport default function CreateRealmRole() {\n const { t } = useTranslation(\"roles\");\n const form = useForm({ mode: \"onChange\" });\n const navigate = useNavigate();\n const { realm } = useRealm();\n const { addAlert, addError } = useAlerts();\n\n const onSubmit: SubmitHandler = async (formValues) => {\n const role: RoleRepresentation = {\n ...formValues,\n name: formValues.name?.trim(),\n attributes: {},\n };\n\n try {\n await adminClient.roles.create(role);\n\n const createdRole = await adminClient.roles.findOneByName({\n name: formValues.name!,\n });\n\n if (!createdRole) {\n throw new Error(t(\"common:notFound\"));\n }\n\n addAlert(t(\"roleCreated\"), AlertVariant.success);\n navigate(toRealmRole({ realm, id: createdRole.id!, tab: \"details\" }));\n } catch (error) {\n addError(\"roles:roleCreateError\", error);\n }\n };\n\n return (\n \n );\n}\n"],"names":["CreateRealmRole","t","useTranslation","form","useForm","navigate","useNavigate","realm","useRealm","addAlert","addError","useAlerts","onSubmit","formValues","role","adminClient","createdRole","AlertVariant","toRealmRole","error","jsx","RoleForm","toRealmRoles"],"mappings":"+bAcA,SAAwBA,GAAkB,CACxC,KAAM,CAAE,EAAAC,CAAA,EAAMC,EAAe,OAAO,EAC9BC,EAAOC,EAAuB,CAAE,KAAM,UAAY,CAAA,EAClDC,EAAWC,IACX,CAAE,MAAAC,GAAUC,IACZ,CAAE,SAAAC,EAAU,SAAAC,CAAS,EAAIC,EAAU,EAEnCC,EAAyC,MAAOC,GAAe,CACnE,MAAMC,EAA2B,CAC/B,GAAGD,EACH,KAAMA,EAAW,MAAM,KAAK,EAC5B,WAAY,CAAC,CAAA,EAGX,GAAA,CACI,MAAAE,EAAY,MAAM,OAAOD,CAAI,EAEnC,MAAME,EAAc,MAAMD,EAAY,MAAM,cAAc,CACxD,KAAMF,EAAW,IAAA,CAClB,EAED,GAAI,CAACG,EACH,MAAM,IAAI,MAAMf,EAAE,iBAAiB,CAAC,EAGtCQ,EAASR,EAAE,aAAa,EAAGgB,EAAa,OAAO,EACtCZ,EAAAa,EAAY,CAAE,MAAAX,EAAO,GAAIS,EAAY,GAAK,IAAK,SAAW,CAAA,CAAC,QAC7DG,EAAO,CACdT,EAAS,wBAAyBS,CAAK,CACzC,CAAA,EAIA,OAAAC,EAAA,IAACC,EAAA,CACC,KAAAlB,EACA,SAAAS,EACA,WAAYU,EAAa,CAAE,MAAAf,EAAO,EAClC,KAAK,eACL,SAAU,EAAA,CAAA,CAGhB"}