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

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

import{jsxs as d,Fragment as B,jsx as p}from"react/jsx-runtime";import{useState as h}from"react";import{u as O,a as k,f as K,g as j,d as G,c as H,b as L,aD as N,w as $,B as q,k as v,D as z,P as R,F as U,ac as Q,am as J,y as W,A as X,i as F,L as Y,aE as Z,az as _,aF as ee,S as oe,Q as te}from"./main-C7ps2lmX.js";import{u as ae}from"./ConfirmDialog-hx7XKLbN.js";import{D as re}from"./DynamicComponents-DvaX3FJx.js";import{F as pe}from"./FormAccess-DyLNkc18.js";import{V as ie}from"./ViewHeader-B7eeFzFA.js";import{u as ne}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 Ke(){const{adminClient:i}=O(),{t:o}=k(),{addAlert:u,addError:f}=K(),{id:t,mapperId:a}=ne(),g=j(),{setValue:S,handleSubmit:D}=g,[m,T]=h(),[b,C]=h(),P=G(),{realm:y}=H(),M=L(),A=/^[{]?[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}[}]?$/,s=!!a.match(A),c=!!N(Z.path),w=()=>c?_({realm:y,id:t,tab:"mappers"}):ee({realm:y,clientId:t,tab:"mappers"});$(async()=>{let e;if(s){if(c?e=await i.clientScopes.findProtocolMapper({id:t,mapperId:a}):e=await i.clients.findProtocolMapperById({id:t,mapperId:a}),!e)throw new Error(o("notFound"));const r=M.protocolMapperTypes[e.protocol].find(l=>l.id===e.protocolMapper);return{config:{protocol:e.protocol,protocolMapper:e.protocolMapper},mapping:r,data:e}}else{const n=c?await i.clientScopes.findOne({id:t}):await i.clients.findOne({id:t});if(!n)throw new Error(o("notFound"));const l=M.protocolMapperTypes[n.protocol].find(x=>x.id===a);if(!l)throw new Error(o("notFound"));return{mapping:l,config:{protocol:n.protocol,protocolMapper:a}}}},({config:e,mapping:n,data:r})=>{C(e),T(n),r&&te(r,S)},[]);const[I,V]=ae({titleKey:"deleteMappingTitle",messageKey:"deleteMappingConfirm",continueButtonLabel:"delete",continueButtonVariant:q.danger,onConfirm:async()=>{try{c?await i.clientScopes.delProtocolMapper({id:t,mapperId:a}):await i.clients.delProtocolMapper({id:t,mapperId:a}),u(o("mappingDeletedSuccess"),v.success),P(w())}catch(e){f("mappingDeletedError",e)}}}),E=async e=>{const n=s?"Updated":"Created";try{const r={...b,...oe(e)};s?c?await i.clientScopes.updateProtocolMapper({id:t,mapperId:a},{id:a,...r}):await i.clients.updateProtocolMapper({id:t,mapperId:a},{id:a,...r}):c?await i.clientScopes.addProtocolMapper({id:t},r):await i.clients.addProtocolMapper({id:t},r),u(o(`mapping${n}Success`),v.success)}catch(r){f(`mapping${n}Error`,r)}};return d(B,{children:[p(V,{}),p(ie,{titleKey:s?m?.name:o("addMapper"),subKey:s?a:"addMapperExplain",dropdownItems:s?[p(z,{value:"delete",onClick:I,children:o("delete")},"delete")]:void 0}),p(R,{variant:"light",children:p(U,{...g,children:d(pe,{isHorizontal:!0,onSubmit:D(E),role:"manage-clients",children:[p(Q,{label:o("mapperType"),fieldId:"mapperType",children:p(J,{type:"text",id:"mapperType",name:"mapperType",readOnlyVariant:"default",value:m?.name})}),p(W,{name:"name",label:o("name"),labelIcon:o("mapperNameHelp"),readOnlyVariant:s?"default":void 0,rules:{required:{value:!0,message:o("required")}}}),p(re,{properties:m?.properties||[],isNew:!s}),d(X,{children:[p(F,{variant:"primary",type:"submit",children:o("save")}),p(F,{variant:"link",component:e=>p(Y,{...e,to:w()}),children:o("cancel")})]})]})})})]})}export{Ke as default};
//# sourceMappingURL=MappingDetails-FsZeCvYK.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy