theme.keycloak.v2.admin.resources.assets.SessionsTable-7Bmc2htq.js Maven / Gradle / Ivy
import{jsxs as u,Fragment as C,jsx as t}from"react/jsx-runtime";import{o as x,bH as F,u as M,c as d,dt as V,d as E,a as v,f as j,aD as P,a2 as B,i as N,L as b,bx as W,I as H,p as q,bw as G,aR as J,du as Q,dv as h}from"./main-C7ps2lmX.js";import{useState as X,useMemo as Y}from"react";import{u as Z}from"./ConfirmDialog-hx7XKLbN.js";import{L as _}from"./PaginatingTableToolbar-Cjsz5Jh4.js";import{K as $}from"./KeycloakDataTable-DbY4la1D.js";import{u as ee}from"./useFormatDate-X7HJ5iYO.js";import{L as se,a as te,b as ne}from"./ListItem-CHzEhhky.js";const ae={name:"CubesIcon",height:512,width:512,svgPath:"M488.6 250.2L392 214V105.5c0-15-9.3-28.4-23.4-33.7l-100-37.5c-8.1-3.1-17.1-3.1-25.3 0l-100 37.5c-14.1 5.3-23.4 18.7-23.4 33.7V214l-96.6 36.2C9.3 255.5 0 268.9 0 283.9V394c0 13.6 7.7 26.1 19.9 32.2l100 50c10.1 5.1 22.1 5.1 32.2 0l103.9-52 103.9 52c10.1 5.1 22.1 5.1 32.2 0l100-50c12.2-6.1 19.9-18.6 19.9-32.2V283.9c0-15-9.3-28.4-23.4-33.7zM358 214.8l-85 31.9v-68.2l85-37v73.3zM154 104.1l102-38.2 102 38.2v.6l-102 41.4-102-41.4v-.6zm84 291.1l-85 42.5v-79.1l85-38.8v75.4zm0-112l-102 41.4-102-41.4v-.6l102-38.2 102 38.2v.6zm240 112l-85 42.5v-79.1l85-38.8v75.4zm0-112l-102 41.4-102-41.4v-.6l102-38.2 102 38.2v.6z",yOffset:0,xOffset:0},ie=x(ae),g=n=>n?.startsWith("lightweight-"),oe=n=>{const{realm:i}=d(),{t:a}=v();return u(b,{to:W({realm:i,id:n.userId,tab:"sessions"}),children:[n.username,n.transientUser&&u(C,{children:[" ",t(H,{content:a("transientUserTooltip"),children:t(q,{"data-testid":"user-details-label-transient-user",icon:t(G,{}),isCompact:!0,children:a("transientUser")})})]})]})},le=n=>{const{realm:i}=d();return t(se,{variant:te.inline,children:Object.entries(n.clients).map(([a,o])=>t(ne,{children:t(b,{to:J({realm:i,clientId:a,tab:"sessions"}),children:o})},a))})};function he({loader:n,hiddenColumns:i=[],emptyInstructions:a,logoutUser:o,filter:I,isSearching:L,isPaginated:S}){const{keycloak:A}=F(),{adminClient:c}=M(),{realm:l}=d(),{whoAmI:K}=V(),f=E(),{t:r}=v(),{addError:k}=j(),p=ee(),[O,R]=X(0),m=()=>R(e=>e+1),y=!!P(Q.path),U=Y(()=>[{name:"username",displayKey:"user",cellRenderer:oe},{name:"type",displayKey:"type"},{name:"start",displayKey:"started",cellRenderer:s=>p(new Date(s.start))},{name:"lastAccess",displayKey:"lastAccess",cellRenderer:s=>p(new Date(s.lastAccess))},{name:"ipAddress",displayKey:"ipAddress"},{name:"clients",displayKey:"clients",cellRenderer:le}].filter(({name:s})=>!i.includes(s)),[l,i]),[z,D]=Z({titleKey:"logoutAllSessions",messageKey:"logoutAllDescription",continueButtonLabel:"confirm",onConfirm:async()=>{try{await c.users.logout({id:o}),y&&g(o)?f(h({realm:l})):m()}catch(e){k("logoutAllSessionsError",e)}}});async function T(e){const s=e.data;await c.realms.deleteSession({realm:l,session:s.id,isOffline:!0}),m()}async function w(e){const s=e.data;await c.realms.deleteSession({realm:l,session:s.id,isOffline:!1}),s.userId===K.getUserId()?await A.logout({redirectUri:""}):y&&g(s.userId)?f(h({realm:l})):m()}return u(C,{children:[t(D,{}),t($,{loader:n,ariaLabelKey:"titleSessions",searchPlaceholderKey:"searchForSession",isPaginated:S,isSearching:L,searchTypeComponent:I,toolbarItem:o&&t(B,{children:t(N,{onClick:z,children:r("logoutAllSessions")})}),columns:U,actionResolver:e=>e.data.type==="Offline"||e.data.type==="OFFLINE"?[{title:r("revoke"),onClick:()=>T(e)}]:[{title:r("signOut"),onClick:()=>w(e)}],emptyState:t(_,{hasIcon:!0,icon:ie,message:r("noSessions"),instructions:a||r("noSessionsDescription")})},O)]})}export{ie as C,he as S,g as i};
//# sourceMappingURL=SessionsTable-7Bmc2htq.js.map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy