1 |
- import{d as g,k as v,s as I,X as f,a6 as S,a9 as x,f as s,Z as C,u,r as F,a7 as b,E as $,Y as w,w as L,F as z,a2 as P,x as T}from"./vue-fae2b924.js";import{i as B}from"./global-f6e5c3a3.js";import{bv as p,av as G,b8 as N,bw as U}from"./radical-e583b742.js";import{x as M}from"./index-7a259168.js";import{_ as D}from"./index.vue_vue_type_script_setup_true_lang-6147e0c6.js";import{a as h,b as y,c as k,g as d}from"./utils-b13a2728.js";import{u as E}from"./system-8e8b1ac3.js";const K={class:"mt-16px text-center"},R=g({__name:"hard-disk",props:{hardDisk:{},backgroundColor:{}},setup(m){const t=m,e={backgroundColor:"",tooltip:{trigger:"item",formatter:"{a} <br/>{b} : {c}%"},series:[{type:"gauge",startAngle:180,endAngle:0,center:["50%","90%"],radius:"140%",min:0,max:100,splitNumber:5,axisLine:{lineStyle:{width:7,color:[[.25,"#7CFFB2"],[.5,"#58D9F9"],[.75,"#FDDD60"],[1,"#FF6E76"]]}},pointer:{icon:"path://M12.8,0.7l12,40.1H0.7L12.8,0.7z",length:"14%",width:8,offsetCenter:[0,"-60%"],itemStyle:{color:"auto"}},axisTick:{length:5,lineStyle:{color:"auto",width:2}},splitLine:{length:8,lineStyle:{color:"auto",width:3}},axisLabel:{color:"#464646",fontSize:20,distance:0,rotate:"tangential",formatter:function(){return""}},title:{offsetCenter:[0,"-6%"],fontSize:14,color:"#9ca3af"},detail:{fontSize:24,offsetCenter:[0,"-30%"],valueAnimation:!0,formatter:function(o){return Math.round(o*1)+"%"},color:"inherit"},data:[{value:0,name:"已用存储"}]}]},a=v(e);return I(()=>{var o;e.series[0].data[0].value=((o=t.hardDisk)==null?void 0:o.usage)||0,a.value={...e}}),(o,r)=>{var l,n;return f(),S("div",null,[x("div",K,[s(u(p),{title:"总存储",value:((l=o.hardDisk)==null?void 0:l.total)||0,valueStyle:{fontSize:"18px"}},{suffix:C(()=>r[0]||(r[0]=[x("span",null," G",-1)])),_:1},8,["value"]),s(u(p),{title:"空闲存储",value:((n=o.hardDisk)==null?void 0:n.free)||0,valueStyle:{fontSize:"18px"}},{suffix:C(()=>r[1]||(r[1]=[x("span",null," G",-1)])),_:1},8,["value"])]),s(D,{option:a.value,class:"h-140px w-240px"},null,8,["option"])])}}}),H={class:"flex"},_="p-14px rounded-16px bg-#fff dark:bg-#100C2A flex-center flex-1 mr-10px",W=g({__name:"top-info",props:{data:{},hardDisk:{}},setup(m){const t=F({version:"",startTime:"",localIP:"",os:"",arch:"",cpus:0,goVersion:"",plugins:[]});return B().then(e=>{Object.assign(t,e),t.startTime=M.toDateString(new Date(e.startTime),"yyyy-MM-dd HH:mm:ss")}).catch(e=>{console.error(`getSysInfo-err: ${e}`)}),(e,a)=>(f(),S("div",H,[s(R,{class:b([_,"min-w-320px"]),hardDisk:e.hardDisk},null,8,["hardDisk"]),x("div",{class:b([_,"min-w-140px"])},[s(u(G),{icon:"streams",size:"70",class:"text-#bb86fc"}),s(u(p),{title:"当前流数",value:e.data},null,8,["value"])]),x("div",{class:b([_,"min-w-210px flex-col flex-items-start"])},[s(u(p),{title:"本地IP",value:t.localIP,valueStyle:{fontSize:"18px",textAlign:"left"}},null,8,["value"]),s(u(p),{title:"启动时间",value:t.startTime,valueStyle:{fontSize:"18px"}},{suffix:C(()=>[a[0]||(a[0]=$(" [")),s(u(N),{value:t.startTime,class:"text-primary"},null,8,["value"]),a[1]||(a[1]=$("] "))]),_:1},8,["value"])]),x("div",{class:b([_,"min-w-210px flex-col flex-items-start"])},[s(u(p),{class:"overflow-auto",title:"当前版本",value:t.version,valueStyle:{fontSize:"18px"}},null,8,["value"]),s(u(p),{title:"Go版本",value:t.goVersion,valueStyle:{fontSize:"18px"}},null,8,["value"]),s(u(p),{title:"插件数",value:t.plugins.length,valueStyle:{fontSize:"18px"}},null,8,["value"])]),x("div",{class:b([_,"min-w-210px flex-col flex-items-start"])},[s(u(p),{class:"overflow-auto",title:"操作系统",value:t.os,valueStyle:{fontSize:"18px"}},null,8,["value"]),s(u(p),{class:"overflow-auto",title:"CPU架构",value:t.arch,valueStyle:{fontSize:"18px"}},null,8,["value"]),s(u(p),{title:"CPU核数",value:t.cpus,valueStyle:{fontSize:"18px"}},null,8,["value"])])]))}}),Z=g({__name:"memory",setup(m,{expose:t}){let e=[h()],a=[0];const o={backgroundColor:"",color:["#80FFA5"],title:{text:"内存使用情况"},tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}},formatter:function(n){var i=n[0].name+"<br>";for(let c of n)i+=c.seriesName+" : "+c.value+"%<br>";return i}},legend:{data:["内存使用率"]},toolbox:{feature:{saveAsImage:{}}},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:[{type:"category",boundaryGap:!1,data:e}],yAxis:[{type:"value",axisLabel:{show:!0,interval:"auto",formatter:"{value} %"}}],series:[{name:"内存使用率",type:"line",stack:"Total",smooth:!0,lineStyle:{width:0},showSymbol:!1,areaStyle:{opacity:.8,color:new U(0,0,0,1,[{offset:0,color:"rgb(128, 255, 165)"},{offset:1,color:"rgb(1, 191, 236)"}])},emphasis:{focus:"series"},data:a}]},r=v(o);return t({handleUpdate:n=>{y(e,h()),y(a,Math.round(n)),r.value={...o}}}),(n,i)=>(f(),w(D,{option:r.value,class:"h-300px p-14px rounded-16px bg-#fff dark:bg-#100C2A"},null,8,["option"]))}}),O=g({__name:"cpu",setup(m,{expose:t}){let e=[h()],a=[0];const o={backgroundColor:"",color:["#00DDFF"],title:{text:"CPU 使用情况"},tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}},formatter:function(n){var i=n[0].name+"<br>";for(let c of n)i+=c.seriesName+" : "+c.value+"%<br>";return i}},legend:{data:["CPU使用率"]},toolbox:{feature:{saveAsImage:{}}},grid:{left:"3%",right:"4%",bottom:"3%",containLabel:!0},xAxis:[{type:"category",boundaryGap:!1,data:e}],yAxis:[{type:"value",axisLabel:{show:!0,interval:"auto",formatter:"{value} %"}}],series:[{name:"CPU使用率",type:"line",stack:"Total",smooth:!0,lineStyle:{width:0},showSymbol:!1,areaStyle:{opacity:.8,color:new U(0,0,0,1,[{offset:0,color:"rgb(0, 221, 255)"},{offset:1,color:"rgb(77, 119, 255)"}])},emphasis:{focus:"series"},data:a}]},r=v(o);return t({handleUpdate:n=>{y(e,h()),y(a,Math.round(n)),r.value={...o}}}),(n,i)=>(f(),w(D,{option:r.value,class:"p-14px rounded-16px bg-#fff dark:bg-#100C2A h-300px"},null,8,["option"]))}}),j=g({__name:"network-item",props:{network:{}},setup(m){const t=m,e={text:t.network.name||"",receiveData:[k(t.network.receiveSpeed||0)],sentData:[k(t.network.sentSpeed||0)],timeData:[h()],sent:t.network.sent,receive:t.network.receive},a={backgroundColor:"",title:{text:e.text,top:-5},tooltip:{trigger:"axis",formatter:function(r){var n;var l=r[0].name+"<br>";for(let i of r)l+=((n=i.seriesName)==null?void 0:n.split(":")[0])+" : "+i.value+" KB/s <br>";return l}},legend:{data:[`发送: ${d(e.sent||0)}`,`接收: ${d(e.receive||0)}`],right:10},axisPointer:{link:{xAxisIndex:"all"}},grid:[{left:50,right:50,height:"35%"},{left:50,right:50,top:"55%",height:"35%"}],xAxis:[{type:"category",boundaryGap:!1,axisLine:{onZero:!0},data:e.timeData},{gridIndex:1,type:"category",boundaryGap:!1,axisLine:{onZero:!0},data:e.timeData,position:"top"}],yAxis:[{name:"发送 (KB/s)",type:"value"},{name:"接收 (KB/s)",gridIndex:1,type:"value",inverse:!0}],series:[{name:`发送: ${d(e.sent||0)}`,type:"line",smooth:!0,showSymbol:!0,data:e.sentData,label:{show:!0},lineStyle:{color:"#bb86fc"},itemStyle:{color:"#bb86fc"}},{name:`接收: ${d(e.receive)}`,type:"line",xAxisIndex:1,yAxisIndex:1,showSymbol:!0,data:e.receiveData,label:{show:!0},lineStyle:{color:"#5a00ff"},itemStyle:{color:"#5a00ff"}}]},o=v(a);return L(()=>t.network,r=>{e.text=r.name,e.timeData=y(e.timeData,h()),e.sentData=y(e.sentData,k(r.sentSpeed||0)),e.receiveData=y(e.receiveData,k(r.receiveSpeed||0)),a.legend.data=[`发送: ${d(e.sent||0)}`,`接收: ${d(e.receive||0)}`],a.series[0].name=`发送: ${d(e.sent||0)}`,a.series[1].name=`接收: ${d(e.receive||0)}`,e.sent=r.sent,e.receive=r.receive,o.value={...a}},{immediate:!1}),(r,l)=>(f(),w(D,{option:o.value,class:"rounded-16px bg-#fff dark:bg-#100C2A h-328px p-14px"},null,8,["option"]))}}),V={class:"flex flex-wrap mt-8px"},X=g({__name:"network",setup(m,{expose:t}){const e=v([]);return t({handleUpdate:o=>{e.value=o}}),(o,r)=>(f(),S("div",V,[(f(!0),S(z,null,P(e.value,l=>(f(),w(j,{key:l.name,network:l,class:"flex-1 min-w-380px mr-8px mb-8px"},null,8,["network"]))),128))]))}}),Y={class:"mt-8px flex"},q=g({name:"Overview"}),le=g({...q,setup(m){const t=E(),e=v(),a=v(),o=v(),r=t.registerSummaryCallback(l=>{var n,i,c,A;(i=e==null?void 0:e.value)==null||i.handleUpdate((n=l==null?void 0:l.memory)==null?void 0:n.usage),(c=a==null?void 0:a.value)==null||c.handleUpdate((l==null?void 0:l.cpuUsage)||0),(A=o==null?void 0:o.value)==null||A.handleUpdate(l==null?void 0:l.netWork)});return T(r),(l,n)=>{var i,c;return f(),S(z,null,[s(W,{hardDisk:(i=u(t).summary)==null?void 0:i.hardDisk,data:((c=u(t).summary)==null?void 0:c.streamCount)||0},null,8,["hardDisk","data"]),x("div",Y,[s(Z,{ref_key:"memoryRef",ref:e,class:"flex-1 mr-10px"},null,512),s(O,{ref_key:"cpuRef",ref:a,class:"flex-1"},null,512)]),s(X,{ref_key:"networkRef",ref:o},null,512)],64)}}});export{le as default};
|