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

theme.keycloak.v2.admin.resources.assets.MappingDetails-96c79ed5.js Maven / Gradle / Ivy

There is a newer version: 25.0.1
Show newest version
import{u as R,d as k,e as q,r as j,b as G,c as L,W as N,a9 as $,q as z,l as H,g as i,A as w,j as o,G as U,P as W,F as v,h as J,V as l,f as Q,B as F,L as X,aa as Y,a5 as Z,ab as _,z as oo,y as eo}from"./index-831988f6.js";import{u as to}from"./ConfirmDialog-927d61dd.js";import{D as ro}from"./DynamicComponents-40ae4a49.js";import{F as ao}from"./FormAccess-589a8032.js";import{K as S}from"./KeycloakTextInput-ead44014.js";import{V as po}from"./ViewHeader-2b1ad3ef.js";import{u as io}from"./useParams-6d64d61e.js";import{A as no}from"./Form-bd3cf98e.js";import"./Modal-5d8a3df4.js";import"./ClientSelect-a86c8c66.js";import"./Select-9c61d949.js";import"./check-fc57dbe1.js";import"./star-icon-f5649401.js";import"./FileUpload-bcd6c3a5.js";import"./CodeEditor-09988f1c.js";import"./copy-icon-476b0d6d.js";import"./EmptyStateBody-dd392e69.js";import"./EmptyStateSecondaryActions-3d9f7969.js";import"./GroupPickerDialog-71e86661.js";import"./PaginatingTableToolbar-c55a17f1.js";import"./plus-circle-icon-3c14c705.js";import"./TableToolbar-af5dff6f.js";import"./ToolbarContent-186be8fd.js";import"./admin-ui-endpoint-cc06c193.js";import"./getAuthorizationHeaders-f2376d1a.js";import"./DataListItemRow-e4e4ea8b.js";import"./data-list-7d55714c.js";import"./grip-vertical-icon-0333850c.js";import"./ActionListItem-90f0e72b.js";import"./Flex-65bed60e.js";import"./FlexItem-1a5a46b8.js";import"./minus-circle-icon-d374d13f.js";import"./MultiLineInput-6564e881.js";import"./PasswordInput-8b14c85c.js";import"./useToggle-039c9b34.js";import"./AddRoleMappingModal-e0605cd7.js";import"./useLocaleSort-6d6b4eec.js";import"./KeycloakDataTable-2267a354.js";import"./Td-bb613d18.js";import"./Checkbox-d44d2684.js";import"./resource-edcf6e4d.js";import"./filter-icon-5bbef384.js";import"./KeycloakTextArea-3e2614e3.js";import"./GridItem-2c75fd83.js";import"./Text-2a2c2dcc.js";function oe(){const{t}=R("client-scopes"),{addAlert:u,addError:f}=k(),{id:r,mapperId:a}=io(),g=q(),{register:T,setValue:b,formState:{errors:y},handleSubmit:I}=g,[d,C]=j.useState(),[P,D]=j.useState(),A=G(),{realm:h}=L(),x=N(),V=/^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$/,s=!!a.match(V),m=!!$(Y.path),M=()=>m?Z({realm:h,id:r,tab:"mappers"}):_({realm:h,clientId:r,tab:"mappers"});z(async()=>{let e;if(s){if(m?e=await i.clientScopes.findProtocolMapper({id:r,mapperId:a}):e=await i.clients.findProtocolMapperById({id:r,mapperId:a}),!e)throw new Error(t("common:notFound"));const p=x.protocolMapperTypes[e.protocol].find(c=>c.id===e.protocolMapper);return{config:{protocol:e.protocol,protocolMapper:e.protocolMapper},mapping:p,data:e}}else{const n=m?await i.clientScopes.findOne({id:r}):await i.clients.findOne({id:r});if(!n)throw new Error(t("common:notFound"));const c=x.protocolMapperTypes[n.protocol].find(K=>K.id===a);if(!c)throw new Error(t("common:notFound"));return{mapping:c,config:{protocol:n.protocol,protocolMapper:a}}}},({config:e,mapping:n,data:p})=>{D(e),C(n),p&&eo(p,b)},[]);const[E,O]=to({titleKey:"common:deleteMappingTitle",messageKey:"common:deleteMappingConfirm",continueButtonLabel:"common:delete",continueButtonVariant:H.danger,onConfirm:async()=>{try{m?await i.clientScopes.delProtocolMapper({id:r,mapperId:a}):await i.clients.delProtocolMapper({id:r,mapperId:a}),u(t("common:mappingDeletedSuccess"),w.success),A(M())}catch(e){f("common:mappingDeletedError",e)}}}),B=async e=>{const n=s?"Updated":"Created";try{const p={...P,...oo(e)};s?m?await i.clientScopes.updateProtocolMapper({id:r,mapperId:a},{id:a,...p}):await i.clients.updateProtocolMapper({id:r,mapperId:a},{id:a,...p}):m?await i.clientScopes.addProtocolMapper({id:r},p):await i.clients.addProtocolMapper({id:r},p),u(t(`common:mapping${n}Success`),w.success)}catch(p){f(`common:mapping${n}Error`,p)}};return o.jsxs(o.Fragment,{children:[o.jsx(O,{}),o.jsx(po,{titleKey:s?d?.name:t("common:addMapper"),subKey:s?a:"client-scopes:addMapperExplain",dropdownItems:s?[o.jsx(U,{value:"delete",onClick:E,children:t("common:delete")},"delete")]:void 0}),o.jsx(W,{variant:"light",children:o.jsxs(ao,{isHorizontal:!0,onSubmit:I(B),role:"manage-clients",children:[o.jsx(v,{label:t("common:mapperType"),fieldId:"mapperType",children:o.jsx(S,{type:"text",id:"mapperType",name:"mapperType",isReadOnly:!0,value:d?.name})}),o.jsx(v,{label:t("common:name"),labelIcon:o.jsx(J,{helpText:t("client-scopes-help:mapperName"),fieldLabelId:"name"}),fieldId:"name",isRequired:!0,validated:y.name?l.error:l.default,helperTextInvalid:t("common:required"),children:o.jsx(S,{id:"name",isReadOnly:s,validated:y.name?l.error:l.default,...T("name",{required:!0})})}),o.jsx(Q,{...g,children:o.jsx(ro,{properties:d?.properties||[],isNew:!s})}),o.jsxs(no,{children:[o.jsx(F,{variant:"primary",type:"submit",children:t("common:save")}),o.jsx(F,{variant:"link",component:e=>o.jsx(X,{...e,to:M()}),children:t("common:cancel")})]})]})})]})}export{oe as default};
//# sourceMappingURL=MappingDetails-96c79ed5.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy