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

theme.keycloak.v2.admin.resources.assets.ScopeDetails-Cp1I1Sv6.js.map Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
{"version":3,"file":"ScopeDetails-Cp1I1Sv6.js","sources":["../../src/clients/authorization/ScopeDetails.tsx"],"sourcesContent":["import type ScopeRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/scopeRepresentation\";\nimport {\n  ActionGroup,\n  AlertVariant,\n  Button,\n  ButtonVariant,\n  DropdownItem,\n  PageSection,\n} from \"@patternfly/react-core\";\nimport { useState } from \"react\";\nimport { FormProvider, useForm } 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 { FormAccess } from \"../../components/form/FormAccess\";\nimport { ViewHeader } from \"../../components/view-header/ViewHeader\";\nimport { useFetch } from \"../../utils/useFetch\";\nimport { useParams } from \"../../utils/useParams\";\nimport useToggle from \"../../utils/useToggle\";\nimport { toAuthorizationTab } from \"../routes/AuthenticationTab\";\nimport type { ScopeDetailsParams } from \"../routes/Scope\";\nimport { DeleteScopeDialog } from \"./DeleteScopeDialog\";\n\ntype FormFields = Omit;\n\nexport default function ScopeDetails() {\n  const { adminClient } = useAdminClient();\n\n  const { t } = useTranslation();\n  const { id, scopeId, realm } = useParams();\n  const navigate = useNavigate();\n  const { addAlert, addError } = useAlerts();\n  const [deleteDialog, toggleDeleteDialog] = useToggle();\n  const [scope, setScope] = useState();\n  const form = useForm({\n    mode: \"onChange\",\n  });\n  const { reset, handleSubmit } = form;\n\n  useFetch(\n    async () => {\n      if (scopeId) {\n        const scope = await adminClient.clients.getAuthorizationScope({\n          id,\n          scopeId,\n        });\n        if (!scope) {\n          throw new Error(t(\"notFound\"));\n        }\n        return scope;\n      }\n    },\n    (scope) => {\n      setScope(scope);\n      reset({ ...scope });\n    },\n    [],\n  );\n\n  const onSubmit = async (scope: ScopeRepresentation) => {\n    try {\n      if (scopeId) {\n        await adminClient.clients.updateAuthorizationScope(\n          { id, scopeId },\n          scope,\n        );\n        setScope(scope);\n      } else {\n        await adminClient.clients.createAuthorizationScope(\n          { id },\n          {\n            name: scope.name!,\n            displayName: scope.displayName,\n            iconUri: scope.iconUri,\n          },\n        );\n        navigate(toAuthorizationTab({ realm, clientId: id, tab: \"scopes\" }));\n      }\n      addAlert(\n        t((scopeId ? \"update\" : \"create\") + \"ScopeSuccess\"),\n        AlertVariant.success,\n      );\n    } catch (error) {\n      addError(\"scopeSaveError\", error);\n    }\n  };\n\n  return (\n    <>\n      \n          navigate(toAuthorizationTab({ realm, clientId: id, tab: \"scopes\" }))\n        }\n      />\n       toggleDeleteDialog()}\n                >\n                  {t(\"delete\")}\n                ,\n              ]\n            : undefined\n        }\n      />\n      \n        \n          \n            \n            \n            \n            \n              
\n \n {t(\"save\")}\n \n\n {!scope ? (\n (\n \n )}\n >\n {t(\"cancel\")}\n \n ) : (\n reset({ ...scope })}\n >\n {t(\"revert\")}\n \n )}\n
\n
\n \n
\n
\n \n );\n}\n"],"names":["ScopeDetails","adminClient","useAdminClient","t","useTranslation","id","scopeId","realm","useParams","navigate","useNavigate","addAlert","addError","useAlerts","deleteDialog","toggleDeleteDialog","useToggle","scope","setScope","useState","form","useForm","reset","handleSubmit","useFetch","onSubmit","toAuthorizationTab","AlertVariant","error","jsxs","Fragment","jsx","DeleteScopeDialog","ViewHeader","DropdownItem","PageSection","FormProvider","FormAccess","TextControl","ActionGroup","Button","ButtonVariant","props","Link"],"mappings":"8iBA2BA,SAAwBA,IAAe,CAC/B,KAAA,CAAE,YAAAC,GAAgBC,IAElB,CAAE,EAAAC,GAAMC,IACR,CAAE,GAAAC,EAAI,QAAAC,EAAS,MAAAC,GAAUC,EAA8B,EACvDC,EAAWC,IACX,CAAE,SAAAC,EAAU,SAAAC,CAAS,E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