theme.keycloak.v2.admin.resources.assets.IdentityProvidersSection-BOmASsOa.js Maven / Gradle / Ivy
import{jsx as e,jsxs as p,Fragment as k}from"react/jsx-runtime";import{cj as J,cA as W,cB as q,u as j,a as K,f as M,v as V,a3 as X,M as Z,q as Q,h as L,B as E,aa as w,Z as x,b as Y,c as G,d as _,j as ee,au as ae,P as re,$ as N,bs as te,ak as ie,al as T,cC as ne,a2 as F,J as se,K as oe,N as de,bJ as le,L as ce,cx as me,bG as pe,cD as B,cE as ge,D as ue}from"./index-C1LIsRX7.js";import{useState as u,Fragment as he}from"react";import{u as fe}from"./ConfirmDialog-B5qjiAuo.js";import{G as ve,C as De}from"./ClickableCard-CcbdwzkE.js";import{K as ye}from"./KeycloakDataTable-jyvvxdb8.js";import{V as be}from"./ViewHeader-qjLr6U82.js";import{b as Ce,s as P}from"./sortBy-L-dz5MSQ.js";import{c as Pe,d as Ie,a as Oe,b as ke,D as Le}from"./Droppable-DrenVtJB.js";import{d as we,D as xe,a as Ke,b as Ae,c as Se}from"./DataListItemRow-COCiEHyF.js";import"react-dom";import"./PaginatingTableToolbar-CpMLQtqt.js";import"./EmptyStateFooter-Cm2IMTi1.js";import"./EmptyStateActions-DBSnfkAA.js";import"./Td-BwjBKSkH.js";import"./grip-vertical-icon-Bnn0MebT.js";import"./_baseFlatten-BHAcGTxk.js";function Ne(r,n,a,o){for(var d=-1,m=r==null?0:r.length;++d{const{adminClient:n}=j(),{t:a}=K(),{addAlert:o,addError:d}=M(),[m,l]=u(""),[D,y]=u(),[h,b]=u([]),C=({index:i})=>(l(a("onDragStart",{item:h[i]})),!0),f=({index:i})=>{l(a("onDragMove",{item:h[i]}))},I=(i,c)=>{if(c){const g=[...h],[v]=g.splice(i.index,1);return g.splice(c.index,0,v),l(a("onDragFinish",{list:g})),b(g),!0}else return l(a("onDragCancel")),!1};return V(()=>n.identityProviders.find(),i=>{y(i),b(P(i,["config.guiOrder","alias"]).map(c=>c.alias))},[]),D?p(Z,{variant:Q.small,title:a("manageDisplayOrder"),isOpen:!0,onClose:r,actions:[e(L,{id:"modal-confirm","data-testid":"confirm",onClick:async()=>{const i=h.map((c,g)=>{const v=D.find(O=>O.alias===c);return v.config.guiOrder=g,n.identityProviders.update({alias:c},v)});try{await Promise.all(i),o(a("orderChangeSuccess"))}catch(c){d("orderChangeError",c)}r()},children:a("save")},"confirm"),e(L,{id:"modal-cancel","data-testid":"cancel",variant:E.link,onClick:r,children:a("cancel")},"cancel")],children:[e(w,{className:"pf-v5-u-pb-lg",children:e(x,{children:a("orderDialogIntro")})}),e(Pe,{onDrag:C,onDragMove:f,onDrop:I,children:e(Ie,{hasNoWrapper:!0,children:e(we,{"aria-label":a("manageOrderTableAria"),"data-testid":"manageOrderDataList",isCompact:!0,children:h.map(i=>e(Oe,{hasNoWrapper:!0,children:e(xe,{"aria-label":i,id:i,children:p(Ke,{children:[e(ke,{children:e(Le,{"aria-label":a("dragHelp")})}),e(Ae,{dataListCells:[e(Se,{"data-testid":i,children:i},i)]})]})})},i))})})}),e("div",{className:"pf-v5-screen-reader","aria-live":"assertive",children:m})]}):e(X,{})},Ee=r=>{const{t:n}=K(),{realm:a}=G();return p(ce,{to:me({realm:a,providerId:r.providerId,alias:r.alias,tab:"settings"}),children:[r.displayName||r.alias,!r.enabled&&e(pe,{isRead:!0,className:"pf-v5-u-ml-sm",children:n("disabled")},`${r.providerId}-disabled`)]},r.providerId)};function ta(){const{adminClient:r}=j(),{t:n}=K(),a=Me(Y().identityProviders,"groupName"),{realm:o}=G(),d=_(),[m,l]=u(0),D=()=>l(m+1),[y,h]=u(!1),[b,C]=u(!1),[f,I]=u(!1),[i,c]=u(),{addAlert:g,addError:v}=M();V(async()=>r.identityProviders.find({max:1}),t=>{I(t.length===1)},[m]);const O=async(t,s,A)=>{const S={first:t,max:s};A&&(S.search=A);const z=await r.identityProviders.find(S);return P(z,["config.guiOrder","alias"])},R=t=>d(B({realm:o,providerId:t})),$=()=>Object.keys(a).map(t=>e(ge,{label:t,children:P(a[t],"name").map(s=>e(ue,{value:s.id,component:"a","data-testid":s.id,onClick:()=>d(B({realm:o,providerId:s.id})),children:s.name},s.id))},t)),[H,U]=fe({titleKey:"deleteProvider",messageKey:n("deleteConfirm",{provider:i?.alias}),continueButtonLabel:"delete",continueButtonVariant:E.danger,onConfirm:async()=>{try{await r.identityProviders.del({alias:i.alias}),D(),g(n("deletedSuccessIdentityProvider"),ee.success)}catch(t){v("deleteErrorIdentityProvider",t)}}});return p(k,{children:[e(U,{}),b&&e(Ve,{onClose:()=>{C(!1),D()}}),e(be,{titleKey:"identityProviders",subKey:"listExplain",helpUrl:ae.identityProvidersUrl}),p(re,{variant:f?"light":"default",className:f?"pf-v5-u-p-0":"",children:[!f&&p(k,{children:[e(w,{children:e(x,{component:N.p,children:n("getStarted")})}),Object.keys(a).map(t=>p(he,{children:[e(w,{children:p(x,{className:"pf-v5-u-mt-lg",component:N.h2,children:[t,":"]})}),e("hr",{className:"pf-v5-u-mb-lg"}),e(ve,{hasGutter:!0,children:P(a[t],"name").map(s=>e(De,{"data-testid":`${s.id}-card`,onClick:()=>R(s.id),children:e(te,{children:p(ie,{hasGutter:!0,children:[e(T,{children:e(ne,{icon:s.id})}),e(T,{isFilled:!0,children:s.name})]})})},s.id))})]},t))]}),f&&e(ye,{loader:O,isPaginated:!0,ariaLabelKey:"identityProviders",searchPlaceholderKey:"searchForProvider",toolbarItem:p(k,{children:[e(F,{children:e(se,{"data-testid":"addProviderDropdown",toggle:t=>e(oe,{ref:t,onClick:()=>h(!y),variant:"primary",children:n("addProvider")}),isOpen:y,children:e(de,{children:$()})})}),e(F,{children:e(L,{"data-testid":"manageDisplayOrder",variant:"link",onClick:()=>C(!0),children:n("manageDisplayOrder")})})]}),actions:[{title:n("delete"),onRowClick:t=>{c(t),H()}}],columns:[{name:"alias",displayKey:"name",cellRenderer:Ee},{name:"providerId",displayKey:"providerDetails",cellFormatters:[le()]},{name:"config['kc.org']",displayKey:"linkedOrganization",cellFormatters:[t=>t?"X":"—"]}]},m)]})]})}export{ta as default};
//# sourceMappingURL=IdentityProvidersSection-BOmASsOa.js.map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy