var e=(e,l,a)=>new Promise((t,o)=>{var n=e=>{try{s(a.next(e))}catch(l){o(l)}},r=e=>{try{s(a.throw(e))}catch(l){o(l)}},s=e=>e.done?t(e.value):Promise.resolve(e.value).then(n,r);s((a=a.apply(e,l)).next())});import{A as l,B as a,a5 as t,a6 as o,e as n,w as r,s,l as i,ad as u,x as d,a0 as c,R as m}from"./vendor-element-DupX9wXy.js";import{c as p,e as g,f as v}from"./log-hIjbSyGY.js";import{q as f,bI as h,r as b,a2 as y,R as _,t as w,v as x,M as z,E as C,F as P,A as S,u as V,L as U,aq as k,D as j,J as E,K as R,bE as q}from"./vendor-core-Di0OO4oJ.js";import"./index-CeAbLubS.js";const F={class:"server-log"},I={class:"log-message"},L={class:"log-detail-popover"},M={class:"mb-2"},O={class:"mb-2"},A={class:"log-detail-content"},B={class:"pagination-container"},D=q(f({__name:"index",setup(f){const{t:q}=h(),D=b(!1),N=b([]),G=b([]),J=b([]),K=y({currentPage:1,pageSize:20,total:0}),Q=y({month:"",file:"",level:""}),T=()=>e(null,null,function*(){try{const e=yield p();G.value=e,e.length>0&&(Q.month=e[0],yield $())}catch(e){}}),$=()=>e(null,null,function*(){if(Q.file="",J.value=[],Q.month)try{const e=yield g({month:Q.month});J.value=e,e.length>0?(Q.file=e[0].name,W()):(N.value=[],K.total=0)}catch(e){}}),H=()=>e(null,null,function*(){if(Q.month&&Q.file){D.value=!0;try{const e=yield v({page:K.currentPage,pageSize:K.pageSize,month:Q.month,file:Q.file,level:Q.level});e&&e.list?(N.value=e.list,K.total=e.total):(N.value=[],K.total=0)}catch(e){N.value=[],K.total=0}finally{D.value=!1}}}),W=()=>{K.currentPage=1,H()},X=()=>{Q.level="",T()},Y=e=>{K.currentPage=e,H()},Z=e=>{K.pageSize=e,K.currentPage=1,H()};return _(()=>{T()}),(e,p)=>{const g=o,v=t,f=a,h=n,b=l,y=s,_=i,T=u,H=r,ee=c,le=m,ae=d;return x(),w("div",F,[z(le,null,{default:C(()=>[z(b,{inline:!0,model:Q,class:"demo-form-inline"},{default:C(()=>[z(f,{label:V(q)("log.month")},{default:C(()=>[z(v,{modelValue:Q.month,"onUpdate:modelValue":p[0]||(p[0]=e=>Q.month=e),placeholder:V(q)("log.selectMonth"),onChange:$,style:{width:"140px"}},{default:C(()=>[(x(!0),w(U,null,k(G.value,e=>(x(),j(g,{key:e,label:e,value:e},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),z(f,{label:V(q)("log.file")},{default:C(()=>[z(v,{modelValue:Q.file,"onUpdate:modelValue":p[1]||(p[1]=e=>Q.file=e),placeholder:V(q)("log.selectFile"),onChange:W,style:{width:"220px"},"no-data-text":V(q)("log.selectMonthFirst")},{default:C(()=>[(x(!0),w(U,null,k(J.value,e=>(x(),j(g,{key:e.name,label:e.name+" ("+e.size+")",value:e.name},null,8,["label","value"]))),128))]),_:1},8,["modelValue","placeholder","no-data-text"])]),_:1},8,["label"]),z(f,{label:V(q)("log.level")},{default:C(()=>[z(v,{modelValue:Q.level,"onUpdate:modelValue":p[2]||(p[2]=e=>Q.level=e),placeholder:V(q)("log.allLevels"),clearable:"",onChange:W,style:{width:"120px"}},{default:C(()=>[z(g,{label:"ERROR",value:"error"}),z(g,{label:"INFO",value:"info"}),z(g,{label:"SQL",value:"sql"}),z(g,{label:"NOTICE",value:"notice"}),z(g,{label:"DEBUG",value:"debug"})]),_:1},8,["modelValue","placeholder"])]),_:1},8,["label"]),z(f,null,{default:C(()=>[z(h,{type:"primary",onClick:W},{default:C(()=>[E(R(V(q)("common.search")),1)]),_:1}),z(h,{onClick:X},{default:C(()=>[E(R(V(q)("common.reset")),1)]),_:1})]),_:1})]),_:1},8,["model"]),P((x(),j(H,{data:N.value,style:{width:"100%"}},{default:C(()=>[z(y,{prop:"time",label:V(q)("common.time"),width:"180"},null,8,["label"]),z(y,{prop:"level",label:V(q)("log.level"),width:"100"},{default:C(({row:e})=>{return[z(_,{type:(l=e.level,{error:"danger",info:"info",sql:"warning",notice:"primary",debug:"success"}[l.toLowerCase()]||"info")},{default:C(()=>[E(R(e.level.toUpperCase()),1)]),_:2},1032,["type"])];var l}),_:1},8,["label"]),z(y,{prop:"content",label:V(q)("log.content"),"min-width":"300"},{default:C(({row:e})=>[S("div",I,R(e.content),1)]),_:1},8,["label"]),z(y,{label:V(q)("common.operation"),width:"80",fixed:"right"},{default:C(({row:e})=>[z(T,{placement:"left",width:"600",trigger:"click"},{reference:C(()=>[z(h,{link:"",type:"primary"},{default:C(()=>[E(R(V(q)("common.detail")||"详情"),1)]),_:1})]),default:C(()=>[S("div",L,[S("div",M,[S("strong",null,R(V(q)("common.time"))+":",1),E(" "+R(e.time),1)]),S("div",O,[S("strong",null,R(V(q)("log.level"))+":",1),E(" "+R(e.level),1)]),S("pre",A,R(e.content),1)])]),_:2},1024)]),_:1},8,["label"])]),_:1},8,["data"])),[[ae,D.value]]),S("div",B,[z(ee,{"current-page":K.currentPage,"onUpdate:currentPage":p[3]||(p[3]=e=>K.currentPage=e),"page-size":K.pageSize,"onUpdate:pageSize":p[4]||(p[4]=e=>K.pageSize=e),"page-sizes":[10,20,50,100,200],layout:"total, sizes, prev, pager, next, jumper",total:K.total,onSizeChange:Z,onCurrentChange:Y},null,8,["current-page","page-size","total"])])]),_:1})])}}}),[["__scopeId","data-v-a240ece7"]]);export{D as default};
