theme.keycloak.v2.admin.resources.assets.UserFederationLdapSettings-BZOwKGoF.js.map Maven / Gradle / Ivy
{"version":3,"file":"UserFederationLdapSettings-BZOwKGoF.js","sources":["../../src/user-federation/ldap/mappers/LdapMapperList.tsx","../../src/user-federation/UserFederationLdapSettings.tsx"],"sourcesContent":["import type ComponentRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/componentRepresentation\";\nimport {\n AlertVariant,\n Button,\n ButtonVariant,\n ToolbarItem,\n} from \"@patternfly/react-core\";\nimport { useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { Link, To, useNavigate, useParams } from \"react-router-dom\";\nimport { useAdminClient } from \"../../../admin-client\";\nimport { useAlerts } from \"../../../components/alert/Alerts\";\nimport { useConfirmDialog } from \"../../../components/confirm-dialog/ConfirmDialog\";\nimport { ListEmptyState } from \"../../../components/list-empty-state/ListEmptyState\";\nimport {\n Action,\n KeycloakDataTable,\n} from \"../../../components/table-toolbar/KeycloakDataTable\";\nimport { useFetch } from \"../../../utils/useFetch\";\nimport useLocaleSort, { mapByKey } from \"../../../utils/useLocaleSort\";\n\nexport type LdapMapperListProps = {\n toCreate: To;\n toDetail: (mapperId: string) => To;\n};\n\ntype MapperLinkProps = ComponentRepresentation & {\n toDetail: (mapperId: string) => To;\n};\n\nconst MapperLink = ({ toDetail, ...mapper }: MapperLinkProps) => (\n {mapper.name}\n);\n\nexport const LdapMapperList = ({ toCreate, toDetail }: LdapMapperListProps) => {\n const { adminClient } = useAdminClient();\n\n const navigate = useNavigate();\n const { t } = useTranslation();\n const { addAlert, addError } = useAlerts();\n const [key, setKey] = useState(0);\n const refresh = () => setKey(key + 1);\n\n const [mappers, setMappers] = useState([]);\n const localeSort = useLocaleSort();\n\n const { id } = useParams<{ id: string }>();\n\n const [selectedMapper, setSelectedMapper] =\n useState();\n\n useFetch(\n () =>\n adminClient.components.find({\n parent: id,\n type: \"org.keycloak.storage.ldap.mappers.LDAPStorageMapper\",\n }),\n (mapper) => {\n setMappers(\n localeSort(\n mapper.map((mapper) => ({\n ...mapper,\n name: mapper.name,\n type: mapper.providerId,\n })),\n mapByKey(\"name\"),\n ),\n );\n },\n [key],\n );\n\n const [toggleDeleteDialog, DeleteConfirm] = useConfirmDialog({\n titleKey: t(\"deleteMappingTitle\", { mapperId: selectedMapper?.id }),\n messageKey: \"deleteMappingConfirm\",\n continueButtonLabel: \"delete\",\n continueButtonVariant: ButtonVariant.danger,\n onConfirm: async () => {\n try {\n await adminClient.components.del({\n id: selectedMapper!.id!,\n });\n refresh();\n addAlert(t(\"mappingDeletedSuccess\"), AlertVariant.success);\n setSelectedMapper(undefined);\n } catch (error) {\n addError(\"mappingDeletedError\", error);\n }\n },\n });\n\n return (\n <>\n \n \n \n \n }\n actions={[\n {\n title: t(\"delete\"),\n onRowClick: (mapper) => {\n setSelectedMapper(mapper);\n toggleDeleteDialog();\n },\n } as Action,\n ]}\n columns={[\n {\n name: \"name\",\n cellRenderer: (row) => ,\n },\n {\n name: \"type\",\n },\n ]}\n emptyState={\n navigate(toCreate)}\n />\n }\n />\n >\n );\n};\n","import type ComponentRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/componentRepresentation\";\nimport {\n AlertVariant,\n PageSection,\n Tab,\n TabTitleText,\n} from \"@patternfly/react-core\";\nimport { useState } from \"react\";\nimport { FormProvider, useForm } from \"react-hook-form\";\nimport { useTranslation } from \"react-i18next\";\nimport { useParams } from \"react-router-dom\";\nimport { useAdminClient } from \"../admin-client\";\nimport { useAlerts } from \"../components/alert/Alerts\";\nimport { KeycloakSpinner } from \"../components/keycloak-spinner/KeycloakSpinner\";\nimport {\n RoutableTabs,\n useRoutableTab,\n} from \"../components/routable-tabs/RoutableTabs\";\nimport { useRealm } from \"../context/realm-context/RealmContext\";\nimport { useFetch } from \"../utils/useFetch\";\nimport {\n LdapComponentRepresentation,\n UserFederationLdapForm,\n serializeFormData,\n} from \"./UserFederationLdapForm\";\nimport { LdapMapperList } from \"./ldap/mappers/LdapMapperList\";\nimport {\n UserFederationLdapParams,\n UserFederationLdapTab,\n toUserFederationLdap,\n} from \"./routes/UserFederationLdap\";\nimport { toUserFederationLdapMapper } from \"./routes/UserFederationLdapMapper\";\nimport { ExtendedHeader } from \"./shared/ExtendedHeader\";\n\nexport default function UserFederationLdapSettings() {\n const { adminClient } = useAdminClient();\n\n const { t } = useTranslation();\n const form = useForm({ mode: \"onChange\" });\n const { realm } = useRealm();\n const { id } = useParams();\n const { addAlert, addError } = useAlerts();\n const [component, setComponent] = useState();\n const [refreshCount, setRefreshCount] = useState(0);\n\n const refresh = () => setRefreshCount((count) => count + 1);\n\n useFetch(\n () => adminClient.components.findOne({ id: id! }),\n (component) => {\n if (!component) {\n throw new Error(t(\"notFound\"));\n }\n\n setComponent(component);\n setupForm(component);\n },\n [id, refreshCount],\n );\n\n const useTab = (tab: UserFederationLdapTab) =>\n useRoutableTab(toUserFederationLdap({ realm, id: id!, tab }));\n\n const settingsTab = useTab(\"settings\");\n const mappersTab = useTab(\"mappers\");\n\n const setupForm = (component: ComponentRepresentation) => {\n form.reset(component);\n form.setValue(\n \"config.periodicChangedUsersSync\",\n component.config?.[\"changedSyncPeriod\"]?.[0] !== \"-1\",\n );\n\n form.setValue(\n \"config.periodicFullSync\",\n component.config?.[\"fullSyncPeriod\"]?.[0] !== \"-1\",\n );\n };\n\n const onSubmit = async (formData: LdapComponentRepresentation) => {\n try {\n await adminClient.components.update(\n { id: id! },\n serializeFormData(formData),\n );\n addAlert(t(\"userProviderSaveSuccess\"), AlertVariant.success);\n refresh();\n } catch (error) {\n addError(\"userProviderSaveError\", error);\n }\n };\n\n if (!component) {\n return ;\n }\n\n return (\n \n form.handleSubmit(onSubmit)()}\n />\n \n \n {t(\"settings\")}}\n {...settingsTab}\n >\n \n \n \n \n {t(\"mappers\")}}\n data-testid=\"ldap-mappers-tab\"\n {...mappersTab}\n >\n \n toUserFederationLdapMapper({\n realm,\n id: id!,\n mapperId,\n })\n }\n />\n \n \n \n \n );\n}\n"],"names":["MapperLink","toDetail","mapper","jsx","Link","LdapMapperList","toCreate","adminClient","useAdminClient","navigate","useNavigate","t","useTranslation","addAlert","addError","useAlerts","key","setKey","useState","refresh","mappers","setMappers","localeSort","useLocaleSort","id","useParams","selectedMapper","setSelectedMapper","useFetch","mapByKey","toggleDeleteDialog","DeleteConfirm","useConfirmDialog","ButtonVariant","AlertVariant","error","jsxs","Fragment","KeycloakDataTable","ToolbarItem","Button","props","row","ListEmptyState","UserFederationLdapSettings","form","useForm","realm","useRealm","component","setComponent","refreshCount","setRefreshCount","count","setupForm","useTab","tab","useRoutableTab","toUserFederationLdap","settingsTab","mappersTab","onSubmit","formData","serializeFormData","FormProvider","ExtendedHeader","PageSection","RoutableTabs","Tab","TabTitleText","UserFederationLdapForm","toUserFederationLdapMapper","mapperId","KeycloakSpinner"],"mappings":"0/CA8BA,MAAMA,GAAa,CAAC,CAAE,SAAAC,EAAU,GAAGC,CAAO,IACvCC,EAAAC,EAAA,CAAK,GAAIH,EAASC,EAAO,EAAG,EAAI,WAAO,IAAK,CAAA,EAGlCG,GAAiB,CAAC,CAAE,SAAAC,EAAU,SAAAL,KAAoC,CACvE,KAAA,CAAE,YAAAM,GAAgBC,IAElBC,EAAWC,IACX,CAAE,EAAAC,GAAMC,IACR,CAAE,SAAAC,EAAU,SAAAC,CAAS,EAAIC,EAAU,EACnC,CAACC,EAAKC,CAAM,EAAIC,EAAS,CAAC,EAC1BC,EAAU,IAAMF,EAAOD,EAAM,CAAC,EAE9B,CAACI,EAASC,CAAU,EAAIH,EAAoC,CAAE,CAAA,EAC9DI,EAAaC,IAEb,CAAE,GAAAC,GAAOC,IAET,CAACC,EAAgBC,CAAiB,EACtCT,EAAkC,EAEpCU,EACE,IACErB,EAAY,WAAW,KAAK,CAC1B,OAAQiB,EACR,KAAM,qDAAA,CACP,EACFtB,GAAW,CACVmB,EACEC,EACEpB,EAAO,IAAKA,IAAY,CACtB,GAAGA,EACH,KAAMA,EAAO,KACb,KAAMA,EAAO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