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

theme.keycloak.v2.admin.resources.assets.NewRealmForm-1ffe7d94.js Maven / Gradle / Ivy

There is a newer version: 25.0.1
Show newest version
import{u as R,b as C,ca as F,db as w,d as k,r as y,e as A,j as e,P as S,F as o,C as E,S as I,B as m,y as T,g as V,z as q,bo as K}from"./index-f33eb656.js";import{F as N}from"./FormAccess-29b78a4e.js";import{J as z}from"./JsonFileUpload-9abe1d68.js";import{K as O}from"./KeycloakTextInput-e2751b88.js";import{V as B}from"./ViewHeader-5aaa6ccc.js";import{A as G}from"./Form-6c170f69.js";import"./copy-icon-c00ff2e0.js";import"./GridItem-8422f423.js";import"./FileUploadForm-88a2bfab.js";import"./FileUpload-df08e952.js";import"./CodeEditor-e0b9ac78.js";import"./EmptyStateBody-de699127.js";import"./EmptyStateSecondaryActions-7a33984f.js";import"./Modal-e76dd76f.js";import"./Text-83f5a4d7.js";import"./ToolbarContent-f1a19b22.js";function re(){const{t:a}=R("realm"),s=C(),{refresh:n,whoAmI:i}=F(),{refresh:c}=w(),{addAlert:d,addError:u}=k(),[p,h]=y.useState(),{register:f,handleSubmit:x,control:b,setValue:v,formState:{errors:l}}=A({mode:"onChange"}),g=r=>{const t={id:"",realm:"",enabled:!0};T(r||t,v),h(r||t)},j=async r=>{try{await V.realms.create({...p,...q(r)}),d(a("saveRealmSuccess")),n(),await c(),s(K({realm:r.realm}))}catch(t){u("realm:saveRealmError",t)}};return e.jsxs(e.Fragment,{children:[e.jsx(B,{titleKey:"realm:createRealm",subKey:"realm:realmExplain"}),e.jsx(S,{variant:"light",children:e.jsxs(N,{isHorizontal:!0,onSubmit:x(j),role:"view-realm",isReadOnly:!i.canCreateRealm(),children:[e.jsx(z,{id:"kc-realm-filename",allowEditingUploadedText:!0,onChange:g}),e.jsx(o,{label:a("realmName"),isRequired:!0,fieldId:"kc-realm-name",validated:l.realm?"error":"default",helperTextInvalid:l.realm?.message,children:e.jsx(O,{isRequired:!0,id:"kc-realm-name",validated:l.realm?"error":"default",...f("realm",{required:{value:!0,message:a("common:required")},pattern:{value:/^[a-zA-Z0-9-_]+$/,message:a("invalidRealmName")}})})}),e.jsx(o,{label:a("enabled"),fieldId:"kc-realm-enabled-switch",children:e.jsx(E,{name:"enabled",defaultValue:!0,control:b,render:({field:r})=>e.jsx(I,{id:"kc-realm-enabled-switch",name:"enabled",label:a("common:on"),labelOff:a("common:off"),isChecked:r.value,onChange:r.onChange,"aria-label":a("enabled")})})}),e.jsxs(G,{children:[e.jsx(m,{variant:"primary",type:"submit",children:a("common:create")}),e.jsx(m,{variant:"link",onClick:()=>s(-1),children:a("common:cancel")})]})]})})]})}export{re as default};
//# sourceMappingURL=NewRealmForm-1ffe7d94.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy