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

theme.keycloak.v2.admin.resources.assets.IdentityProvidersSection-BH7ACTgo.js Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
import{jsx as e,jsxs as p,Fragment as k}from"react/jsx-runtime";import{cj as W,cA as q,cB as J,u as M,a as x,f as V,w as j,a3 as X,M as Z,q as Q,i as L,B as E,aa as w,Z as K,b as Y,c as G,d as _,k 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,bK as le,L as ce,cx as me,bG as pe,cD as B,cE as ge,D as ue}from"./main-C7ps2lmX.js";import{useState as h,Fragment as he}from"react";import{u as fe}from"./ConfirmDialog-hx7XKLbN.js";import{G as ve,C as De}from"./ClickableCard-ByX6UyJ7.js";import{K as ye}from"./KeycloakDataTable-DbY4la1D.js";import{V as be}from"./ViewHeader-B7eeFzFA.js";import{b as Ce,s as P}from"./sortBy-DtY8l0cj.js";import{c as Pe,d as Oe,a as Ie,b as ke,D as Le}from"./Droppable-BQdKpouo.js";import{d as we,D as Ke,a as xe,b as Ae,c as Se}from"./DataListItemRow-BC0LurDd.js";import"react-dom";import"./PaginatingTableToolbar-Cjsz5Jh4.js";import"./EmptyStateFooter-DqmBOP2I.js";import"./EmptyStateActions-DWNUFByn.js";import"./Td-D2hVFK0Z.js";import"./grip-vertical-icon-BxF7V59o.js";import"./_baseFlatten-eIEJR-AJ.js";function Ne(r,n,a,o){for(var d=-1,m=r==null?0:r.length;++d{const{adminClient:n}=M(),{t:a}=x(),{addAlert:o,addError:d}=V(),[m,l]=h(""),[D,y]=h(),[g,b]=h([]),C=({index:i})=>(l(a("onDragStart",{item:g[i]})),!0),f=({index:i})=>{l(a("onDragMove",{item:g[i]}))},O=(i,c)=>{if(c){const u=[...g],[v]=u.splice(i.index,1);return u.splice(c.index,0,v),l(a("onDragFinish",{list:u})),b(u),!0}else return l(a("onDragCancel")),!1};return j(()=>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=g.map((c,u)=>{const v=D.find(I=>I.alias===c);return v.config.guiOrder=u,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(K,{children:a("orderDialogIntro")})}),e(Pe,{onDrag:C,onDragMove:f,onDrop:O,children:e(Oe,{hasNoWrapper:!0,children:e(we,{"aria-label":a("manageOrderTableAria"),"data-testid":"manageOrderDataList",isCompact:!0,children:g.map(i=>e(Ie,{hasNoWrapper:!0,children:e(Ke,{"aria-label":i,id:i,children:p(xe,{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}=x(),{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}=M(),{t:n}=x(),a=Ve(Y().identityProviders,"groupName"),{realm:o}=G(),d=_(),[m,l]=h(0),D=()=>l(m+1),[y,g]=h(!1),[b,C]=h(!1),[f,O]=h(!1),[i,c]=h(),{addAlert:u,addError:v}=V();j(async()=>r.identityProviders.find({max:1}),t=>{O(t.length===1)},[m]);const I=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(),u(n("deletedSuccessIdentityProvider"),ee.success)}catch(t){v("deleteErrorIdentityProvider",t)}}});return p(k,{children:[e(U,{}),b&&e(je,{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(K,{component:N.p,children:n("getStarted")})}),Object.keys(a).map(t=>p(he,{children:[e(w,{children:p(K,{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:I,isPaginated:!0,ariaLabelKey:"identityProviders",searchPlaceholderKey:"searchForProvider",toolbarItem:p(k,{children:[e(F,{children:e(se,{"data-testid":"addProviderDropdown",onOpenChange:t=>g(t),toggle:t=>e(oe,{ref:t,onClick:()=>g(!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-BH7ACTgo.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy