theme.keycloak.v2.admin.resources.assets.CreateClientScope-C3n0fw47.js.map Maven / Gradle / Ivy
{"version":3,"file":"CreateClientScope-C3n0fw47.js","sources":["../../src/client-scopes/CreateClientScope.tsx"],"sourcesContent":["import { AlertVariant, PageSection } from \"@patternfly/react-core\";\nimport { useTranslation } from \"react-i18next\";\nimport { useNavigate } from \"react-router-dom\";\nimport { useAdminClient } from \"../admin-client\";\nimport { useAlerts } from \"../components/alert/Alerts\";\nimport {\n ClientScopeDefaultOptionalType,\n changeScope,\n} from \"../components/client-scope/ClientScopeTypes\";\nimport { ViewHeader } from \"../components/view-header/ViewHeader\";\nimport { useRealm } from \"../context/realm-context/RealmContext\";\nimport { convertFormValuesToObject } from \"../util\";\nimport { ScopeForm } from \"./details/ScopeForm\";\nimport { toClientScope } from \"./routes/ClientScope\";\n\nexport default function CreateClientScope() {\n const { adminClient } = useAdminClient();\n\n const { t } = useTranslation();\n const navigate = useNavigate();\n const { realm } = useRealm();\n const { addAlert, addError } = useAlerts();\n\n const onSubmit = async (formData: ClientScopeDefaultOptionalType) => {\n const clientScope = convertFormValuesToObject({\n ...formData,\n name: formData.name?.trim().replace(/ /g, \"_\"),\n });\n\n try {\n await adminClient.clientScopes.create(clientScope);\n\n const scope = await adminClient.clientScopes.findOneByName({\n name: clientScope.name!,\n });\n\n if (!scope) {\n throw new Error(t(\"notFound\"));\n }\n\n await changeScope(\n adminClient,\n { ...clientScope, id: scope.id },\n clientScope.type,\n );\n\n addAlert(t(\"createClientScopeSuccess\", AlertVariant.success));\n\n navigate(\n toClientScope({\n realm,\n id: scope.id!,\n tab: \"settings\",\n }),\n );\n } catch (error) {\n addError(\"createClientScopeError\", error);\n }\n };\n\n return (\n <>\n \n \n \n \n \n \n >\n );\n}\n"],"names":["CreateClientScope","adminClient","useAdminClient","t","useTranslation","navigate","useNavigate","realm","useRealm","addAlert","addError","useAlerts","jsxs","Fragment","jsx","ViewHeader","PageSection","ScopeForm","formData","clientScope","convertFormValuesToObject","scope","changeScope","AlertVariant","toClientScope","error"],"mappings":"ycAeA,SAAwBA,GAAoB,CACpC,KAAA,CAAE,YAAAC,GAAgBC,IAElB,CAAE,EAAAC,GAAMC,IACRC,EAAWC,IACX,CAAE,MAAAC,GAAUC,IACZ,CAAE,SAAAC,EAAU,SAAAC,CAAS,EAAIC,EAAU,EAuCzC,OAEIC,EAAAC,EAAA,CAAA,SAAA,CAACC,EAAAC,EAAA,CAAW,SAAS,mBAAoB,CAAA,EACxCD,EAAAE,EAAA,CAAY,QAAQ,QAAQ,UAAU,cACrC,SAAAF,EAACE,EAAY,CAAA,QAAQ,QACnB,SAACF,EAAAG,EAAA,CAAU,KA1CF,MAAOC,GAA6C,CACnE,MAAMC,EAAcC,EAA0B,CAC5C,GAAGF,EACH,KAAMA,EAAS,MAAM,KAAO,EAAA,QAAQ,KAAM,GAAG,CAAA,CAC9C,EAEG,GAAA,CACI,MAAAjB,EAAY,aAAa,OAAOkB,CAAW,EAEjD,MAAME,EAAQ,MAAMpB,EAAY,aAAa,cAAc,CACzD,KAAMkB,EAAY,IAAA,CACnB,EAED,GAAI,CAACE,EACH,MAAM,IAAI,MAAMlB,EAAE,UAAU,CAAC,EAGzB,MAAAmB,EACJrB,EACA,CAAE,GAAGkB,EAAa,GAAIE,EAAM,EAAG,EAC/BF,EAAY,IAAA,EAGdV,EAASN,EAAE,2BAA4BoB,EAAa,OAAO,CAAC,EAE5DlB,EACEmB,EAAc,CACZ,MAAAjB,EACA,GAAIc,EAAM,GACV,IAAK,UAAA,CACN,CAAA,QAEII,EAAO,CACdf,EAAS,yBAA0Be,CAAK,CAC1C,CAAA,CAQuB,CAAU,CAC7B,CAAA,EACF,CACF,CAAA,CAAA,CAEJ"}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy