All Downloads are FREE. Search and download functionalities are using the official Maven repository.

theme.keycloak.v2.admin.resources.assets.CustomProviderSettings-B0gEaLvT.js.map Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
{"version":3,"file":"CustomProviderSettings-B0gEaLvT.js","sources":["../../src/user-federation/custom/SyncSettings.tsx","../../src/user-federation/custom/CustomProviderSettings.tsx"],"sourcesContent":["import { FormGroup, Switch } from \"@patternfly/react-core\";\nimport { Controller, FormProvider, useFormContext } from \"react-hook-form\";\nimport { useTranslation } from \"react-i18next\";\nimport { HelpItem, TextControl } from \"@keycloak/keycloak-ui-shared\";\n\nexport const SyncSettings = () => {\n  const { t } = useTranslation();\n  const form = useFormContext();\n  const { control, watch } = form;\n  const watchPeriodicSync = watch(\"config.fullSyncPeriod\", \"-1\");\n  const watchChangedSync = watch(\"config.changedSyncPeriod\", \"-1\");\n\n  return (\n    \n      \n        }\n        fieldId=\"kc-periodic-full-sync\"\n        hasNoPaddingTop\n      >\n         (\n             {\n                field.onChange(value ? \"604800\" : \"-1\");\n              }}\n              isChecked={field.value !== \"-1\"}\n              label={t(\"on\")}\n              labelOff={t(\"off\")}\n              aria-label={t(\"periodicFullSync\")}\n            />\n          )}\n        />\n      \n      {watchPeriodicSync !== \"-1\" && (\n        \n      )}\n      \n        }\n        fieldId=\"kc-periodic-changed-users-sync\"\n        hasNoPaddingTop\n      >\n         (\n             {\n                field.onChange(value ? \"86400\" : \"-1\");\n              }}\n              isChecked={field.value !== \"-1\"}\n              label={t(\"on\")}\n              labelOff={t(\"off\")}\n              aria-label={t(\"periodicChangedUsersSync\")}\n            />\n          )}\n        />\n      \n      {watchChangedSync !== \"-1\" && (\n        \n      )}\n    \n  );\n};\n","import type ComponentRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/componentRepresentation\";\nimport { TextControl } from \"@keycloak/keycloak-ui-shared\";\nimport {\n  ActionGroup,\n  AlertVariant,\n  Button,\n  PageSection,\n} from \"@patternfly/react-core\";\nimport { FormProvider, useForm } from \"react-hook-form\";\nimport { useTranslation } from \"react-i18next\";\nimport { Link, useNavigate } from \"react-router-dom\";\nimport { useAdminClient } from \"../../admin-client\";\nimport { useAlerts } from \"../../components/alert/Alerts\";\nimport { DynamicComponents } from \"../../components/dynamic/DynamicComponents\";\nimport { FormAccess } from \"../../components/form/FormAccess\";\nimport { useRealm } from \"../../context/realm-context/RealmContext\";\nimport { useServerInfo } from \"../../context/server-info/ServerInfoProvider\";\nimport { convertFormValuesToObject, convertToFormValues } from \"../../util\";\nimport { useFetch } from \"../../utils/useFetch\";\nimport { useParams } from \"../../utils/useParams\";\nimport type { CustomUserFederationRouteParams } from \"../routes/CustomUserFederation\";\nimport { toUserFederation } from \"../routes/UserFederation\";\nimport { ExtendedHeader } from \"../shared/ExtendedHeader\";\nimport { SettingsCache } from \"../shared/SettingsCache\";\nimport { SyncSettings } from \"./SyncSettings\";\n\nimport \"./custom-provider-settings.css\";\n\nexport default function CustomProviderSettings() {\n  const { adminClient } = useAdminClient();\n\n  const { t } = useTranslation();\n  const { id, providerId } = useParams();\n  const navigate = useNavigate();\n  const form = useForm({\n    mode: \"onChange\",\n  });\n  const {\n    reset,\n    setValue,\n    handleSubmit,\n    formState: { isDirty },\n  } = form;\n\n  const { addAlert, addError } = useAlerts();\n  const { realm: realmName, realmRepresentation: realm } = useRealm();\n\n  const provider = (\n    useServerInfo().componentTypes?.[\n      \"org.keycloak.storage.UserStorageProvider\"\n    ] || []\n  ).find((p) => p.id === providerId);\n\n  useFetch(\n    async () => {\n      if (id) {\n        return await adminClient.components.findOne({ id });\n      }\n      return undefined;\n    },\n    (fetchedComponent) => {\n      if (fetchedComponent) {\n        convertToFormValues(fetchedComponent, setValue);\n      } else if (id) {\n        throw new Error(t(\"notFound\"));\n      }\n    },\n    [],\n  );\n\n  const save = async (component: ComponentRepresentation) => {\n    const saveComponent = convertFormValuesToObject({\n      ...component,\n      config: Object.fromEntries(\n        Object.entries(component.config || {}).map(([key, value]) => [\n          key,\n          Array.isArray(value) ? value : [value],\n        ]),\n      ),\n      providerId,\n      providerType: \"org.keycloak.storage.UserStorageProvider\",\n      parentId: realm?.id,\n    });\n\n    try {\n      if (!id) {\n        await adminClient.components.create(saveComponent);\n        navigate(toUserFederation({ realm: realmName }));\n      } else {\n        await adminClient.components.update({ id }, saveComponent);\n      }\n      reset({ ...component });\n      addAlert(\n        t(!id ? \"createUserProviderSuccess\" : \"userProviderSaveSuccess\"),\n        AlertVariant.success,\n      );\n    } catch (error) {\n      addError(\n        !id ? \"createUserProviderError\" : \"userProviderSaveError\",\n        error,\n      );\n    }\n  };\n\n  return (\n    \n       handleSubmit(save)()} />\n      \n        \n          \n          \n          {provider?.metadata.synchronizable && }\n          \n          \n            \n              {t(\"save\")}\n            \n             (\n                \n              )}\n              data-testid=\"custom-cancel\"\n            >\n              {t(\"cancel\")}\n            \n          \n        \n      \n    \n  );\n}\n"],"names":["SyncSettings","t","useTranslation","form","useFormContext","control","watch","watchPeriodicSync","watchChangedSync","jsxs","FormProvider","jsx","FormGroup","HelpItem","Controller","field","Switch","_event","value","TextControl","CustomProviderSettings","adminClient","useAdminClient","id","providerId","useParams","navigate","useNavigate","useForm","reset","setValue","handleSubmit","isDirty","addAlert","addError","useAlerts","realmName","realm","useRealm","provider","useServerInfo","p","useFetch","fetchedComponent","convertToFormValues","save","component","saveComponent","convertFormValuesToObject","key","toUserFederation","AlertVariant","error","ExtendedHeader","PageSection","FormAccess","DynamicComponents","SettingsCache","ActionGroup","Button","props","Link"],"mappings":"sxCAKO,MAAMA,EAAe,IAAM,CAC1B,KAAA,CAAE,EAAAC,GAAMC,IACRC,EAAOC,IACP,CAAE,QAAAC,EAAS,MAAAC,CAAU,EAAAH,EACrBI,EAAoBD,EAAM,wBAAyB,IAAI,EACvDE,EAAmBF,EAAM,2BAA4B,IAAI,EAG7D,OAAAG,EAACC,EAAc,CAAA,GAAGP,EAChB,SAAA,CAAAQ,EAACC,EAAA,CACC,MAAOX,EAAE,kBAAkB,EAC3B,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