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

theme.keycloak.v2.admin.resources.assets.DedicatedScopes-354bd07c.js Maven / Gradle / Ivy

There is a newer version: 25.0.1
Show newest version
import{u as w,d as M,r as y,au as E,j as e,P as T,F as C,h as R,S as v,X as D,g as p,A as h,b as I,q as F,K as P,aM as b,b6 as g}from"./index-0cda761d.js";import{M as K}from"./MapperList-58acf988.js";import{R as L,u as O}from"./RoutableTabs-56121a9c.js";import{V as k}from"./ViewHeader-ff389f8e.js";import{u as N}from"./useParams-bc47a968.js";import{F as V}from"./FormAccess-835af982.js";import{R as G}from"./AddRoleMappingModal-71c36ce9.js";import{a as A,b as j}from"./Tabs-76c5b0e3.js";import"./PaginatingTableToolbar-11bdf18a.js";import"./plus-circle-icon-fe78809e.js";import"./EmptyStateBody-f9d2c033.js";import"./EmptyStateSecondaryActions-e8364506.js";import"./TableToolbar-470a2060.js";import"./ToolbarContent-fee3570e.js";import"./Form-4087ddae.js";import"./KeycloakDataTable-a1a2bfca.js";import"./Td-d9b96677.js";import"./star-icon-2ee5dfa7.js";import"./check-fc57dbe1.js";import"./grip-vertical-icon-ba7b06db.js";import"./Checkbox-3affa1d3.js";import"./Modal-ea09312d.js";import"./useLocaleSort-ef2c79ac.js";import"./Text-b9444fb8.js";import"./DataListItemRow-7ca17a45.js";import"./data-list-7d55714c.js";import"./copy-icon-b8d617db.js";import"./GridItem-1535d986.js";import"./ConfirmDialog-100e6a40.js";import"./resource-0803fa9b.js";import"./admin-ui-endpoint-f934fa67.js";import"./getAuthorizationHeaders-f2376d1a.js";import"./filter-icon-56a9cd24.js";import"./plus-icon-4f91635d.js";import"./MenuList-7fad6760.js";const H=({client:d})=>{const{t:a}=w("clients"),{addAlert:r,addError:m}=M(),[t,f]=y.useState(d),{hasAccess:s}=E(),u=s("manage-clients")||t.access?.manage,S=async c=>{try{const l=c.filter(i=>i.client===void 0).map(i=>i.role).flat();await Promise.all([p.clients.addRealmScopeMappings({id:t.id},l),...c.filter(i=>i.client!==void 0).map(i=>p.clients.addClientScopeMappings({id:t.id,client:i.client.id},[i.role]))]),r(a("clientScopeSuccess"),h.success)}catch(l){m("clients:clientScopeError",l)}},x=async()=>{const c={...t,fullScopeAllowed:!t.fullScopeAllowed};try{await p.clients.update({id:t.id},c),r(a("clientScopeSuccess"),h.success),f(c)}catch(l){m("clients:clientScopeError",l)}};return e.jsxs(T,{children:[e.jsx(V,{role:"manage-clients",fineGrainedAccess:t.access?.manage,isHorizontal:!0,children:e.jsx(C,{hasNoPaddingTop:!0,label:a("fullScopeAllowed"),labelIcon:e.jsx(R,{helpText:a("clients-help:fullScopeAllowed"),fieldLabelId:"clients:fullScopeAllowed"}),fieldId:"fullScopeAllowed",children:e.jsx(v,{id:"fullScopeAllowed",label:a("common:on"),labelOff:a("common:off"),isChecked:t.fullScopeAllowed,onChange:x,"aria-label":a("fullScopeAllowed")})})}),!t.fullScopeAllowed&&e.jsxs(e.Fragment,{children:[e.jsx(D,{}),e.jsx(G,{name:t.clientId,id:t.id,type:"clients",save:S,isManager:u})]})]})};function Me(){const{t:d}=w("clients"),a=I(),{realm:r,clientId:m}=N(),{addAlert:t,addError:f}=M(),[s,u]=y.useState();F(()=>p.clients.findOne({id:m}),u,[]);const S=o=>O(b({realm:r,clientId:m,tab:o})),x=S("mappers"),c=S("scope");if(!s)return e.jsx(P,{});const l=async o=>{if(Array.isArray(o))try{await p.clients.addMultipleProtocolMappers({id:s.id},o),u(await p.clients.findOne({id:s.id})),t(d("common:mappingCreatedSuccess"),h.success)}catch(n){f("common:mappingCreatedError",n)}else{const n=o;a(g({realm:r,id:s.id,mapperId:n.id}))}},i=async o=>{try{await p.clients.delProtocolMapper({id:s.id,mapperId:o.id}),u({...s,protocolMappers:s.protocolMappers?.filter(n=>n.id!==o.id)}),t(d("common:mappingDeletedSuccess"),h.success)}catch(n){f("common:mappingDeletedError",n)}return!0};return e.jsxs(e.Fragment,{children:[e.jsx(k,{titleKey:s.clientId,subKey:"clients-help:dedicatedScopeExplain",divider:!1}),e.jsx(T,{variant:"light",className:"pf-u-p-0",children:e.jsxs(L,{isBox:!0,mountOnEnter:!0,defaultLocation:b({realm:r,clientId:m,tab:"mappers"}),children:[e.jsx(A,{title:e.jsx(j,{children:d("mappers")}),"data-testid":"mappersTab",...x,children:e.jsx(K,{model:s,onAdd:l,onDelete:i,detailLink:o=>g({realm:r,id:s.id,mapperId:o})})}),e.jsx(A,{title:e.jsx(j,{children:d("scope")}),"data-testid":"scopeTab",...c,children:e.jsx(H,{client:s})})]})})]})}export{Me as default};
//# sourceMappingURL=DedicatedScopes-354bd07c.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy