theme.keycloak.v2.admin.resources.assets.ImportForm-DYtBPLh5.js Maven / Gradle / Ivy
import{jsxs as i,Fragment as F,jsx as r}from"react/jsx-runtime";import{u as v,a as y,d as b,c as w,g as S,f as A,P as x,F as T,y as j,A as E,h as I,i as V,L as k,aQ as P,Q as L,a6 as O,a7 as H,a8 as N,S as U,k as $,aR as z}from"./main-C7ps2lmX.js";import{useState as D}from"react";import{F as K}from"./FormAccess-DyLNkc18.js";import{F as Q}from"./FileUploadForm-BgyzQxBE.js";import{V as R}from"./ViewHeader-B7eeFzFA.js";import{C as W,a as B}from"./ClientDescription-p94dy3yH.js";import{L as G}from"./CodeEditor-C-nZkUJx.js";import"react-dom";import"./copy-icon-ACZmDH8e.js";import"./FileUpload-CumNwlWc.js";import"./SwitchControl-C_9Y74oV.js";import"./EmptyStateFooter-DqmBOP2I.js";import"./EmptyStateActions-DWNUFByn.js";const J=a=>a.match(/(<.[^(><.)]+>)/g);function ce(){const{adminClient:a}=v(),{t:s}=y(),c=b(),{realm:o}=w(),n=S(),{handleSubmit:m,setValue:d,formState:p}=n,[u,h]=D({}),{addAlert:f,addError:l}=A(),g=async t=>{try{const e=await C(t);L(e,d),h(e)}catch(e){l("importParseError",e)}};async function C(t){if(!J(t))return JSON.parse(t);const e=await O(`${N(a.baseUrl)}admin/realms/${o}/client-description-converter`,{method:"POST",body:t,headers:H(await a.getAccessToken())});if(!e.ok)throw new Error(`Server responded with invalid status: ${e.statusText}`);return e.json()}return i(F,{children:[r(R,{titleKey:"importClient",subKey:"clientsExplain"}),r(x,{variant:"light",children:r(K,{isHorizontal:!0,onSubmit:m(async t=>{try{const e=await a.clients.create({...u,...U({...t,attributes:t.attributes||{}})});f(s("clientImportSuccess"),$.success),c(z({realm:o,clientId:e.id,tab:"settings"}))}catch(e){l("clientImportError",e)}}),role:"manage-clients",children:i(T,{...n,children:[r(Q,{id:"realm-file",language:G.json,extension:".json,.xml",helpText:s("helpFileUploadClient"),onChange:g}),r(W,{hasConfigureAccess:!0}),r(j,{name:"protocol",label:s("type"),readOnly:!0}),r(B,{unWrap:!0}),i(E,{children:[r(I,{formState:p,allowInvalid:!0,allowNonDirty:!0,children:s("save")}),r(V,{variant:"link",component:t=>r(k,{...t,to:P({realm:o})}),children:s("cancel")})]})]})})})]})}export{ce as default};
//# sourceMappingURL=ImportForm-DYtBPLh5.js.map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy