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

theme.keycloak.v2.admin.resources.assets.ExtendedHeader-BcI8Gfaz.js.map Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
{"version":3,"file":"ExtendedHeader-BcI8Gfaz.js","sources":["../../src/user-federation/shared/ExtendedHeader.tsx"],"sourcesContent":["import { AlertVariant, Divider, DropdownItem } from \"@patternfly/react-core\";\nimport { useFormContext, useWatch } 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 { useConfirmDialog } from \"../../components/confirm-dialog/ConfirmDialog\";\nimport { Header } from \"./Header\";\n\ntype ExtendedHeaderProps = {\n  provider: string;\n  editMode?: string | string[];\n  save: () => void;\n  noDivider?: boolean;\n};\n\nexport const ExtendedHeader = ({\n  provider,\n  editMode,\n  save,\n  noDivider = false,\n}: ExtendedHeaderProps) => {\n  const { adminClient } = useAdminClient();\n\n  const { t } = useTranslation();\n  const { id } = useParams<{ id: string }>();\n  const { addAlert, addError } = useAlerts();\n\n  const { control } = useFormContext();\n  const hasImportUsers = useWatch({\n    name: \"config.importEnabled\",\n    control,\n    defaultValue: [\"true\"],\n  })[0];\n\n  const [toggleUnlinkUsersDialog, UnlinkUsersDialog] = useConfirmDialog({\n    titleKey: \"userFedUnlinkUsersConfirmTitle\",\n    messageKey: \"userFedUnlinkUsersConfirm\",\n    continueButtonLabel: \"unlinkUsers\",\n    onConfirm: () => unlinkUsers(),\n  });\n\n  const [toggleRemoveUsersDialog, RemoveUsersConfirm] = useConfirmDialog({\n    titleKey: t(\"removeImportedUsers\"),\n    messageKey: t(\"removeImportedUsersMessage\"),\n    continueButtonLabel: \"remove\",\n    onConfirm: async () => {\n      try {\n        removeImportedUsers();\n        addAlert(t(\"removeImportedUsersSuccess\"), AlertVariant.success);\n      } catch (error) {\n        addError(\"removeImportedUsersError\", error);\n      }\n    },\n  });\n\n  const removeImportedUsers = async () => {\n    try {\n      if (id) {\n        await adminClient.userStorageProvider.removeImportedUsers({ id });\n      }\n      addAlert(t(\"removeImportedUsersSuccess\"), AlertVariant.success);\n    } catch (error) {\n      addError(\"removeImportedUsersError\", error);\n    }\n  };\n\n  const syncChangedUsers = async () => {\n    try {\n      if (id) {\n        const response = await adminClient.userStorageProvider.sync({\n          id: id,\n          action: \"triggerChangedUsersSync\",\n        });\n        if (response.ignored) {\n          addAlert(`${response.status}.`, AlertVariant.warning);\n        } else {\n          addAlert(\n            t(\"syncUsersSuccess\") +\n              `${response.added} users added, ${response.updated} users updated, ${response.removed} users removed, ${response.failed} users failed.`,\n            AlertVariant.success,\n          );\n        }\n      }\n    } catch (error) {\n      addError(\"syncUsersError\", error);\n    }\n  };\n\n  const syncAllUsers = async () => {\n    try {\n      if (id) {\n        const response = await adminClient.userStorageProvider.sync({\n          id: id,\n          action: \"triggerFullSync\",\n        });\n        if (response.ignored) {\n          addAlert(`${response.status}.`, AlertVariant.warning);\n        } else {\n          addAlert(\n            t(\"syncUsersSuccess\") +\n              `${response.added} users added, ${response.updated} users updated, ${response.removed} users removed, ${response.failed} users failed.`,\n            AlertVariant.success,\n          );\n        }\n      }\n    } catch (error) {\n      addError(\"syncUsersError\", error);\n    }\n  };\n\n  const unlinkUsers = async () => {\n    try {\n      if (id) {\n        await adminClient.userStorageProvider.unlinkUsers({ id });\n      }\n      addAlert(t(\"unlinkUsersSuccess\"), AlertVariant.success);\n    } catch (error) {\n      addError(\"unlinkUsersError\", error);\n    }\n  };\n\n  return (\n    <>\n      \n      \n      \n            {t(\"syncChangedUsers\")}\n          ,\n          \n            {t(\"syncAllUsers\")}\n          ,\n          \n            {t(\"unlinkUsers\")}\n          ,\n          \n            {t(\"removeImported\")}\n          ,\n          ,\n        ]}\n      />\n    \n  );\n};\n"],"names":["ExtendedHeader","provider","editMode","save","noDivider","adminClient","useAdminClient","t","useTranslation","id","useParams","addAlert","addError","useAlerts","control","useFormContext","hasImportUsers","useWatch","toggleUnlinkUsersDialog","UnlinkUsersDialog","useConfirmDialog","unlinkUsers","toggleRemoveUsersDialog","RemoveUsersConfirm","removeImportedUsers","AlertVariant","error","syncChangedUsers","response","syncAllUsers","jsxs","Fragment","jsx","Header","DropdownItem","Divider"],"mappings":"6PAgBO,MAAMA,EAAiB,CAAC,CAC7B,SAAAC,EACA,SAAAC,EACA,KAAAC,EACA,UAAAC,EAAY,EACd,IAA2B,CACnB,KAAA,CAAE,YAAAC,GAAgBC,IAElB,CAAE,EAAAC,GAAMC,IACR,CAAE,GAAAC,GAAOC,IACT,CAAE,SAAAC,EAAU,SAAAC,CAAS,EAAIC,EAAU,EAEnC,CAAE,QAAAC,GAAYC,IACdC,EAAiBC,EAAS,CAC9B,KAAM,uBACN,QAAAH,EACA,aAAc,CAAC,MAAM,CAAA,CACtB,EAAE,CAAC,EAEE,CAACI,EAAyBC,CAAiB,EAAIC,EAAiB,CACpE,SAAU,iCACV,WAAY,4BACZ,oBAAqB,cACrB,UAAW,IAAMC,EAAY,CAAA,CAC9B,EAEK,CAACC,EAAyBC,CAAkB,EAAIH,EAAiB,CACrE,SAAUb,EAAE,qBAAqB,EACjC,WAAYA,EAAE,4BAA4B,EAC1C,oBAAqB,SACrB,UAAW,SAAY,CACjB,GAAA,CACkBiB,IACpBb,EAASJ,EAAE,4BAA4B,EAAGkB,EAAa,OAAO,QACvDC,EAAO,CACdd,EAAS,2BAA4Bc,CAAK,CAC5C,CACF,CAAA,CACD,EAEKF,EAAsB,SAAY,CAClC,GAAA,CACEf,GACF,MAAMJ,EAAY,oBAAoB,oBAAoB,CAAE,GAAAI,CAAI,CAAA,EAElEE,EAASJ,EAAE,4BAA4B,EAAGkB,EAAa,OAAO,QACvDC,EAAO,CACdd,EAAS,2BAA4Bc,CAAK,CAC5C,CAAA,EAGIC,EAAmB,SAAY,CAC/B,GAAA,CACF,GAAIlB,EAAI,CACN,MAAMmB,EAAW,MAAMvB,EAAY,oBAAo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