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

theme.keycloak.v2.admin.resources.assets.MappingDetails-5cf61835.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-0cda761d.js";import{u as to}from"./ConfirmDialog-100e6a40.js";import{D as ro}from"./DynamicComponents-fe8010c1.js";import{F as ao}from"./FormAccess-835af982.js";import{K as S}from"./KeycloakTextInput-ada01047.js";import{V as po}from"./ViewHeader-ff389f8e.js";import{u as io}from"./useParams-bc47a968.js";import{A as no}from"./Form-4087ddae.js";import"./Modal-ea09312d.js";import"./ClientSelect-ab12f3f6.js";import"./Select-68736f55.js";import"./check-fc57dbe1.js";import"./star-icon-2ee5dfa7.js";import"./FileUpload-2469f593.js";import"./CodeEditor-781232a0.js";import"./copy-icon-b8d617db.js";import"./EmptyStateBody-f9d2c033.js";import"./EmptyStateSecondaryActions-e8364506.js";import"./GroupPickerDialog-9d38b823.js";import"./PaginatingTableToolbar-11bdf18a.js";import"./plus-circle-icon-fe78809e.js";import"./TableToolbar-470a2060.js";import"./ToolbarContent-fee3570e.js";import"./admin-ui-endpoint-f934fa67.js";import"./getAuthorizationHeaders-f2376d1a.js";import"./DataListItemRow-7ca17a45.js";import"./data-list-7d55714c.js";import"./grip-vertical-icon-ba7b06db.js";import"./ActionListItem-c859aeaf.js";import"./Flex-a3793595.js";import"./FlexItem-742749b8.js";import"./minus-circle-icon-ac3563ca.js";import"./MultiLineInput-05f00b93.js";import"./PasswordInput-bb06acaa.js";import"./useToggle-3764a2a4.js";import"./AddRoleMappingModal-71c36ce9.js";import"./useLocaleSort-ef2c79ac.js";import"./KeycloakDataTable-a1a2bfca.js";import"./Td-d9b96677.js";import"./Checkbox-3affa1d3.js";import"./resource-0803fa9b.js";import"./filter-icon-56a9cd24.js";import"./KeycloakTextArea-9049d04c.js";import"./GridItem-1535d986.js";import"./Text-b9444fb8.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-5cf61835.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy