theme.keycloak.v2.admin.resources.assets.DetailProvider-Bcznlvmy.js.map Maven / Gradle / Ivy
{"version":3,"file":"DetailProvider-Bcznlvmy.js","sources":["../../src/clients/registration/DetailProvider.tsx"],"sourcesContent":["import ComponentRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/componentRepresentation\";\nimport ComponentTypeRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/componentTypeRepresentation\";\nimport {\n ActionGroup,\n Button,\n ButtonVariant,\n DropdownItem,\n PageSection,\n} from \"@patternfly/react-core\";\nimport { useState } from \"react\";\nimport { FormProvider, useForm, useWatch } from \"react-hook-form\";\nimport { useTranslation } from \"react-i18next\";\nimport { Link, useNavigate } from \"react-router-dom\";\nimport { TextControl } from \"@keycloak/keycloak-ui-shared\";\nimport { useAdminClient } from \"../../admin-client\";\nimport { useAlerts } from \"../../components/alert/Alerts\";\nimport { useConfirmDialog } from \"../../components/confirm-dialog/ConfirmDialog\";\nimport { DynamicComponents } from \"../../components/dynamic/DynamicComponents\";\nimport { FormAccess } from \"../../components/form/FormAccess\";\nimport { KeycloakSpinner } from \"../../components/keycloak-spinner/KeycloakSpinner\";\nimport { ViewHeader } from \"../../components/view-header/ViewHeader\";\nimport { useRealm } from \"../../context/realm-context/RealmContext\";\nimport { useFetch } from \"../../utils/useFetch\";\nimport { useParams } from \"../../utils/useParams\";\nimport {\n RegistrationProviderParams,\n toRegistrationProvider,\n} from \"../routes/AddRegistrationProvider\";\nimport { toClientRegistration } from \"../routes/ClientRegistration\";\n\nexport default function DetailProvider() {\n const { adminClient } = useAdminClient();\n\n const { t } = useTranslation();\n const { id, providerId, subTab } = useParams();\n const navigate = useNavigate();\n const form = useForm({\n defaultValues: { providerId },\n });\n const { control, handleSubmit, reset } = form;\n\n const { realm, realmRepresentation } = useRealm();\n const { addAlert, addError } = useAlerts();\n const [provider, setProvider] = useState();\n\n useFetch(\n async () =>\n await Promise.all([\n adminClient.realms.getClientRegistrationPolicyProviders({ realm }),\n id ? adminClient.components.findOne({ id }) : Promise.resolve(),\n ]),\n ([providers, data]) => {\n setProvider(providers.find((p) => p.id === providerId));\n reset(data || { providerId });\n },\n [],\n );\n\n const providerName = useWatch({ control, defaultValue: \"\", name: \"name\" });\n\n const onSubmit = async (component: ComponentRepresentation) => {\n if (component.config)\n Object.entries(component.config).forEach(\n ([key, value]) =>\n (component.config![key] = Array.isArray(value) ? value : [value]),\n );\n try {\n const updatedComponent = {\n ...component,\n subType: subTab,\n parentId: realmRepresentation?.id,\n providerType:\n \"org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy\",\n providerId,\n };\n if (id) {\n await adminClient.components.update({ id }, updatedComponent);\n } else {\n const { id } = await adminClient.components.create(updatedComponent);\n navigate(toRegistrationProvider({ id, realm, subTab, providerId }));\n }\n addAlert(t(`provider${id ? \"Updated\" : \"Create\"}Success`));\n } catch (error) {\n addError(`provider${id ? \"Updated\" : \"Create\"}Error`, error);\n }\n };\n\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: \"clientRegisterPolicyDeleteConfirmTitle\",\n messageKey: t(\"clientRegisterPolicyDeleteConfirm\", {\n name: providerName,\n }),\n continueButtonLabel: \"delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.components.del({\n realm,\n id: id!,\n });\n addAlert(t(\"clientRegisterPolicyDeleteSuccess\"));\n navigate(toClientRegistration({ realm, subTab }));\n } catch (error) {\n addError(\"clientRegisterPolicyDeleteError\", error);\n }\n },\n });\n\n if (!provider) {\n return ;\n }\n\n return (\n <>\n \n {t(\"delete\")}\n ,\n ]\n : undefined\n }\n />\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n >\n );\n}\n"],"names":["DetailProvider","adminClient","useAdminClient","useTranslation","id","providerId","subTab","useParams","navigate","useNavigate","form","useForm","control","handleSubmit","reset","realm","realmRepresentation","useRealm","addAlert","addError","useAlerts","provider","setProvider","useState","useFetch","providers","data","p","providerName","useWatch","onSubmit","component","key","value","updatedComponent","toRegistrationProvider","error","toggleDeleteDialog","DeleteConfirm","useConfirmDialog","ButtonVariant","toClientRegistration","jsxs","Fragment","jsx","ViewHeader","DropdownItem","PageSection","FormProvider","FormAccess","TextControl","DynamicComponents","ActionGroup","Button","props","Link","KeycloakSpinner"],"mappings":"krCA8BA,SAAwBA,IAAiB,CACjC,KAAA,CAAE,YAAAC,GAAgBC,IAElB,CAAE,GAAMC,IACR,CAAE,GAAAC,EAAI,WAAAC,EAAY,OAAAC,GAAWC,EAAsC,EACnEC,EAAWC,IACXC,EAAOC,EAAiC,CAC5C,cAAe,CAAE,WAAAN,CAAW,CAAA,CAC7B,EACK,CAAE,QAAAO,EAAS,aAAAC,EAAc,MAAAC,CAAA,EAAUJ,EAEnC,CAAE,MAAAK,EAAO,oBAAAC,CAAoB,EAAIC,EAAS,EAC1C,CAAE,SAAAC,EAAU,SAAAC,CAAS,EAAIC,EAAU,EACnC,CAACC,EAAUC,CAAW,EAAIC,EAAsC,EAEtEC,EACE,SACE,MAAM,QAAQ,IAAI,CAChBvB,EAAY,OAAO,qCAAqC,CAAE,MAAAc,EAAO,EACjEX,EAAKH,EAAY,WAAW,QAAQ,CAAE,GAAAG,EAAI,EAAI,QAAQ,QAAQ,CAAA,CAC/D,EACH,CAAC,CAACqB,EAAWC,CAAI,IAAM,CACrBJ,EAAYG,EAAU,KAAME,GAAMA,EAAE,KAAOtB,CAAU,CAAC,EAChDS,EAAAY,GAAQ,CAAE,WAAArB,CAAA,CAAY,CAC9B,EACA,CAAC,CAAA,EAGG,MAAAuB,EAAeC,EAAS,CAAE,QAAAjB,EAAS,aAAc,GAAI,KAAM,OAAQ,EAEnEkB,EAAW,MAAOC,GAAuC,CACzDA,EAAU,QACL,OAAA,QAAQA,EAAU,MAAM,EAAE,QAC/B,CAAC,CAACC,EAAKC,CAAK,IACTF,EAAU,OAAQC,CAAG,EAAI,MAAM,QAAQC,CAAK,EAAIA,EAAQ,CAACA,CAAK,CAAA,EAEjE,GAAA,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