← Back
Editing: index347.js
import{_ as e}from"./index103.js?v=VERSION_NUMBER";import{s as a,j as t,r as l,c as s,g as o,a4 as r,q as n,v as u,e as d,A as p,y as i,x as c,P as m,M as b,C as _,B as v,H as y,I as f,b6 as h,D as g}from"./base-lib.js?v=VERSION_NUMBER";import{_ as w}from"./index123.js?v=VERSION_NUMBER";import{iP as D,iQ as x,M as C,R as M,iR as T,u as j,w as N,fj as R,iS as V,iT as I,$ as k,e as q}from"./utils-lib.js?v=VERSION_NUMBER";import{u as O}from"./useController10.js?v=VERSION_NUMBER";import"./__commonjsHelpers__.js?v=VERSION_NUMBER";const P=t("CLB-LOG-STORE",(()=>{const e=l("today"),a=l(""),t=l("");return{currentTab:e,logCustomDate:a,dateTabs:l([{label:"今天",value:"today"},{label:"昨天",value:"yesterday"},{label:"自定义时间",value:"custom"}]),currentDate:t}})),Y=()=>a(P()),{activeTabs:A}=O(),{logCustomDate:B,currentDate:H}=Y(),J=async e=>{const a="http"===A.value?await D({load_id:e.load_id,date:H.value}):await x({load_id:e.load_id,date:H.value});a.status?window.open("/download?filename="+a.data.filename):C.error("导出失败")},S=e=>{let a="";return"today"===e&&(a=M(new Date,"yyyy-MM-dd")),"yesterday"===e&&(a=M(T(-1),"yyyy-MM-dd")),"custom"===e&&(a=null==B?void 0:B.value),H.value=a,a};function U(e){const a=e.match(/^(\d{2})\/(\w{3})\/(\d{4}):(\d{2}):(\d{2}):(\d{2})/);if(!a)return e;const[,t,l,s,o,r,n]=a,u={Jan:"01",Feb:"02",Mar:"03",Apr:"04",May:"05",Jun:"06",Jul:"07",Aug:"08",Sep:"09",Oct:"10",Nov:"11",Dec:"12"}[l];return"".concat(s,"-").concat(u,"-").concat(t," ").concat(o,":").concat(r,":").concat(n)}const E={class:"p-[2rem] node-clb-http-log"},L={class:"flex items-center"},F=q(s({__name:"index",props:{compData:{default:()=>({row:{load_id:0}})}},setup(a){const{mainHeight:t}=j(),{activeTabs:s}=O(),{currentTab:D,logCustomDate:x,dateTabs:M,currentDate:T}=Y(),q=a,P=o((()=>q.compData.row));let A=l(-1);const B=e=>{D.value=e,A.value=-1,"custom"!==e&&(x.value="",F())},H=e=>{A.value=-1,e&&(x.value=e,F())},F=()=>{z()},G=e=>{"first"===e?(A.value=-1,z()):"next"===e&&z()},Q=l("tcpudp"===s.value?[{label:"时间",prop:"time_local",width:180,render:e=>U(e.time_local)},{label:"客户端IP",prop:"remote_addr"},{label:"协议",prop:"protocol"},{label:"响应状态",prop:"status"},{label:"发送大小",prop:"bytes_sent",render:e=>N(Number(e.bytes_sent))},{label:"接收大小",prop:"bytes_received",render:e=>N(Number(e.bytes_received))},{label:"会话耗时(秒)",prop:"session_time",render:e=>"".concat(e.session_time)},{label:"节点地址",prop:"upstream_addr",width:120},{label:"TO大小",prop:"upstream_bytes_sent",render:e=>N(Number(e.upstream_bytes_sent))},{label:"RE大小",prop:"upstream_bytes_received",render:e=>N(Number(e.upstream_bytes_received))},{label:"连接耗时(秒)",prop:"upstream_connect_time",render:e=>"".concat(e.upstream_connect_time)}]:[{label:"时间",prop:"time",render:e=>U(e.time)},{label:"客户端IP",prop:"remote_addr"},{label:"请求类型",prop:"request_method",width:80},{label:"负载节点",prop:"upstream_addr"},{label:"回源耗时(秒)",prop:"upstream_response_time"},{label:"主体大小",prop:"body_bytes_sent",render:e=>N(Number(e.body_bytes_sent))},{label:"传输大小",prop:"bytes_sent",render:e=>N(Number(e.bytes_sent))},{label:"响应状态",prop:"status"},{label:"URI",prop:"request_uri"}]),{BtTable:$,refresh:z}=R({request:async e=>{const a={load_id:P.value.load_id,date:S(D.value),position:A.value,limit:10},{data:t}="tcpudp"===s.value?await V(a):await I(a);return t.msg&&!1===t.status&&C.error(t.msg),A.value=t.data.last_position,{data:t.data.logs||[],total:0,other:{}}},columns:Q.value});return r((()=>{x.value="",T.value="",D.value="today"})),(a,l)=>{const s=k,o=h,r=w,C=g,T=e;return n(),u("div",E,[d(T,null,{"header-left":p((()=>[i("div",L,[i("div",null,[d(s,{type:"button",modelValue:c(D),"onUpdate:modelValue":l[0]||(l[0]=e=>m(D)?D.value=e:null),options:c(M),onChange:B,class:"mr-[1rem] !flex-nowrap"},null,8,["modelValue","options"])]),"custom"===c(D)?(n(),b(o,{key:0,modelValue:c(x),"onUpdate:modelValue":l[1]||(l[1]=e=>m(x)?x.value=e:null),type:"date",placeholder:"请选择日期","value-format":"YYYY-MM-DD",onChange:H,class:"ml-2"},null,8,["modelValue"])):_("",!0)])])),"header-right":p((()=>[d(r,{class:"ml-[10px]",onRefresh:l[2]||(l[2]=e=>G("first"))}),d(C,{type:"success",onClick:l[3]||(l[3]=e=>c(J)(c(P)))},{default:p((()=>l[6]||(l[6]=[i("i",{class:"el-icon-download"},null,-1),v(" 导出日志 ")]))),_:1})])),content:p((()=>[d(c($),{"min-height":c(t)},null,8,["min-height"])])),"footer-right":p((()=>[d(C,{type:"info",text:"",bg:"",onClick:l[4]||(l[4]=e=>G("first"))},{default:p((()=>l[7]||(l[7]=[v("首页")]))),_:1}),y(d(C,{type:"info",text:"",bg:"",onClick:l[5]||(l[5]=e=>G("next"))},{default:p((()=>l[8]||(l[8]=[v("下一页")]))),_:1},512),[[f,c(A)>0]])])),_:1})])}}}),[["__scopeId","data-v-a754b624"]]);export{F as default};
Save File
Cancel