1import{r as e,j as s}from"./vendor-react-DejgYtBM.js";import{u as a,Z as l,Y as r,A as t,s as i,w as c}from"./index-BeIIFw6E.js";import{f as d,i as n,z as o,j as x,B as m,m as h,E as p,J as u,K as j,W as y,D as g,o as w,M as f}from"./vendor-semi-D8d7bTtM.js";import{C as v}from"./CardTable-Cq0lqlnD.js";import{ag as b,ap as N,aq as S,T as k,X as z,R as _}from"./vendor-icons-EJvJ5X-w.js";import"./vendor-motion-Chfy_MiU.js";import"./useIsMobile-D_kfVI0u.js";const{Text:I}=d,R={frontend:{label:"å端",color:"blue",icon:s.jsx(N,{size:14})},backend:{label:"å端",color:"red",icon:s.jsx(b,{size:14})}},C={js_error:{label:"JSé误",color:"orange"},react_crash:{label:"Reactå´©æº",color:"red"},promise_reject:{label:"Promiseå¼å¸¸",color:"amber"},panic:{label:"å端Panic",color:"red"}},T=()=>{const{t:d}=a(),[b,N]=e.useState([]),[T,P]=e.useState(!0),[J,L]=e.useState(1),[B,D]=e.useState(l),[U,W]=e.useState(0),[q,E]=e.useState(!1),[O,A]=e.useState(null),H=e.useRef(!1),[M,V]=e.useState(null),$=[{label:d("å
¨é¨"),value:""},{label:d("å端"),value:"frontend"},{label:d("å端"),value:"backend"}],K=[{label:d("å
¨é¨"),value:""},{label:"JSé误",value:"js_error"},{label:"Reactå´©æº",value:"react_crash"},{label:"Promiseå¼å¸¸",value:"promise_reject"},{label:d("å端Panic"),value:"panic"}],F=async(e,s,a=null)=>{a||(a=(()=>{const e=M?M.getValues():{};return{source:e.source||"",type:e.type||"",keyword:e.keyword||""}})());try{P(!0);const l=new URLSearchParams;l.append("page",e),l.append("page_size",s),a.source&&l.append("source",a.source),a.type&&l.append("type",a.type),a.keyword&&l.append("keyword",a.keyword);const r=await t.get(`/api/crash_log/?${l.toString()}`),{success:c,message:d,data:n}=r.data;c?(N(n.items||[]),L(n.page||e),W(n.total||0)):i(d)}catch(l){i(d("å è½½å´©æºæ¥å¿å¤±è´¥")+"ï¼"+l.message)}finally{P(!1)}};e.useEffect(()=>{F(1,B)},[]);const X=[{title:"ID",dataIndex:"id",width:60},{title:d("æ¶é´"),dataIndex:"created_at",width:160,render:e=>s.jsx(I,{className:"text-xs",children:r(e)})},{title:d("æ¥æº"),dataIndex:"source",width:90,render:e=>{const a=R[e]||{label:e,color:"grey"};return s.jsx(n,{size:"small",color:a.color,prefixIcon:a.icon,children:d(a.label)})}},{title:d("ç±»å"),dataIndex:"type",width:110,render:e=>{const a=C[e]||{label:e,color:"grey"};return s.jsx(n,{size:"small",color:a.color,children:a.label})}},{title:d("é误信æ¯"),dataIndex:"message",render:e=>s.jsx(o,{content:e,position:"top",style:{maxWidth:400},children:s.jsx(I,{className:"text-xs",ellipsis:{showTooltip:!1},style:{maxWidth:360},children:e})})},{title:"URL",dataIndex:"url",width:200,render:e=>s.jsx(o,{content:e,position:"top",children:s.jsx(I,{className:"text-xs font-mono",ellipsis:{showTooltip:!1},style:{maxWidth:180},children:e||"-"})})},{title:d("ç¨æ·"),dataIndex:"username",width:100,render:(e,a)=>s.jsxs(x,{vertical:!0,spacing:1,children:[s.jsx(I,{className:"text-xs",children:e||"-"}),a.user_id>0&&s.jsxs(I,{type:"secondary",className:"text-xs",children:["ID: ",a.user_id]})]})},{title:d("æä½"),width:70,render:(e,a)=>s.jsx(m,{theme:"borderless",type:"primary",size:"small",onClick:()=>(e=>{A(e),E(!0)})(a),children:d("详æ
")})}];return s.jsxs("div",{className:"",children:[s.jsx(h,{className:"!rounded-2xl",title:s.jsxs("div",{className:"flex flex-col w-full",children:[s.jsx("div",{className:"mb-2",children:s.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-start md:items-center gap-2 w-full",children:[s.jsxs("div",{className:"flex items-center text-red-500",children:[s.jsx(S,{size:16,className:"mr-2"}),s.jsx(I,{children:d("æ¥çå端JSé误ãReactå´©æºåå端Panicæ¥å¿ï¼åæ¶åç°åææ¥çº¿ä¸é®é¢ã")})]}),s.jsx("div",{className:"flex gap-2",children:s.jsx(m,{theme:"light",type:"secondary",icon:s.jsx(k,{size:16}),onClick:()=>{f.confirm({title:d("确认å é¤"),content:d("ç¡®å®è¦å é¤30天åçå´©æºæ¥å¿åï¼æ¤æä½ä¸å¯éã"),onOk:async()=>{try{const e=await t.delete("/api/crash_log/?days=30"),{success:s,message:a}=e.data;s?(c(d("å 餿å")),await F(1,B)):i(a)}catch(e){i(d("å é¤å¤±è´¥")+"ï¼"+e.message)}}})},size:"small",children:d("æ¸
çå岿¥å¿")})})]})}),s.jsx(g,{margin:"12px"}),s.jsx(w,{initValues:{source:"",type:"",keyword:""},getFormApi:e=>V(e),onSubmit:()=>{L(1),F(1,B)},allowEmpty:!0,autoComplete:"off",layout:"horizontal",className:"w-full",children:s.jsxs("div",{className:"flex flex-col md:flex-row items-center gap-3 w-full",children:[s.jsx("div",{className:"w-full md:w-36",children:s.jsx(w.Select,{field:"source",placeholder:d("æ¥æº"),optionList:$,className:"w-full",showClear:!0,pure:!0})}),s.jsx("div",{className:"w-full md:w-40",children:s.jsx(w.Select,{field:"type",placeholder:d("é误类å"),optionList:K,className:"w-full",showClear:!0,pure:!0})}),s.jsx("div",{className:"relative flex-1 w-full",children:s.jsx(w.Input,{field:"
1keyword",prefix:s.jsx(z,{size:16}),placeholder:d("æç´¢é误信æ¯/URL/ç¨æ·å"),showClear:!0,pure:!0})}),s.jsxs("div",{className:"flex gap-2 w-full md:w-auto",children:[s.jsx(m,{type:"primary",htmlType:"submit",loading:T,className:"flex-1 md:flex-initial",children:d("æ¥è¯¢")}),s.jsx(m,{theme:"light",icon:s.jsx(_,{size:16}),onClick:()=>{M&&(M.reset(),setTimeout(()=>{L(1),F(1,B,{source:"",type:"",keyword:""})},100))},className:"flex-1 md:flex-initial",children:d("éç½®")})]})]})})]}),shadows:"always",bordered:!1,children:s.jsx(v,{columns:X,dataSource:b,scroll:{x:"max-content"},pagination:{formatPageText:e=>d("第 {{start}} - {{end}} æ¡ï¼å
± {{total}} æ¡",{start:e.currentStart,end:e.currentEnd,total:U}),currentPage:J,pageSize:B,total:U,pageSizeOpts:[10,20,50,100],showSizeChanger:!0,onPageSizeChange:async e=>{D(e),L(1),H.current=!0;try{await F(1,e)}finally{H.current=!1}},onPageChange:e=>{H.current||(L(e),F(e,B))}},loading:T,empty:s.jsx(p,{image:s.jsx(j,{style:{width:150,height:150}}),darkModeImage:s.jsx(u,{style:{width:150,height:150}}),description:d("ææ å´©æºæ¥å¿ï¼ä¸åæ£å¸¸"),style:{padding:30}}),size:"small",rowKey:"id"})}),s.jsx(y,{title:d("å´©æºæ¥å¿è¯¦æ
"),visible:q,onCancel:()=>E(!1),width:600,placement:"right",children:O&&s.jsxs("div",{className:"space-y-4 p-2",children:[s.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[s.jsxs("div",{children:[s.jsx(I,{t
1ype:"secondary",className:"text-xs",children:d("æ¥æº")}),s.jsx("div",{className:"mt-1",children:(()=>{const e=R[O.source]||{label:O.source,color:"grey"};return s.jsx(n,{color:e.color,prefixIcon:e.icon,children:d(e.label)})})()})]}),s.jsxs("div",{children:[s.jsx(I,{type:"secondary",className:"text-xs",children:d("ç±»å")}),s.jsx("div",{className:"mt-1",children:(()=>{const e=C[O.type]||{label:O.type,color:"grey"};return s.jsx(n,{color:e.color,children:e.label})})()})]}),s.jsxs("div",{children:[s.jsx(I,{type:"secondary",className:"text-xs",children:d("æ¶é´")}),s.jsx("div",{className:"mt-1",children:s.jsx(I,{children:r(O.created_at)})})]}),s.jsxs("div",{children:[s.jsx(I,{type:"secondary",className:"text-xs",children:d("ç¨æ·")}),s.jsx("div",{className:"mt-1",children:s.jsxs(I,{children:[O.username||"-",O.user_id>0&&` (ID: ${O.user_id})`]})})]}),O.request_id&&s.jsxs("div",{className:"col-span-2",children:[s.jsx(I,{type:"secondary",className:"text-xs",children:"Request ID"}),s.jsx("div",{className:"mt-1",children:s.jsx(I,{className:"font-mono text-xs",children:O.request_id})})]}
1),s.jsxs("div",{className:"col-span-2",children:[s.jsx(I,{type:"secondary",className:"text-xs",children:"URL"}),s.jsx("div",{className:"mt-1",children:s.jsxs(I,{className:"font-mono text-xs break-all",children:[O.method&&`${O.method} `,O.url||"-"]})})]})]}),s.jsx(g,{}),s.jsxs("div",{children:[s.jsx(I,{strong:!0,children:d("é误信æ¯")}),s.jsx("pre",{style:{background:"hsl(var(--secondary))",borderRadius:8,padding:12,fontSize:12,whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:120,overflow:"auto",marginTop:8},children:O.message})]}),O.stack&&s.jsxs("div",{children:[s.jsx(I,{strong:!0,children:d("å æ ä¿¡æ¯")}),s.jsx("pre",{style:{background:"hsl(var(--secondary))",borderRadius:8,padding:12,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-all",maxHeight:300,overflow:"auto",marginTop:8,lineHeight:1.5},children:O.stack})]}),O.user_agent&&s.jsxs("div",{children:[s.jsx(I,{type:"secondary",className:"text-xs",children:"User Agent"}),s.jsx("pre",{style:{background:"hsl(var(--secondary))",borderRadius:8,padding:8,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-all",marginTop:4},children:O.user_agent})]}),O.extra&&"{}
1"!==O.extra&&s.jsxs("div",{children:[s.jsx(I,{type:"secondary",className:"text-xs",children:d("é¢å¤ä¿¡æ¯")}),s.jsx("pre",{style:{background:"hsl(var(--secondary))",borderRadius:8,padding:8,fontSize:11,whiteSpace:"pre-wrap",wordBreak:"break-all",marginTop:4},children:(()=>{try{return JSON.stringify(JSON.parse(O.extra),null,2)}catch{return O.extra}})()})]})]})})]})};export{T as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.