theme.keycloak.v2.admin.resources.assets.CustomProviderSettings-aEWuxIKA.js Maven / Gradle / Ivy
import{jsxs as l,jsx as e}from"react/jsx-runtime";import{a as I,aj as N,F as U,ac as v,ad as b,ae as P,a4 as C,x as f,u as V,d as j,g as E,f as H,c as D,b as O,v as _,P as L,A as z,h as F,L as G,dX as k,S as R,j as q,Q as B}from"./index-C1LIsRX7.js";import{D as Q}from"./DynamicComponents-CIZcko9u.js";import{F as W}from"./FormAccess-BcY70QlP.js";import{u as X}from"./useParams-n_2fXkN1.js";import{E as J}from"./ExtendedHeader-Ciknl9tt.js";import{S as K}from"./SettingsCache-M0OqK1Pn.js";import"react";import"react-dom";import"./ClientSelect-BTkwOwGP.js";import"./FileUpload-T43Q4AfB.js";import"./CodeEditor-CIeIZGz7.js";import"./copy-icon-DOS8MmN7.js";import"./EmptyStateFooter-Cm2IMTi1.js";import"./EmptyStateActions-DBSnfkAA.js";import"./GroupPickerDialog-DmX3SBxL.js";import"./PaginatingTableToolbar-CpMLQtqt.js";import"./DataListItemRow-COCiEHyF.js";import"./FlexItem-DCAd8FXq.js";import"./KeySelect-B2uWUd6C.js";import"./useToggle-K3Kx99tM.js";import"./MultiLineInput-AcwuO_FT.js";import"./AddRoleMappingModal-Ds4yp8lg.js";import"./KeycloakDataTable-jyvvxdb8.js";import"./Td-BwjBKSkH.js";import"./grip-vertical-icon-Bnn0MebT.js";import"./_baseFlatten-BHAcGTxk.js";import"./ConfirmDialog-B5qjiAuo.js";import"./filter-icon-BVyMUArZ.js";import"./ViewHeader-qjLr6U82.js";import"./isEqual-DmIBnf3S.js";const M=()=>{const{t:r}=I(),a=N(),{control:o,watch:t}=a,d=t("config.fullSyncPeriod","-1"),c=t("config.changedSyncPeriod","-1");return l(U,{...a,children:[e(v,{label:r("periodicFullSync"),labelIcon:e(b,{helpText:r("periodicFullSyncHelp"),fieldLabelId:"periodicFullSync"}),fieldId:"kc-periodic-full-sync",hasNoPaddingTop:!0,children:e(P,{name:"config.fullSyncPeriod",defaultValue:"-1",control:o,render:({field:n})=>e(C,{id:"kc-periodic-full-sync","data-testid":"periodic-full-sync",onChange:(m,s)=>{n.onChange(s?"604800":"-1")},isChecked:n.value!=="-1",label:r("on"),labelOff:r("off"),"aria-label":r("periodicFullSync")})})}),d!=="-1"&&e(f,{name:"config.fullSyncPeriod",label:r("fullSyncPeriod"),labelIcon:r("fullSyncPeriodHelp"),type:"number",min:-1,defaultValue:"604800"}),e(v,{label:r("periodicChangedUsersSync"),labelIcon:e(b,{helpText:r("periodicChangedUsersSyncHelp"),fieldLabelId:"periodicChangedUsersSync"}),fieldId:"kc-periodic-changed-users-sync",hasNoPaddingTop:!0,children:e(P,{name:"config.changedSyncPeriod",defaultValue:"-1",control:o,render:({field:n})=>e(C,{id:"kc-periodic-changed-users-sync","data-testid":"periodic-changed-users-sync",onChange:(m,s)=>{n.onChange(s?"86400":"-1")},isChecked:n.value!=="-1",label:r("on"),labelOff:r("off"),"aria-label":r("periodicChangedUsersSync")})})}),c!=="-1"&&e(f,{name:"config.changedSyncPeriod",label:r("changedUsersSyncPeriod"),labelIcon:r("changedUsersSyncHelp"),type:"number",min:-1,defaultValue:"86400"})]})};function Ae(){const{adminClient:r}=V(),{t:a}=I(),{id:o,providerId:t}=X(),d=j(),c=E({mode:"onChange"}),{reset:n,setValue:m,handleSubmit:s,formState:{isDirty:w}}=c,{addAlert:A,addError:T}=H(),{realm:y,realmRepresentation:x}=D(),h=(O().componentTypes?.["org.keycloak.storage.UserStorageProvider"]||[]).find(i=>i.id===t);_(async()=>{if(o)return await r.components.findOne({id:o})},i=>{if(i)B(i,m);else if(o)throw new Error(a("notFound"))},[]);const g=async i=>{const S=R({...i,config:Object.fromEntries(Object.entries(i.config||{}).map(([p,u])=>[p,Array.isArray(u)?u:[u]])),providerId:t,providerType:"org.keycloak.storage.UserStorageProvider",parentId:x?.id});try{o?await r.components.update({id:o},S):(await r.components.create(S),d(k({realm:y}))),n({...i}),A(a(o?"userProviderSaveSuccess":"createUserProviderSuccess"),q.success)}catch(p){T(o?"userProviderSaveError":"createUserProviderError",p)}};return l(U,{...c,children:[e(J,{provider:t,save:()=>s(g)()}),e(L,{variant:"light",children:l(W,{role:"manage-realm",isHorizontal:!0,className:"keycloak__user-federation__custom-form",onSubmit:s(g),children:[e(f,{name:"name",label:a("uiDisplayName"),labelIcon:a("uiDisplayNameHelp"),rules:{required:a("validateName")}}),e(Q,{properties:h?.properties||[]}),h?.metadata.synchronizable&&e(M,{}),e(K,{form:c,unWrap:!0}),l(z,{children:[e(F,{isDisabled:!w,variant:"primary",type:"submit","data-testid":"custom-save",children:a("save")}),e(F,{variant:"link",component:i=>e(G,{...i,to:k({realm:y})}),"data-testid":"custom-cancel",children:a("cancel")})]})]})})]})}export{Ae as default};
//# sourceMappingURL=CustomProviderSettings-aEWuxIKA.js.map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy