theme.keycloak.v2.admin.resources.assets.PageHandler-P2CRgucq.js Maven / Gradle / Ivy
import{jsx as t,jsxs as d}from"react/jsx-runtime";import{useState as F}from"react";import{u as j,a as k,g as w,c as C,f as E,w as O,P as R,r as x,F as D,A as _,i as f,L as B,t as H}from"./main-C7ps2lmX.js";import{D as I}from"./DynamicComponents-DvaX3FJx.js";import{u as L}from"./useParams-B67lSY02.js";import{TAB_PROVIDER as u}from"./PageList-s9OtSlkz.js";const J=({id:p,providerType:c,page:{id:o,...g}})=>{const{adminClient:r}=j(),{t:m}=k(),n=w(),{realm:h,realmRepresentation:P}=C(),{addAlert:y,addError:A}=E(),[i,S]=F(p),l=L();O(async()=>await Promise.all([i?r.components.findOne({id:i}):Promise.resolve(),c===u?r.components.find({type:u}):Promise.resolve()]),([e,a])=>{const s=(a||[]).find(v=>v.providerId===o);n.reset(e||s||{}),s&&S(s.id)},[]);const b=async e=>{(e.config||l)&&(e.config=Object.assign(e.config||{},l),Object.entries(e.config).forEach(([a,s])=>e.config[a]=Array.isArray(s)?s:[s]));try{const a={...e,providerId:o,providerType:c,parentId:P?.id};i?await r.components.update({id:i},a):await r.components.create(a),y("itemSaveSuccessful")}catch(a){A("itemSaveError",a)}};return t(R,{variant:"light",children:d(x,{isHorizontal:!0,onSubmit:n.handleSubmit(b),className:"keycloak__form",children:[t(D,{...n,children:t(I,{properties:g.properties})}),d(_,{children:[t(f,{"data-testid":"save",type:"submit",children:m("save")}),t(f,{variant:"link",component:e=>t(B,{...e,to:H({realm:h,providerId:o})}),children:m("cancel")})]})]})})};export{J as P};
//# sourceMappingURL=PageHandler-P2CRgucq.js.map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy