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

theme.keycloak.v2.admin.resources.assets.LdapMapperDetails-DzbSqiQ5.js Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
import{jsx as a,jsxs as k,Fragment as B}from"react/jsx-runtime";import{u as N,g as G,d as U,c as z,a as R,f as $,w as Q,B as W,k as V,ek as L,ab as J,a3 as X,D as I,P as Y,F as Z,y as v,ac as _,ad as ee,ae,b5 as re,b6 as te,U as oe,A as ne,i as M,Q as pe,S as se}from"./main-C7ps2lmX.js";import{useState as y}from"react";import{u as ie}from"./ConfirmDialog-hx7XKLbN.js";import{c as de,D as le}from"./DynamicComponents-DvaX3FJx.js";import{F as ce}from"./FormAccess-DyLNkc18.js";import{V as me}from"./ViewHeader-B7eeFzFA.js";import{u as ue}from"./useParams-B67lSY02.js";import"react-dom";import"./ClientSelect-B9UqjyP6.js";import"./FileUpload-CumNwlWc.js";import"./CodeEditor-C-nZkUJx.js";import"./copy-icon-ACZmDH8e.js";import"./EmptyStateFooter-DqmBOP2I.js";import"./EmptyStateActions-DWNUFByn.js";import"./GroupPickerDialog-C09EjRTA.js";import"./PaginatingTableToolbar-Cjsz5Jh4.js";import"./DataListItemRow-BC0LurDd.js";import"./FlexItem-BzZfUnQ1.js";import"./KeySelect-jKxsKqdI.js";import"./useToggle-K3Kx99tM.js";import"./MultiLineInput-DiPNQ1LE.js";import"./AddRoleMappingModal-DW8o4W0z.js";import"./KeycloakDataTable-DbY4la1D.js";import"./Td-D2hVFK0Z.js";import"./grip-vertical-icon-BxF7V59o.js";import"./_baseFlatten-eIEJR-AJ.js";import"./filter-icon-DO0QNij3.js";function Ge(){const{adminClient:l}=N(),p=G(),[i,P]=y(),[c,x]=y(),{id:f,mapperId:o}=ue(),m=U(),{realm:g}=z(),{t:e}=R(),{addAlert:h,addError:b}=$(),[w,D]=y(!1),[F,K]=y(0),O=()=>K(F+1);Q(async()=>{const t=await l.components.listSubComponents({id:f,type:"org.keycloak.storage.ldap.mappers.LDAPStorageMapper"});if(o&&o!=="new"){const r=await l.components.findOne({id:o});return{components:t,fetchedMapper:r}}return{components:t}},({components:t,fetchedMapper:r})=>{if(P(r),x(t),o!=="new"&&!r)throw new Error(e("notFound"));r&&S(r)},[]);const S=t=>{pe(t,p.setValue)},E=async t=>{const r=se(t),n={...r,config:Object.entries(r.config||{}).reduce((u,[j,T])=>(u[j]=Array.isArray(T)?T:[T],u),{})};try{o==="new"?(await l.components.create(n),m(L({realm:g,id:t.parentId,tab:"mappers"}))):await l.components.update({id:o},n),S(n),h(e(o==="new"?"mappingCreatedSuccess":"mappingUpdatedSuccess"),V.success)}catch(u){b(o==="new"?"mappingCreatedError":"mappingUpdatedError",u)}},C=async t=>{try{const r=await l.userStorageProvider.mappersSync({parentId:i?.parentId||"",id:o,direction:t});h(e("syncLDAPGroupsSuccessful",{result:r.status}))}catch(r){b("syncLDAPGroupsError",r)}O()},[q,H]=ie({titleKey:"deleteMappingTitle",messageKey:"deleteMappingConfirm",continueButtonLabel:"delete",continueButtonVariant:W.danger,onConfirm:async()=>{try{await l.components.del({id:i.id}),h(e("mappingDeletedSuccess"),V.success),m(L({id:f,realm:g,tab:"mappers"}))}catch(t){b("mappingDeletedError",t)}}}),A=J({control:p.control,name:"providerId"});if(!c)return a(X,{});const d=o==="new",s=c.find(t=>t.id===A);return k(B,{children:[a(H,{}),a(me,{titleKey:i?i.name:e("createNewMapper"),dropdownItems:d?void 0:[a(I,{onClick:q,children:e("delete")},"delete"),...s?.metadata.fedToKeycloakSyncSupported?[a(I,{onClick:()=>C("fedToKeycloak"),children:e(s.metadata.fedToKeycloakSyncMessage)},"fedSync")]:[],...s?.metadata.keycloakToFedSyncSupported?[a(I,{onClick:()=>{C("keycloakToFed")},children:e(s.metadata.keycloakToFedSyncMessage)},"ldapSync")]:[]]},F),a(Y,{variant:"light",isFilled:!0,children:a(Z,{...p,children:k(ce,{role:"manage-realm",isHorizontal:!0,onSubmit:p.handleSubmit(()=>E(p.getValues())),children:[!d&&a(v,{name:"id",label:e("id"),isDisabled:!0}),a(v,{name:"name",label:e("name"),labelIcon:e("mapperNameHelp"),isDisabled:!d,rules:{required:e("required")}}),a("input",{type:"hidden",defaultValue:d?f:i?i.parentId:"","data-testid":"ldap-mapper-parentId",...p.register("parentId")}),a("input",{type:"hidden",defaultValue:"org.keycloak.storage.ldap.mappers.LDAPStorageMapper","data-testid":"ldap-mapper-provider-type",...p.register("providerType")}),d?a(_,{label:e("mapperType"),labelIcon:a(ee,{helpText:s?.helpText?s.helpText:e("mapperTypeHelp"),fieldLabelId:"mapperType"}),fieldId:"kc-providerId",isRequired:!0,children:a(ae,{name:"providerId",defaultValue:"",control:p.control,"data-testid":"ldap-mapper-type-select",render:({field:t})=>a(re,{toggleId:"kc-providerId",typeAheadAriaLabel:e("mapperType"),onToggle:()=>D(!w),isOpen:w,onSelect:r=>{S({providerId:r,...Object.fromEntries(c.find(n=>n.id===r)?.properties.filter(n=>n.type==="List").map(n=>[de(n.name),n.options?.[0]])||[])}),D(!1)},selections:t.value,variant:te.typeahead,"aria-label":e("selectMapperType"),children:c.map(r=>a(oe,{value:r.id,children:r.id},r.id))})})}):a(v,{name:"providerId",label:e("mapperType"),labelIcon:s?.helpText?s.helpText:e("mapperTypeHelp"),rules:{required:e("required")},isDisabled:!d}),!!A&&a(le,{properties:s?.properties}),k(ne,{children:[a(M,{isDisabled:!p.formState.isDirty,variant:"primary",type:"submit","data-testid":"ldap-mapper-save",children:e("save")}),a(M,{variant:"link",onClick:()=>m(d?-1:`/${g}/user-federation/ldap/${i.parentId}/mappers`),"data-testid":"ldap-mapper-cancel",children:e("cancel")})]})]})})})]})}export{Ge as default};
//# sourceMappingURL=LdapMapperDetails-DzbSqiQ5.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy