import{d as D,o as L,D as N,c as R,b as t,w as a,a1 as S,f as p,e as w,h as j,k as s,t as o,i as M,n as T,af as B}from"./index-CkzfmDGw.js";import{s as E}from"./monitor-wjQIzRk9.js";const J={class:"page-container"},q=D({__name:"index",setup(O){const l=w({}),x=w(null),P=w(null);let k=null,r=null,c=null;const y=[],h=[],f=[],U=[{title:"盘符路径",key:"path",width:100},{title:"总大小",key:"total",width:120},{title:"可用大小",key:"free",width:120},{title:"已用大小",key:"usable",width:120},{title:"使用率",key:"usedPercent",width:200,render(b){const _=parseFloat(b.usedPercent)||0;return T(B,{type:"line",percentage:_,indicatorPlacement:"inside",processing:_>80})}}];async function C(){try{l.value=await E.info(),V()}catch{}}function V(){var u,m,g,e,v;if(typeof window>"u")return;const b=new Date().toLocaleTimeString();f.push(b),f.length>10&&f.shift();const _=((u=l.value.cpu)==null?void 0:u.systemLoadAverage)||0;y.push(Math.min(_*10,100)),y.length>10&&y.shift();const n=parseInt(((g=(m=l.value.memory)==null?void 0:m.heapUsed)==null?void 0:g.replace(/[^\d]/g,""))||"0"),d=parseInt(((v=(e=l.value.memory)==null?void 0:e.heapMax)==null?void 0:v.replace(/[^\d]/g,""))||"1"),i=d>0?n/d*100:0;h.push(i),h.length>10&&h.shift(),!r&&x.value?S(()=>import("./index-C4rnF_7Z.js"),[]).then(I=>{r=I.init(x.value),c=I.init(P.value),A()}).catch(()=>{}):A()}function A(){!r||!c||(r.setOption({title:{text:"CPU负载",left:"center"},xAxis:{type:"category",data:f},yAxis:{type:"value",max:100},series:[{data:y,type:"line",smooth:!0,areaStyle:{}}]}),c.setOption({title:{text:"内存使用率 (%)",left:"center"},xAxis:{type:"category",data:f},yAxis:{type:"value",max:100},series:[{data:h,type:"line",smooth:!0,areaStyle:{}}]}))}return L(()=>{C(),k=setInterval(C,5e3)}),N(()=>{k&&clearInterval(k),r==null||r.dispose(),c==null||c.dispose()}),(b,_)=>{const n=p("n-descriptions-item"),d=p("n-descriptions"),i=p("n-card"),u=p("n-gi"),m=p("n-grid"),g=p("n-data-table");return j(),R("div",J,[t(m,{cols:2,"x-gap":16,"y-gap":16},{default:a(()=>[t(u,null,{default:a(()=>[t(i,{title:"CPU信息"},{default:a(()=>[t(d,{column:1,"label-placement":"left"},{default:a(()=>[t(n,{label:"操作系统"},{default:a(()=>{var e;return[s(o((e=l.value.cpu)==null?void 0:e.name),1)]}),_:1}),t(n,{label:"系统架构"},{default:a(()=>{var e;return[s(o((e=l.value.cpu)==null?void 0:e.arch),1)]}),_:1}),t(n,{label:"CPU核心数"},{default:a(()=>{var e;return[s(o((e=l.value.cpu)==null?void 0:e.availableProcessors),1)]}),_:1}),t(n,{label:"系统负载"},{default:a(()=>{var e,v;return[s(o((v=(e=l.value.cpu)==null?void 0:e.systemLoadAverage)==null?void 0:v.toFixed(2)),1)]}),_:1})]),_:1})]),_:1})]),_:1}),t(u,null,{default:a(()=>[t(i,{title:"内存信息"},{default:a(()=>[t(d,{column:1,"label-placement":"left"},{default:a(()=>[t(n,{label:"堆初始内存"},{default:a(()=>{var e;return[s(o((e=l.value.memory)==null?void 0:e.heapInit),1)]}),_:1}),t(n,{label:"堆已用内存"},{default:a(()=>{var e;return[s(o((e=l.value.memory)==null?void 0:e.heapUsed),1)]}),_:1}),t(n,{label:"堆最大内存"},{default:a(()=>{var e;return[s(o((e=l.value.memory)==null?void 0:e.heapMax),1)]}),_:1}),t(n,{label:"非堆已用内存"},{default:a(()=>{var e;return[s(o((e=l.value.memory)==null?void 0:e.nonHeapUsed),1)]}),_:1})]),_:1})]),_:1})]),_:1}),t(u,null,{default:a(()=>[t(i,{title:"JVM信息"},{default:a(()=>[t(d,{column:1,"label-placement":"left"},{default:a(()=>[t(n,{label:"JVM名称"},{default:a(()=>{var e;return[s(o((e=l.value.jvm)==null?void 0:e.name),1)]}),_:1}),t(n,{label:"JVM版本"},{default:a(()=>{var e;return[s(o((e=l.value.jvm)==null?void 0:e.version),1)]}),_:1}),t(n,{label:"启动时间"},{default:a(()=>{var e;return[s(o((e=l.value.jvm)==null?void 0:e.startTime),1)]}),_:1}),t(n,{label:"运行时长"},{default:a(()=>{var e;return[s(o((e=l.value.jvm)==null?void 0:e.uptime),1)]}),_:1})]),_:1})]),_:1})]),_:1}),t(u,null,{default:a(()=>[t(i,{title:"服务器信息"},{default:a(()=>[t(d,{column:1,"label-placement":"left"},{default:a(()=>[t(n,{label:"服务器名称"},{default:a(()=>{var e;return[s(o((e=l.value.sys)==null?void 0:e.hostName),1)]}),_:1}),t(n,{label:"服务器IP"},{default:a(()=>{var e;return[s(o((e=l.value.sys)==null?void 0:e.hostAddress),1)]}),_:1}),t(n,{label:"操作系统"},{default:a(()=>{var e;return[s(o((e=l.value.sys)==null?void 0:e.osName),1)]}),_:1}),t(n,{label:"系统版本"},{default:a(()=>{var e;return[s(o((e=l.value.sys)==null?void 0:e.osVersion),1)]}),_:1})]),_:1})]),_:1})]),_:1})]),_:1}),t(i,{title:"磁盘信息",style:{"margin-top":"16px"}},{default:a(()=>[t(g,{columns:U,data:l.value.disks||[],"row-key":e=>e.path},null,8,["data","row-key"])]),_:1}),t(i,{title:"实时监控图表",style:{"margin-top":"16px"}},{default:a(()=>[t(m,{cols:2,"x-gap":16},{default:a(()=>[t(u,null,{default:a(()=>[M("div",{ref_key:"cpuChartRef",ref:x,style:{height:"300px"}},null,512)]),_:1}),t(u,null,{default:a(()=>[M("div",{ref_key:"memoryChartRef",ref:P,style:{height:"300px"}},null,512)]),_:1})]),_:1})]),_:1})])}}});export{q as default};
