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

theme.keycloak.v2.admin.resources.assets.ScopeDetails-Cp1I1Sv6.js Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
import{jsxs as c,Fragment as I,jsx as a}from"react/jsx-runtime";import{useState as w}from"react";import{u as F,a as N,d as z,f as k,g as C,w as H,bB as l,D as U,P as B,F as P,y as d,A as V,i as m,B as x,L as E,k as T}from"./main-C7ps2lmX.js";import{F as j}from"./FormAccess-DyLNkc18.js";import{V as q}from"./ViewHeader-B7eeFzFA.js";import{u as L}from"./useParams-B67lSY02.js";import{u as G}from"./useToggle-K3Kx99tM.js";import{D as K}from"./DeleteScopeDialog-D5dmjsK7.js";import"react-dom";import"./copy-icon-ACZmDH8e.js";import"./ConfirmDialog-hx7XKLbN.js";function ee(){const{adminClient:n}=F(),{t:e}=N(),{id:o,scopeId:i,realm:s}=L(),p=z(),{addAlert:S,addError:b}=k(),[v,u]=G(),[r,h]=w(),g=C({mode:"onChange"}),{reset:f,handleSubmit:y}=g;H(async()=>{if(i){const t=await n.clients.getAuthorizationScope({id:o,scopeId:i});if(!t)throw new Error(e("notFound"));return t}},t=>{h(t),f({...t})},[]);const A=async t=>{try{i?(await n.clients.updateAuthorizationScope({id:o,scopeId:i},t),h(t)):(await n.clients.createAuthorizationScope({id:o},{name:t.name,displayName:t.displayName,iconUri:t.iconUri}),p(l({realm:s,clientId:o,tab:"scopes"}))),S(e((i?"update":"create")+"ScopeSuccess"),T.success)}catch(D){b("scopeSaveError",D)}};return c(I,{children:[a(K,{clientId:o,open:v,toggleDialog:u,selectedScope:r,refresh:()=>p(l({realm:s,clientId:o,tab:"scopes"}))}),a(q,{titleKey:i?r?.name:e("createAuthorizationScope"),dropdownItems:i?[a(U,{"data-testid":"delete-resource",onClick:()=>u(),children:e("delete")},"delete")]:void 0}),a(B,{variant:"light",children:a(P,{...g,children:c(j,{isHorizontal:!0,role:"manage-authorization",onSubmit:y(A),children:[a(d,{name:"name",label:e("name"),labelIcon:e("scopeNameHelp"),rules:{required:e("required")}}),a(d,{name:"displayName",label:e("displayName"),labelIcon:e("scopeDisplayNameHelp")}),a(d,{name:"iconUri",label:e("iconUri"),labelIcon:e("iconUriHelp")}),a(V,{children:c("div",{className:"pf-v5-u-mt-md",children:[a(m,{variant:x.primary,type:"submit","data-testid":"save",children:e("save")}),r?a(m,{variant:"link","data-testid":"revert",onClick:()=>f({...r}),children:e("revert")}):a(m,{variant:"link","data-testid":"cancel",component:t=>a(E,{...t,to:l({realm:s,clientId:o,tab:"scopes"})}),children:e("cancel")})]})})]})})})]})}export{ee as default};
//# sourceMappingURL=ScopeDetails-Cp1I1Sv6.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy