theme.keycloak.v2.admin.resources.assets.UserFederationSection-RuIP_XIR.js Maven / Gradle / Ivy
import{jsxs as D,jsx as e,Fragment as S}from"react/jsx-runtime";import*as B from"react";import{useState as f,useMemo as Z}from"react";import{_ as M,m as Q,eg as ee,o as ae,X as re,br as te,J as oe,K as se,aB as ne,N as ie,bs as V,L as le,Y as ce,p as de,u as A,a as E,f as K,M as me,q as pe,i as N,B as G,aa as I,Z as F,c as ue,d as he,b as ge,w as fe,D as L,eh as P,b2 as w,k as De,au as Ce,P as ve,$ as U,ak as ye,al as T,ca as be,ei as ke,ej as we,ek as Ie}from"./main-C7ps2lmX.js";import{u as Fe}from"./ConfirmDialog-hx7XKLbN.js";import{G as O,C as Se}from"./ClickableCard-ByX6UyJ7.js";import{F as Ne,a as x}from"./FlexItem-BzZfUnQ1.js";import{V as Le}from"./ViewHeader-B7eeFzFA.js";import{s as Pe}from"./sortBy-DtY8l0cj.js";import{c as Ue,d as Te,a as Oe,b as xe,D as Be}from"./Droppable-BQdKpouo.js";import{d as Me,D as Ve,a as Ae,b as Ee,c as Ke}from"./DataListItemRow-BC0LurDd.js";import"react-dom";import"./_baseFlatten-eIEJR-AJ.js";import"./grip-vertical-icon-BxF7V59o.js";const $=n=>{var{children:r,className:i,component:t="div"}=n,l=M(n,["children","className","component"]);const s=t;return B.createElement(s,Object.assign({className:Q(ee.cardFooter,i)},l),r)};$.displayName="CardFooter";const j=n=>{var{children:r=null,component:i="div"}=n,t=M(n,["children","component"]);const l=i;return B.createElement(l,Object.assign({},t),r)};j.displayName="GalleryItem";const Ge={name:"DatabaseIcon",height:512,width:448,svgPath:"M448 73.143v45.714C448 159.143 347.667 192 224 192S0 159.143 0 118.857V73.143C0 32.857 100.333 0 224 0s224 32.857 224 73.143zM448 176v102.857C448 319.143 347.667 352 224 352S0 319.143 0 278.857V176c48.125 33.143 136.208 48.572 224 48.572S399.874 209.143 448 176zm0 160v102.857C448 479.143 347.667 512 224 512S0 479.143 0 438.857V336c48.125 33.143 136.208 48.572 224 48.572S399.874 369.143 448 336z",yOffset:0,xOffset:0},$e=ae(Ge),je=({title:n,dropdownItems:r,labelText:i,labelColor:t,footerText:l,to:s})=>{const[c,p]=f(!1),d=()=>{p(!c)};return D(re,{isSelectable:!0,isClickable:!0,children:[e(te,{actions:{actions:r?e(oe,{popperProps:{position:"right"},onOpenChange:d,toggle:C=>e(se,{ref:C,onClick:d,variant:"plain","data-testid":`${n}-dropdown`,children:e(ne,{})}),isOpen:c,children:e(ie,{children:r})}):void 0,hasNoOffset:!1,className:void 0},children:e(V,{"data-testid":"keycloak-card-title",children:e(le,{to:s,children:n})})}),e(ce,{}),e($,{children:D(Ne,{children:[e(x,{className:"keycloak--keycloak-card__footer",children:l&&l}),e(x,{children:i&&e(de,{color:t||"gray",children:i})})]})})]})},_e=({components:n,onClose:r})=>{const{adminClient:i}=A(),{t}=E(),{addAlert:l,addError:s}=K(),[c,p]=f(""),[d,C]=f(Pe(n,"config.priority","name").map(o=>o.name)),b=({index:o})=>(p(t("onDragStart",{item:d[o]})),!0),v=({index:o})=>{p(t("onDragMove",{item:d[o]}))},k=(o,m)=>{if(m){const u=[...d],[g]=u.splice(o.index,1);return u.splice(m.index,0,g),p(t("onDragFinish",{list:u})),C(u),!0}else return p(t("onDragCancel")),!1};return D(me,{variant:pe.small,title:t("managePriorityOrder"),isOpen:!0,onClose:r,actions:[e(N,{id:"modal-confirm",onClick:async()=>{const o=d.map((m,u)=>{const g=n.find(y=>y.name===m);return g.config.priority=[u.toString()],i.components.update({id:g.id},g)});try{await Promise.all(o),l(t("orderChangeSuccessUserFed"))}catch(m){s("orderChangeErrorUserFed",m)}r()},children:t("save")},"confirm"),e(N,{id:"modal-cancel",variant:G.link,onClick:r,children:t("cancel")},"cancel")],children:[e(I,{className:"pf-v5-u-pb-lg",children:e(F,{children:t("managePriorityInfo")})}),e(Ue,{onDrag:b,onDragMove:v,onDrop:k,children:e(Te,{hasNoWrapper:!0,children:e(Me,{"aria-label":t("manageOrderTableAria"),"data-testid":"manageOrderDataList",isCompact:!0,children:d.map(o=>e(Oe,{hasNoWrapper:!0,children:e(Ve,{"aria-label":o,id:o,children:D(Ae,{children:[e(xe,{children:e(Be,{"aria-label":t("dragHelp")})}),e(Ee,{dataListCells:[e(Ke,{"data-testid":o,children:o},o)]})]})})},o))})})}),e("div",{className:"pf-v5-screen-reader","aria-live":"assertive",children:c})]})};function ta(){const{adminClient:n}=A(),[r,i]=f(),{addAlert:t,addError:l}=K(),{t:s}=E(),{realm:c,realmRepresentation:p}=ue(),[d,C]=f(0),b=()=>C(new Date().getTime()),v=he(),[k,o]=f(!1),m=ge().componentTypes?.["org.keycloak.storage.UserStorageProvider"]||[];fe(async()=>{const a={parentId:p.id,type:"org.keycloak.storage.UserStorageProvider"};return n.components.find(a)},a=>{i(a)},[d]);const u=Z(()=>m.map(a=>e(L,{onClick:()=>v(P({realm:c,providerId:a.id})),children:a.id.toUpperCase()=="LDAP"?a.id.toUpperCase():w(a.id)},a.id)),[]),g={variant:"link",onClick:()=>o(!0),lowerButtonTitle:s("managePriorities")};let y;const[_,z]=f(""),[R,H]=Fe({titleKey:s("userFedDeleteConfirmTitle"),messageKey:s("userFedDeleteConfirm"),continueButtonLabel:"delete",continueButtonVariant:G.danger,onConfirm:async()=>{try{await n.components.del({id:_}),b(),t(s("userFedDeletedSuccess"),De.success)}catch(a){l("userFedDeleteError",a)}}}),W=a=>{z(a),R()},q=(a,h)=>{const X=`${a.name}`,Y=`${h.name}`;return X{switch(a){case"ldap":return Ie({realm:c,id:h});case"kerberos":return we({realm:c,id:h});default:return ke({realm:c,providerId:a,id:h})}};return r&&(y=r.sort(q).map((a,h)=>e(j,{className:"keycloak-admin--user-federation__gallery-item",children:e(je,{to:J(a.providerId,a.id),dropdownItems:[e(L,{onClick:()=>{W(a.id)},"data-testid":"card-delete",children:s("delete")},`${h}-cardDelete`)],title:a.name,footerText:w(a.providerId),labelText:a.config?.enabled?.[0]!=="false"?s("enabled"):s("disabled"),labelColor:a.config?.enabled?.[0]!=="false"?"blue":"gray"})},h))),D(S,{children:[e(H,{}),k&&r&&e(_e,{onClose:()=>o(!1),components:r.filter(a=>a.config?.enabled)}),e(Le,{titleKey:"userFederation",subKey:"userFederationExplain",helpUrl:Ce.userFederationUrl,...r&&r.length>0?{lowerDropdownItems:u,lowerDropdownMenuTitle:"addNewProvider",lowerButton:g}:{}}),e(ve,{children:r&&r.length>0?e(O,{hasGutter:!0,children:y}):D(S,{children:[e(I,{children:e(F,{component:U.p,children:s("getStarted")})}),e(I,{children:e(F,{className:"pf-v5-u-mt-lg",component:U.h2,children:s("providers")})}),e("hr",{className:"pf-v5-u-mb-lg"}),e(O,{hasGutter:!0,children:m.map(a=>e(Se,{onClick:()=>v(P({realm:c,providerId:a.id})),"data-testid":`${a.id}-card`,children:e(V,{children:D(ye,{hasGutter:!0,children:[e(T,{children:e(be,{size:"lg",children:e($e,{})})}),e(T,{isFilled:!0,children:s("addProvider",{provider:w(a.id),count:4})})]})})},a.id))})]})})]})}export{ta as default};
//# sourceMappingURL=UserFederationSection-RuIP_XIR.js.map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy