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

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

import{jsxs as h,jsx as e,Fragment as T}from"react/jsx-runtime";import{useState as C}from"react";import{u as v,a as D,f as E,b3 as R,P as I,ac as x,ad as P,a4 as F,ar as L,j as b,d as O,v as j,a3 as k,aF as g,bQ as w}from"./index-C1LIsRX7.js";import{M as H}from"./MapperList-BvJ2XhLk.js";import{R as K,u as N}from"./RoutableTabs-j5CUH0-6.js";import{V}from"./ViewHeader-qjLr6U82.js";import{u as z}from"./useParams-n_2fXkN1.js";import{F as G}from"./FormAccess-BcY70QlP.js";import{R as B}from"./AddRoleMappingModal-Ds4yp8lg.js";import{a as y,b as M}from"./Tabs-CNBvRApH.js";import"react-dom";import"./PaginatingTableToolbar-CpMLQtqt.js";import"./EmptyStateFooter-Cm2IMTi1.js";import"./EmptyStateActions-DBSnfkAA.js";import"./KeycloakDataTable-jyvvxdb8.js";import"./Td-BwjBKSkH.js";import"./grip-vertical-icon-Bnn0MebT.js";import"./_baseFlatten-BHAcGTxk.js";import"./DataListItemRow-COCiEHyF.js";import"./PageHandler-CFMh3rCu.js";import"./DynamicComponents-CIZcko9u.js";import"./ClientSelect-BTkwOwGP.js";import"./FileUpload-T43Q4AfB.js";import"./CodeEditor-CIeIZGz7.js";import"./copy-icon-DOS8MmN7.js";import"./GroupPickerDialog-DmX3SBxL.js";import"./FlexItem-DCAd8FXq.js";import"./KeySelect-B2uWUd6C.js";import"./useToggle-K3Kx99tM.js";import"./MultiLineInput-AcwuO_FT.js";import"./PageList-D9zZFEpa.js";import"./ConfirmDialog-B5qjiAuo.js";import"./filter-icon-BVyMUArZ.js";const Q=({client:p})=>{const{adminClient:s}=v(),{t:r}=D(),{addAlert:l,addError:m}=E(),[t,f]=C(p),{hasAccess:i}=R(),u=i("manage-clients")||t.access?.manage,S=async c=>{try{const n=c.filter(a=>a.client===void 0).map(a=>a.role).flat();await Promise.all([s.clients.addRealmScopeMappings({id:t.id},n),...c.filter(a=>a.client!==void 0).map(a=>s.clients.addClientScopeMappings({id:t.id,client:a.client.id},[a.role]))]),l(r("clientScopeSuccess"),b.success)}catch(n){m("clientScopeError",n)}},A=async()=>{const c={...t,fullScopeAllowed:!t.fullScopeAllowed};try{await s.clients.update({id:t.id},c),l(r("clientScopeSuccess"),b.success),f(c)}catch(n){m("clientScopeError",n)}};return h(I,{children:[e(G,{role:"manage-clients",fineGrainedAccess:t.access?.manage,isHorizontal:!0,children:e(x,{hasNoPaddingTop:!0,label:r("fullScopeAllowed"),labelIcon:e(P,{helpText:r("fullScopeAllowedHelp"),fieldLabelId:"fullScopeAllowed"}),fieldId:"fullScopeAllowed",children:e(F,{id:"fullScopeAllowed",label:r("on"),labelOff:r("off"),isChecked:t.fullScopeAllowed,onChange:A,"aria-label":r("fullScopeAllowed")})})}),!t.fullScopeAllowed&&h(T,{children:[e(L,{}),e(B,{name:t.clientId,id:t.id,type:"clients",save:S,isManager:u})]})]})};function Ce(){const{adminClient:p}=v(),{t:s}=D(),r=O(),{realm:l,clientId:m}=z(),{addAlert:t,addError:f}=E(),[i,u]=C();j(()=>p.clients.findOne({id:m}),u,[]);const S=o=>N(g({realm:l,clientId:m,tab:o})),A=S("mappers"),c=S("scope");if(!i)return e(k,{});const n=async o=>{if(Array.isArray(o))try{await p.clients.addMultipleProtocolMappers({id:i.id},o),u(await p.clients.findOne({id:i.id})),t(s("mappingCreatedSuccess"),b.success)}catch(d){f("mappingCreatedError",d)}else{const d=o;r(w({realm:l,id:i.id,mapperId:d.id}))}},a=async o=>{try{await p.clients.delProtocolMapper({id:i.id,mapperId:o.id}),u({...i,protocolMappers:i.protocolMappers?.filter(d=>d.id!==o.id)}),t(s("mappingDeletedSuccess"),b.success)}catch(d){f("mappingDeletedError",d)}return!0};return h(T,{children:[e(V,{titleKey:i.clientId+"-dedicated",subKey:"dedicatedScopeExplain",divider:!1}),e(I,{variant:"light",className:"pf-v5-u-p-0",children:h(K,{isBox:!0,mountOnEnter:!0,defaultLocation:g({realm:l,clientId:m,tab:"mappers"}),children:[e(y,{title:e(M,{children:s("mappers")}),"data-testid":"mappersTab",...A,children:e(H,{model:i,onAdd:n,onDelete:a,detailLink:o=>w({realm:l,id:i.id,mapperId:o})})}),e(y,{title:e(M,{children:s("scope")}),"data-testid":"scopeTab",...c,children:e(Q,{client:i})})]})})]})}export{Ce as default};
//# sourceMappingURL=DedicatedScopes-Ceq3knF5.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy