var e,a;import{V as l,x as t,l as s,_ as u}from"./utils-lib.js?v=1761009159";import{j as o,r as n,c as i,s as r,w as v,q as c,H as d,I as p,y as b,v as m,x as f,F as y,z as x,e as _,B as h,b0 as g,Q as j,C as k,al as w,bN as S,N as T,A as I,ak as D,bO as E}from"./base-lib.js?v=1761009159";import{u as O,S as z}from"./useStore4.js?v=1761009159";import{getLoadInfo as C}from"./site.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const P=o("SITE-LOAD-STATE-STORE",()=>{const{siteInfo:e,siteType:a}=O();return{getLoadDataEvent:async e=>{try{const l=await C(e,a.value);return{status:l.status,data:l.data}}catch(l){return{status:!1,msg:"获取负载状态失败"}}}}}),{getLoadDataEvent:V}=P(),{siteInfo:A,siteType:L}=O(),N=n(""),F=n("java"===L.value?null!==(null==(e=A.value)?void 0:e.pid):null==(a=A.value)?void 0:a.run),H=n(!1),U=n(),q=n(),B=n(),J=n(),Q=n(),R=[{label:"名称",value:"name"},{label:"状态",value:"status"},{label:"用户",value:"user"},{label:"启动时间",value:"create_time",isTime:!0},{label:"PID",value:"pid"},{label:"PPID",value:"ppid"},{label:"线程",value:"threads"},{label:"Socket",value:"connects"},{label:"CPU",value:"cpu_percent"},{label:"内存",value:"memory_used",isSize:!0},{label:"io读",value:"io_read_bytes",isSize:!0},{label:"io写",value:"io_write_bytes",isSize:!0},{label:"命令",value:"exe"}],G=n([{label:"文件",prop:"path"},{label:"mode",prop:"mode",width:50},{label:"position",prop:"position",width:100},{label:"flags",prop:"flags",width:80},{label:"fd",prop:"fd",width:60}]),K=n([{label:"客户端地址",prop:"client_addr",render:e=>e.client_addr||"--"},{label:"客户端端口",prop:"client_rport"},{label:"协议",prop:"family"},{label:"FD",prop:"fd"},{label:"本地地址",prop:"local_addr"},{label:"本地端口",prop:"local_port"},{label:"状态",prop:"status"}]),M=e=>Q.value?e.isTime?l(Q.value[e.value]):e.isSize?t(Q.value[e.value]):Q.value[e.value]:"",W=async e=>{H.value=!0,q.value=U.value[e].open_files,B.value=U.value[e].connections,Q.value=U.value[e],H.value=!1},X=e=>{try{const a=(null==e?void 0:e.load_info)||(null==e?void 0:e.data);Object.keys(a).length&&(J.value=Object.keys(a).map(e=>e),N.value=J.value[0],q.value=a[N.value].open_files,B.value=a[N.value].connections,Q.value=a[N.value],U.value=a),"java"!==L.value&&(F.value=e.run)}catch(a){}},Y=async()=>{(async()=>{try{H.value=!0;let e={project_name:A.value.name};const a=L.value;"go"===a&&(e.has_load_info=1),"nodejs"===L.value&&(e.project_type=A.value.project_config.project_type||"nodejs");const l={java:e,default:{data:JSON.stringify(e)}},{data:t}=await V(l[a]||l.default);await X(t),H.value=!1}catch(e){return{status:!1,msg:"获取负载状态失败"}}})()},Z={class:"relative h-full"},$={key:0,class:"h-[68rem] overflow-auto"},ee={class:"flex items-center"},ae={class:"text-secondary text-small font-bold"},le={class:"text-small"},te={key:1,class:"bg-light flex items-center justify-center h-full",style:{"min-height":"600px"}},se={key:1,class:"bg-light flex items-center justify-center h-full",style:{"min-height":"600px"}},ue={class:"bg-lighter px-[48px] py-[16px] text-default flex"},oe=u(i({__name:"index",setup(e,{expose:a}){const{siteInfo:l,siteType:t}=r(z()),{jumpTabEvent:u}=z();return v(()=>l.value,e=>{var a,s;F.value="java"===t.value?null!==(null==(a=l.value)?void 0:a.pid):null==(s=l.value)?void 0:s.run},{immediate:!0}),c(Y),a({init:Y}),(e,a)=>{const l=D,t=w,o=E,n=S,i=s,r=d("bt-loading");return p((m(),f("div",Z,[b(F)?(m(),f("div",$,[b(N)?(m(),f(y,{key:0},[x("div",ee,[a[2]||(a[2]=x("span",{class:"mr-[1.6rem] font-bold text-base"},"进程",-1)),_(t,{modelValue:b(N),"onUpdate:modelValue":a[0]||(a[0]=e=>j(N)?N.value=e:null),onChange:b(W),class:"!w-[14rem]"},{default:h(()=>[(m(!0),f(y,null,g(b(J),e=>(m(),T(l,{key:e,label:e,value:e},null,8,["label","value"]))),128))]),_:1},8,["modelValue","onChange"])]),a[3]||(a[3]=x("span",{class:"text-secondary mt-[1.6rem] mb-[.8rem] block font-bold text-base"},"基础信息",-1)),_(n,{class:"mt-[20px] table-descriptions",column:3,border:""},{default:h(()=>[(m(!0),f(y,null,g(b(R),(e,a)=>(m(),T(o,{key:a,"label-class-name":["!bg-[#fff]"]},{label:h(()=>[x("span",ae,I(e.label),1)]),default:h(()=>[x("div",le,I(b(M)(e)),1)]),_:2},1024))),128))]),_:1}),a[4]||(a[4]=x("span",{class:"text-secondary mt-[1.6rem] mb-[.8rem] block font-bold text-base"},"网络",-1)),_(i,{"max-height":160,column:b(K),data:b(B)},null,8,["column","data"]),a[5]||(a[5]=x("span",{class:"text-secondary mt-[1.6rem] mb-[.8rem] block font-bold text-base"},"打开的文件列表",-1)),_(i,{height:210,column:b(G),data:b(q)},null,8,["column","data"])],64)):(m(),f("div",te,a[6]||(a[6]=[x("div",{class:"bg-lighter px-[48px] py-[16px] text-default flex"},"监听PID失败，请检查项目状态是否开启",-1)])))])):(m(),f("div",se,[x("div",ue,[a[7]||(a[7]=k(" 请开启 ",-1)),x("span",{class:"mx-[.4rem] bt-link",onClick:a[1]||(a[1]=e=>b(u)("state"))},"项目状态"),a[8]||(a[8]=k(" 后查看负载状态 ",-1))])]))])),[[r,b(H)]])}}}),[["__scopeId","data-v-7c1a4659"]]);export{oe as default};
