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

theme.keycloak.v2.admin.resources.assets.DedicatedScopes-42153905.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-f33eb656.js";import{M as K}from"./MapperList-205d87fc.js";import{R as L,u as O}from"./RoutableTabs-8ba6475e.js";import{V as k}from"./ViewHeader-5aaa6ccc.js";import{u as N}from"./useParams-74754a7c.js";import{F as V}from"./FormAccess-29b78a4e.js";import{R as G}from"./AddRoleMappingModal-d36df11e.js";import{a as A,b as j}from"./Tabs-5aebe4ec.js";import"./PaginatingTableToolbar-2e41cd99.js";import"./plus-circle-icon-2ea0b4ed.js";import"./EmptyStateBody-de699127.js";import"./EmptyStateSecondaryActions-7a33984f.js";import"./TableToolbar-8e38cfad.js";import"./ToolbarContent-f1a19b22.js";import"./Form-6c170f69.js";import"./KeycloakDataTable-82a4b6c2.js";import"./Td-137060bd.js";import"./star-icon-d7615f00.js";import"./check-fc57dbe1.js";import"./grip-vertical-icon-90ec69d5.js";import"./Checkbox-8826c1eb.js";import"./Modal-e76dd76f.js";import"./useLocaleSort-22b9cad8.js";import"./Text-83f5a4d7.js";import"./DataListItemRow-c0c554d3.js";import"./data-list-7d55714c.js";import"./copy-icon-c00ff2e0.js";import"./GridItem-8422f423.js";import"./ConfirmDialog-cc2aa7b4.js";import"./resource-db8462e3.js";import"./admin-ui-endpoint-9ec5dfbd.js";import"./getAuthorizationHeaders-f2376d1a.js";import"./filter-icon-16b4a4ff.js";import"./plus-icon-6a98b80b.js";import"./MenuList-b32c7668.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-42153905.js.map




© 2015 - 2024 Weber Informatics LLC | Privacy Policy