theme.keycloak.v2.admin.resources.assets.SessionsSection--6clq0zS.js Maven / Gradle / Ivy
import{jsxs as v,jsx as t,Fragment as O}from"react/jsx-runtime";import{u as F,a as B,f as T,c as k,g as q,M as x,q as I,i as g,B as E,aa as U,r as V,ac as M,am as P,k as c,D as N,au as K,P as j,b5 as G,U as A,cq as H}from"./main-C7ps2lmX.js";import{useState as h}from"react";import{u as $}from"./ConfirmDialog-hx7XKLbN.js";import{V as z}from"./ViewHeader-B7eeFzFA.js";import{u as J}from"./useToggle-K3Kx99tM.js";import{S as Q}from"./SessionsTable-7Bmc2htq.js";import{F as W}from"./filter-icon-DO0QNij3.js";import"react-dom";import"./PaginatingTableToolbar-Cjsz5Jh4.js";import"./EmptyStateFooter-DqmBOP2I.js";import"./EmptyStateActions-DWNUFByn.js";import"./KeycloakDataTable-DbY4la1D.js";import"./Td-D2hVFK0Z.js";import"./grip-vertical-icon-BxF7V59o.js";import"./_baseFlatten-eIEJR-AJ.js";import"./useFormatDate-X7HJ5iYO.js";import"./ListItem-CHzEhhky.js";const X=({handleModalToggle:n,save:l})=>{const{adminClient:a}=F(),{t:e}=B(),{addAlert:o}=T(),{realm:r,realmRepresentation:d,refresh:m}=k(),{register:S,handleSubmit:u}=q(),y=(s,p)=>{const w=s.successRequests?.length||0,i=s.failedRequests?.length||0;w===0&&i===0?o(e("noAdminUrlSet"),c.warning):i>0?(o(e(""+p+"Success",{successNodes:s.successRequests}),c.success),o(e(""+p+"Fail",{failedNodes:s.failedRequests}),c.danger)):o(e(""+p+"Success",{successNodes:s.successRequests}),c.success)},C=async()=>{try{await a.realms.update({realm:r},{realm:r,notBefore:Date.now()/1e3}),o(e("notBeforeSuccess"),c.success)}catch(s){o(e("setToNowError",{error:s}),c.danger)}},b=async()=>{try{await a.realms.update({realm:r},{realm:r,notBefore:0}),o(e("notBeforeClearedSuccess"),c.success),m()}catch(s){o(e("notBeforeError",{error:s}),c.danger)}},f=async()=>{const s=await a.realms.pushRevocation({realm:r});y(s,"notBeforePush"),m()};return v(x,{variant:I.small,title:e("revocation"),isOpen:!0,onClose:n,actions:[t(g,{"data-testid":"set-to-now-button",variant:"tertiary",onClick:()=>{C(),n()},form:"revocation-modal-form",children:e("setToNow")},"set-to-now"),t(g,{"data-testid":"clear-not-before-button",variant:"tertiary",onClick:()=>{b(),n()},form:"revocation-modal-form",children:e("clear")},"clear"),t(g,{"data-testid":"modal-test-connection-button",variant:"secondary",onClick:()=>{f(),n()},form:"revocation-modal-form",children:e("push")},"push"),t(g,{id:"modal-cancel","data-testid":"cancel",variant:E.link,onClick:()=>{n()},children:e("cancel")},"cancel")],children:[t(U,{className:"kc-revocation-description-text",children:e("revocationDescription")}),t(V,{id:"revocation-modal-form",isHorizontal:!0,onSubmit:u(l),children:t(M,{className:"kc-revocation-modal-form-group",label:e("notBefore"),name:"notBefore",fieldId:"not-before",children:t(P,{"data-testid":"not-before-input",autoFocus:!0,readOnly:!0,value:d?.notBefore===0?e("none"):new Date(d?.notBefore*1e3).toString(),type:"text",id:"not-before",...S("notBefore")})})})]})},Y=({filterType:n,onChange:l})=>{const{t:a}=B(),[e,o]=J();return v(G,{"data-testid":"filter-session-type-select",isOpen:e,onToggle:o,toggleIcon:t(W,{}),onSelect:r=>{l(r),o()},selections:n,children:[t(A,{"data-testid":"all-sessions-option",value:"ALL",children:a("sessionsType.allSessions")}),t(A,{"data-testid":"regular-sso-option",value:"REGULAR",children:a("sessionsType.regularSSO")}),t(A,{"data-testid":"offline-option",value:"OFFLINE",children:a("sessionsType.offline")})]})};function he(){const{adminClient:n}=F(),{t:l}=B(),[a,e]=h(0),o=()=>e(a+1),{addError:r}=T(),{realm:d}=k(),[m,S]=h(!1),[u,y]=h("ALL"),[C,b]=h(!1),f=()=>{S(!m)},s=async(i,L,D)=>{const R=await H(n,"ui-ext/sessions",{first:`${i}`,max:`${L}`,type:u,search:D||""});return b(R.length===0),R},[p,w]=$({titleKey:"logoutAllSessions",messageKey:"logoutAllDescription",continueButtonLabel:"confirm",onConfirm:async()=>{try{await n.realms.logoutAll({realm:d}),o()}catch(i){r("logoutAllSessionsError",i)}}});return v(O,{children:[t(w,{}),t(z,{dropdownItems:[t(N,{"data-testid":"revocation",component:"button",onClick:()=>f(),children:l("revocation")},"toggle-modal"),t(N,{"data-testid":"logout-all",component:"button",isDisabled:C,onClick:p,children:l("signOutAllActiveSessions")},"delete-role")],titleKey:"titleSessions",subKey:"sessionExplain",helpUrl:K.sessionsUrl}),v(j,{variant:"light",className:"pf-v5-u-p-0",children:[m&&t(X,{handleModalToggle:f,save:()=>{f()}}),t(Q,{loader:s,isSearching:u!=="ALL",isPaginated:!0,filter:t(Y,{filterType:u,onChange:i=>{y(i),o()}})},a)]})]})}export{he as default};
//# sourceMappingURL=SessionsSection--6clq0zS.js.map
© 2015 - 2025 Weber Informatics LLC | Privacy Policy