Files
aiops/backend/static/assets/LoginLogsTab-BZTjs1T3.js
T
Logan.Li 025e74ff4d feat(k8s): Deployment 存储挂载改 Kuboard 一卷一卡布局
每张数据卷同屏展示卷定义与容器挂载(容器/只读读写/路径/subPath)。
2026-06-26 15:00:09 +08:00

2 lines
7.1 KiB
JavaScript

import{r as n,j as s}from"./vendor-codemirror-C7mXSpXt.js";import{C as N,a as v}from"./card-B-RtdR4H.js";import{B as h}from"./index-LZWfu62c.js";import{I as _}from"./input-BdDauX3U.js";import{B as i}from"./badge-B0F5ZNtn.js";import{T as y,a as C,b as L,c as o,d as w,e as c}from"./table-BPFYQwjr.js";import{l as S}from"./terminal-BchqP-zB.js";import{S as k,R as B,Z as I,G as A,_ as R}from"./vendor-icons-Aso0-eeY.js";function z(a){return{id:a.id??0,username:a.username??"",login_type:a.login_type??"password",ip:a.ip??"",location:a.location??"",browser:a.browser??"",os:a.os??"",user_agent:a.user_agent??a.userAgent??"",status:a.status==="failed"||a.status==="fail"?"fail":"success",fail_reason:a.fail_reason??a.message??"",login_at:a.login_at??a.created_at??"",created_at:a.created_at??a.login_at??""}}function M(){const[a,g]=n.useState([]),[b,d]=n.useState(!0),[p,m]=n.useState(""),[r,u]=n.useState(""),l=n.useCallback(async()=>{d(!0);try{const e={page:1,page_size:100};r&&(e.status=r==="fail"?"failed":r);const f=(await S.list(e))?.list??[];g(f.map(z))}catch{g([])}finally{d(!1)}},[r]);n.useEffect(()=>{l()},[l]);const x=a.filter(e=>{const t=p.toLowerCase();return!t||(e.username||"").toLowerCase().includes(t)||(e.ip||"").toLowerCase().includes(t)||(e.location||"").toLowerCase().includes(t)||(e.user_agent||"").toLowerCase().includes(t)}),T=(e,t)=>e==="success"?s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:88:7",variant:"outline",className:"border-emerald-500/30 text-emerald-400 bg-emerald-500/10",children:"成功"}):s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:92:7",variant:"outline",className:"border-red-500/30 text-red-400 bg-red-500/10",title:t||void 0,children:t||"失败"}),j=e=>{switch(e){case"password":return"密码登录";case"ldap":return"LDAP";case"token":return"Token";case"oauth":return"OAuth";default:return e||"密码登录"}};return s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:113:5",className:"space-y-4",children:[s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:115:7",className:"flex items-center gap-3 flex-wrap",children:[s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:116:9",className:"relative w-64",children:[s.jsx(k,{"code-path":"src/pages/LoginLogsTab.tsx:117:11",className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-slate-500"}),s.jsx(_,{"code-path":"src/pages/LoginLogsTab.tsx:118:11",placeholder:"搜索用户/IP/归属地...",value:p,onChange:e=>m(e.target.value),className:"pl-9 h-9 bg-slate-800/50 border-slate-700 text-slate-200 placeholder:text-slate-500"})]}),s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:126:9",className:"flex items-center gap-1",children:[{value:"",label:"全部"},{value:"success",label:"成功"},{value:"fail",label:"失败"}].map(({value:e,label:t})=>s.jsx(h,{"code-path":"src/pages/LoginLogsTab.tsx:132:13",variant:r===e?"default":"outline",size:"sm",className:r===e?"h-8 bg-blue-600 hover:bg-blue-700 text-white":"h-8 border-slate-700 text-slate-400 hover:text-slate-100 hover:bg-slate-800",onClick:()=>u(e),children:t},e||"all"))}),s.jsxs(h,{"code-path":"src/pages/LoginLogsTab.tsx:148:9",variant:"outline",className:"border-slate-700 text-slate-300 hover:text-slate-100 hover:bg-slate-800",onClick:l,children:[s.jsx(B,{"code-path":"src/pages/LoginLogsTab.tsx:153:11",className:"h-4 w-4 mr-2"}),"刷新"]})]}),s.jsx(N,{"code-path":"src/pages/LoginLogsTab.tsx:159:7",className:"bg-slate-900 border-slate-800",children:s.jsx(v,{"code-path":"src/pages/LoginLogsTab.tsx:160:9",className:"p-0",children:s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:161:11",className:"border-t border-slate-800",children:b?s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:163:15",className:"flex items-center justify-center py-16",children:s.jsx("div",{"code-path":"src/pages/LoginLogsTab.tsx:164:17",className:"w-8 h-8 border-2 border-blue-500 border-t-transparent rounded-full animate-spin"})}):x.length===0?s.jsxs("div",{"code-path":"src/pages/LoginLogsTab.tsx:167:15",className:"flex flex-col items-center justify-center py-16 text-slate-500",children:[s.jsx(I,{"code-path":"src/pages/LoginLogsTab.tsx:168:17",className:"h-8 w-8 mb-3 opacity-40"}),s.jsx("p",{"code-path":"src/pages/LoginLogsTab.tsx:169:17",className:"text-sm",children:"暂无登录日志"})]}):s.jsxs(y,{"code-path":"src/pages/LoginLogsTab.tsx:172:15",children:[s.jsx(C,{"code-path":"src/pages/LoginLogsTab.tsx:173:17",children:s.jsxs(L,{"code-path":"src/pages/LoginLogsTab.tsx:174:19",className:"border-slate-800 hover:bg-transparent",children:[s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:175:21",className:"text-slate-400",children:"登录时间"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:176:21",className:"text-slate-400",children:"用户"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:177:21",className:"text-slate-400",children:"登录方式"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:178:21",className:"text-slate-400",children:"IP"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:179:21",className:"text-slate-400",children:"归属地"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:180:21",className:"text-slate-400",children:"浏览器/OS"}),s.jsx(o,{"code-path":"src/pages/LoginLogsTab.tsx:181:21",className:"text-slate-400",children:"状态"})]})}),s.jsx(w,{"code-path":"src/pages/LoginLogsTab.tsx:184:17",children:x.map(e=>s.jsxs(L,{"code-path":"src/pages/LoginLogsTab.tsx:186:21",className:"border-slate-800 hover:bg-slate-800/50",children:[s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:187:23",children:s.jsx("span",{"code-path":"src/pages/LoginLogsTab.tsx:188:25",className:"text-sm text-slate-400",children:e.login_at?new Date(e.login_at).toLocaleString():"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:192:23",children:s.jsx("span",{"code-path":"src/pages/LoginLogsTab.tsx:193:25",className:"text-sm text-slate-200 font-medium",children:e.username||"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:195:23",children:s.jsx(i,{"code-path":"src/pages/LoginLogsTab.tsx:196:25",variant:"outline",className:"border-blue-500/30 text-blue-400 bg-blue-500/10 text-xs",children:j(e.login_type)})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:200:23",children:s.jsx("code",{"code-path":"src/pages/LoginLogsTab.tsx:201:25",className:"text-xs text-slate-400 bg-slate-800 px-2 py-0.5 rounded",children:e.ip||"--"})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:205:23",children:s.jsxs("span",{"code-path":"src/pages/LoginLogsTab.tsx:206:25",className:"text-xs text-slate-500 flex items-center gap-1",children:[s.jsx(A,{"code-path":"src/pages/LoginLogsTab.tsx:207:27",className:"h-3 w-3"}),e.location||"--"]})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:211:23",children:s.jsxs("span",{"code-path":"src/pages/LoginLogsTab.tsx:212:25",className:"text-xs text-slate-500 flex items-center gap-1",title:e.user_agent,children:[s.jsx(R,{"code-path":"src/pages/LoginLogsTab.tsx:213:27",className:"h-3 w-3 flex-shrink-0"}),e.browser||e.os?[e.browser,e.os].filter(Boolean).join(" / "):e.user_agent?e.user_agent.length>40?e.user_agent.slice(0,40)+"...":e.user_agent:"--"]})}),s.jsx(c,{"code-path":"src/pages/LoginLogsTab.tsx:223:23",children:T(e.status,e.fail_reason)})]},e.id))})]})})})})]})}export{M as LoginLogsTab};