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

theme.keycloak.v2.admin.resources.assets.ClientsSection-21sxv367.js Maven / Gradle / Ivy

import{jsxs as c,Fragment as P,jsx as e}from"react/jsx-runtime";import{bE as se,u as M,a as f,f as F,c as g,d as Q,B as N,k as X,i as K,L as I,bF as W,b as re,s as oe,x as le,M as ce,q as de,e as Y,w as me,aT as Z,a2 as E,aS as H,ad as j,b3 as ee,au as ue,P as pe,aQ as _,bC as ye,aR as he,bG as fe,aC as te,bH as ge,bI as Ce,bJ as be}from"./main-C7ps2lmX.js";import{useState as L,useMemo as Te}from"react";import{u as V}from"./ConfirmDialog-hx7XKLbN.js";import{V as De,F as Ae}from"./ViewHeader-B7eeFzFA.js";import{R as ie,u as ne}from"./RoutableTabs-T8JTILEW.js";import{K as $}from"./KeycloakDataTable-DbY4la1D.js";import{L as Re}from"./PaginatingTableToolbar-Cjsz5Jh4.js";import{u as ke,F as U}from"./useFormatDate-X7HJ5iYO.js";import{$ as Ie,T as A,a0 as O}from"./Td-D2hVFK0Z.js";import{u as Le}from"./useToggle-K3Kx99tM.js";import{d as Ke,D as q,a as z,b as G,c as S}from"./DataListItemRow-BC0LurDd.js";import{a as R,b as k}from"./Tabs-CMdqT4Cg.js";import{i as Pe,g as ve}from"./utils-DeGqqWSp.js";import"react-dom";import"./PageHandler-P2CRgucq.js";import"./DynamicComponents-DvaX3FJx.js";import"./ClientSelect-B9UqjyP6.js";import"./FileUpload-CumNwlWc.js";import"./CodeEditor-C-nZkUJx.js";import"./copy-icon-ACZmDH8e.js";import"./EmptyStateFooter-DqmBOP2I.js";import"./EmptyStateActions-DWNUFByn.js";import"./GroupPickerDialog-C09EjRTA.js";import"./FlexItem-BzZfUnQ1.js";import"./KeySelect-jKxsKqdI.js";import"./MultiLineInput-DiPNQ1LE.js";import"./AddRoleMappingModal-DW8o4W0z.js";import"./filter-icon-DO0QNij3.js";import"./useParams-B67lSY02.js";import"./PageList-s9OtSlkz.js";import"./_baseFlatten-eIEJR-AJ.js";import"./grip-vertical-icon-BxF7V59o.js";const we=()=>({className:Ie.modifiers.wrap}),xe=({rootUrl:t,baseUrl:i},n)=>i?.startsWith("http")?i:t==="${authAdminUrl}"?t.replace(/\$\{(authAdminUrl)\}/,n.adminBaseUrl):t==="${authBaseUrl}"?t.replace(/\$\{(authBaseUrl)\}/,n.serverBaseUrl):t?.startsWith("http")?i?se(t,i):t:i,Be=()=>{const{adminClient:t}=M(),{t:i}=f(),{addAlert:n,addError:o}=F(),{realm:s}=g(),l=ke(),p=Q(),[d,a]=L(),y=async()=>{try{return await t.realms.getClientsInitialAccess({realm:s})}catch{return[]}},[h,C]=V({titleKey:"tokenDeleteConfirmTitle",messageKey:i("tokenDeleteConfirm",{id:d?.id}),continueButtonLabel:"delete",continueButtonVariant:N.danger,onConfirm:async()=>{try{await t.realms.delClientsInitialAccess({realm:s,id:d.id}),n(i("tokenDeleteSuccess"),X.success),a(void 0)}catch(r){o("tokenDeleteError",r)}}});return c(P,{children:[e(C,{}),e($,{ariaLabelKey:"initialAccessToken",searchPlaceholderKey:"searchInitialAccessToken",loader:y,toolbarItem:e(K,{component:r=>e(I,{...r,to:W({realm:s})}),children:i("create")}),actions:[{title:i("delete"),onRowClick:r=>{a(r),h()}}],columns:[{name:"id",displayKey:"id"},{name:"timestamp",displayKey:"timestamp",cellRenderer:r=>l(new Date(r.timestamp*1e3),U)},{name:"expiration",displayKey:"expires",cellRenderer:r=>l(new Date(r.timestamp*1e3+r.expiration*1e3),U)},{name:"count",displayKey:"count"},{name:"remainingCount",displayKey:"remainingCount",transforms:[we]}],emptyState:e(Re,{message:i("noTokens"),instructions:i("noTokensInstructions"),primaryActionText:i("create"),onPrimaryAction:()=>p(W({realm:s}))})},d?.id)]})},Se=({onConfirm:t,toggleDialog:i})=>{const{t:n}=f(),o=re(),s=Object.keys(o.providers?.["client-registration-policy"].providers||[]),l=o.componentTypes?.["org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy"],p=oe(),d=Te(()=>p(l?.filter(a=>s.includes(a.id))||[],le("id")),[s,l]);return e(ce,{variant:de.medium,title:n("chooseAPolicyProvider"),isOpen:!0,onClose:i,children:c(Ke,{onSelectDataListItem:(a,y)=>{t(y),i()},"aria-label":n("addPredefinedMappers"),isCompact:!0,children:[e(q,{"aria-label":n("headerName"),id:"header",children:e(z,{children:e(G,{dataListCells:[n("name"),n("description")].map(a=>e(S,{style:{fontWeight:700},children:a},a))})})}),d.map(a=>e(q,{"aria-label":a.id,"data-testid":a.id,id:a.id,children:e(z,{children:e(G,{dataListCells:[e(S,{width:2,children:a.id},`name-${a.id}`),e(S,{width:4,children:a.helpText},`description-${a.id}`)]})})},a.id))]})})},Ee=t=>{const{realm:i}=g(),{subTab:n}=Y();return e(I,{to:Z({realm:i,subTab:n||"anonymous",providerId:t.providerId,id:t.id}),children:t.name},t.id)},J=({subType:t})=>{const{adminClient:i}=M(),{t:n}=f(),{subTab:o}=Y(),s=Q(),{addAlert:l,addError:p}=F(),{realm:d}=g(),[a,y]=L([]),[h,C]=L(),[r,b]=Le();me(()=>i.components.find({type:"org.keycloak.services.clientregistration.policy.ClientRegistrationPolicy"}),m=>y(m.filter(x=>x.subType===t)),[h]);const[v,w]=V({titleKey:"clientRegisterPolicyDeleteConfirmTitle",messageKey:n("clientRegisterPolicyDeleteConfirm",{name:h?.name}),continueButtonLabel:"delete",continueButtonVariant:N.danger,onConfirm:async()=>{try{await i.components.del({realm:d,id:h?.id}),l(n("clientRegisterPolicyDeleteSuccess")),C(void 0)}catch(m){p("clientRegisterPolicyDeleteError",m)}}});return c(P,{children:[r&&e(Se,{onConfirm:m=>s(Z({realm:d,subTab:o||"anonymous",providerId:m})),toggleDialog:b}),e(w,{}),e($,{ariaLabelKey:"clientRegistration",searchPlaceholderKey:n("searchClientRegistration"),"data-testid":`clientRegistration-${t}`,loader:a,toolbarItem:e(E,{children:e(K,{"data-testid":`createPolicy-${t}`,onClick:b,children:n("createPolicy")})}),actions:[{title:n("delete"),onRowClick:m=>{C(m),v()}}],columns:[{name:"name",displayKey:"name",cellRenderer:Ee},{name:"providerId",displayKey:"providerId"}]})]})},Me=()=>{const{t}=f(),{realm:i}=g(),n=l=>ne(H({realm:i,subTab:l})),o=n("anonymous"),s=n("authenticated");return c(ie,{defaultLocation:H({realm:i,subTab:"anonymous"}),mountOnEnter:!0,children:[e(R,{"data-testid":"anonymous",title:c(k,{children:[t("anonymousAccessPolicies")," ",e(j,{fieldLabelId:"",helpText:t("anonymousAccessPoliciesHelp"),noVerticalAlign:!1,unWrap:!0})]}),...o,children:e(J,{subType:"anonymous"})}),e(R,{"data-testid":"authenticated",title:c(k,{children:[t("authenticatedAccessPolicies")," ",e(j,{fieldLabelId:"",helpText:t("authenticatedAccessPoliciesHelp"),noVerticalAlign:!1,unWrap:!0})]}),...s,children:e(J,{subType:"authenticated"})})]})},Fe=t=>{const{t:i}=f(),{realm:n}=g();return e(O,{wrapModifier:"truncate",children:c(I,{to:he({realm:n,clientId:t.id,tab:"settings"}),children:[t.clientId,!t.enabled&&e(fe,{isRead:!0,className:"pf-v5-u-ml-sm",children:i("disabled")},`${t.id}-disabled`)]},t.id)})},Ne=t=>e(O,{wrapModifier:"truncate",children:te()(t.name)}),Ve=t=>e(O,{wrapModifier:"truncate",children:te()(t.description)}),$e=t=>{const{environment:i}=ge(),n=xe(t,i);return n?e(Ae,{href:n}):"—"},Oe=()=>{const{t}=f(),{realm:i}=g(),{hasAccess:n}=ee();return n("manage-clients")?c(P,{children:[e(E,{children:e(K,{component:s=>e(I,{...s,to:Ce({realm:i})}),children:t("createClient")})}),e(E,{children:e(K,{component:s=>e(I,{...s,to:be({realm:i})}),variant:"link","data-testid":"importClient",children:t("importClient")})})]}):e("span",{})};function Tt(){const{adminClient:t}=M(),{t:i}=f(),{addAlert:n,addError:o}=F(),{realm:s}=g(),[l,p]=L(0),d=()=>p(new Date().getTime()),[a,y]=L(),{hasAccess:h}=ee(),C=h("manage-clients"),r=async(u,T,D)=>{const B={first:u,max:T};return D&&(B.clientId=D,B.search=!0),await t.clients.find({...B})},b=u=>ne(_({realm:s,tab:u})),v=b("list"),w=b("initial-access-token"),m=b("client-registration"),[x,ae]=V({titleKey:i("clientDelete",{clientId:a?.clientId}),messageKey:"clientDeleteConfirm",continueButtonLabel:"delete",continueButtonVariant:N.danger,onConfirm:async()=>{try{await t.clients.del({id:a.id}),n(i("clientDeletedSuccess"),X.success),d()}catch(u){o("clientDeleteError",u)}}});return c(P,{children:[e(De,{titleKey:"clientList",subKey:"clientsExplain",helpUrl:ue.clientsUrl,divider:!1}),e(pe,{variant:"light",className:"pf-v5-u-p-0",children:c(ie,{mountOnEnter:!0,isBox:!0,defaultLocation:_({realm:s,tab:"list"}),children:[c(R,{"data-testid":"list",title:e(k,{children:i("clientsList")}),...v,children:[e(ae,{}),e($,{loader:r,isPaginated:!0,ariaLabelKey:"clientList",searchPlaceholderKey:"searchForClient",toolbarItem:e(Oe,{}),actionResolver:u=>{const T=u.data,D=[{title:i("export"),onClick(){ye(T)}}];return!Pe(T)&&(C||T.access?.configure)&&D.push({title:i("delete"),onClick(){y(T),x()}}),D},columns:[{name:"clientId",displayKey:"clientId",transforms:[A(20)],cellRenderer:Fe},{name:"clientName",displayKey:"clientName",transforms:[A(20)],cellRenderer:Ne},{name:"protocol",displayKey:"type",transforms:[A(10)],cellRenderer:u=>ve(i,u.protocol??"openid-connect")},{name:"description",displayKey:"description",transforms:[A(30)],cellRenderer:Ve},{name:"baseUrl",displayKey:"homeURL",transforms:[A(20)],cellRenderer:$e}]},l)]}),e(R,{"data-testid":"initialAccessToken",title:e(k,{children:i("initialAccessToken")}),...w,children:e(Be,{})}),e(R,{"data-testid":"registration",title:e(k,{children:i("clientRegistration")}),...m,children:e(Me,{})})]})})]})}export{Tt as default};
//# sourceMappingURL=ClientsSection-21sxv367.js.map




© 2015 - 2025 Weber Informatics LLC | Privacy Policy