import{_ as e}from"./index105.js?v=1761009159";import{s as a,j as t,r as l,c as s,g as o,a6 as r,v as n,x as u,e as d,B as p,z as i,y as c,Q as m,N as _,D as b,C as v,I as y,J as f,b9 as h,G as g}from"./base-lib.js?v=1761009159";import{_ as w}from"./index126.js?v=1761009159";import{jj as j,jk as x,M as D,V as C,jl as M,u as T,x as N,fO as V,jm as k,jn as I,ag as O,_ as J}from"./utils-lib.js?v=1761009159";import{u as R}from"./useController10.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const Y=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}}),q=()=>a(Y()),{activeTabs:B}=R(),{logCustomDate:U,currentDate:A}=q(),E=async e=>{const a="http"===B.value?await j({load_id:e.load_id,date:A.value}):await x({load_id:e.load_id,date:A.value});a.status?window.open("/download?filename="+a.data.filename):D.error("导出失败")},G=e=>{let a="";return"today"===e&&(a=C(new Date,"yyyy-MM-dd")),"yesterday"===e&&(a=C(M(-1),"yyyy-MM-dd")),"custom"===e&&(a=null==U?void 0:U.value),A.value=a,a};function H(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 L={class:"p-[2rem] node-clb-http-log"},P={class:"flex items-center"},S=J(s({__name:"index",props:{compData:{default:()=>({row:{load_id:0}})}},setup(a){const{mainHeight:t}=T(),{activeTabs:s}=R(),{currentTab:j,logCustomDate:x,dateTabs:C,currentDate:M}=q(),J=a,Y=o(()=>J.compData.row);let B=l(-1);const U=e=>{j.value=e,B.value=-1,"custom"!==e&&(x.value="",S())},A=e=>{B.value=-1,e&&(x.value=e,S())},S=()=>{K()},z=e=>{"first"===e?(B.value=-1,K()):"next"===e&&K()},F=l("tcpudp"===s.value?[{label:"时间",prop:"time_local",width:180,render:e=>H(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=>H(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:Q,refresh:K}=V({request:async e=>{const a={load_id:Y.value.load_id,date:G(j.value),position:B.value,limit:10},{data:t}="tcpudp"===s.value?await k(a):await I(a);return t.msg&&!1===t.status&&D.error(t.msg),B.value=t.data.last_position,{data:t.data.logs||[],total:0,other:{}}},columns:F.value});return r(()=>{x.value="",M.value="",j.value="today"}),(a,l)=>{const s=O,o=h,r=w,D=g,M=e;return n(),u("div",L,[d(M,null,{"header-left":p(()=>[i("div",P,[i("div",null,[d(s,{type:"button",modelValue:c(j),"onUpdate:modelValue":l[0]||(l[0]=e=>m(j)?j.value=e:null),options:c(C),onChange:U,class:"mr-[1rem] !flex-nowrap"},null,8,["modelValue","options"])]),"custom"===c(j)?(n(),_(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:A,class:"ml-2"},null,8,["modelValue"])):b("",!0)])]),"header-right":p(()=>[d(r,{class:"ml-[10px]",onRefresh:l[2]||(l[2]=e=>z("first"))}),d(D,{type:"success",onClick:l[3]||(l[3]=e=>c(E)(c(Y)))},{default:p(()=>l[6]||(l[6]=[i("i",{class:"el-icon-download"},null,-1),v(" 导出日志 ",-1)])),_:1,__:[6]})]),content:p(()=>[d(c(Q),{"min-height":c(t)},null,8,["min-height"])]),"footer-right":p(()=>[d(D,{type:"info",text:"",bg:"",onClick:l[4]||(l[4]=e=>z("first"))},{default:p(()=>l[7]||(l[7]=[v("首页",-1)])),_:1,__:[7]}),y(d(D,{type:"info",text:"",bg:"",onClick:l[5]||(l[5]=e=>z("next"))},{default:p(()=>l[8]||(l[8]=[v("下一页",-1)])),_:1,__:[8]},512),[[f,c(B)>0]])]),_:1})])}}}),[["__scopeId","data-v-a754b624"]]);export{S as default};
