index-498ea54c.js 9.1 KB

12
  1. import{d as m,aC as S,c as v,Y as L,Z as c,a1 as _,a7 as f,n as l,a0 as A,T as r,r as F,cw as P,bp as T,ay as w,a5 as z,$ as C,h as R,a2 as U,a3 as B,be as G}from"./index-8a67e3df.js";import"./dayjs-919e6097.js";import{S as N}from"./index-82d2c624.js";import{_ as M}from"./index.vue_vue_type_script_setup_true_lang-d980f666.js";import{_ as $,L as I}from"./index.vue_vue_type_script_setup_true_lang-fe30c327.js";import{S as u}from"./Statistic-421016fc.js";import{a as y,b as x,c as k,g as D}from"./utils-cec4b140.js";import{u as E}from"./system-7d6c6ba1.js";import"./toInteger-9a80771f.js";const K={class:"mt-16px text-center"},H=m({__name:"hard-disk",props:{hardDisk:{},backgroundColor:{}},setup(p){const{t:a}=S(),t=p,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(n){return Math.round(n*1)+"%"},color:"inherit"},get data(){return[{value:0,name:a("routes.overview.已用存储")}]}}]},s=v(e);return L(()=>{e.series[0].data[0].value=t.hardDisk?.usage||0,s.value={...e}}),(n,o)=>(c(),_("div",null,[f("div",K,[l(r(u),{title:r(a)("routes.overview.总存储"),value:n.hardDisk?.total||0,valueStyle:{fontSize:"18px"}},{suffix:A(()=>o[0]||(o[0]=[f("span",null," G",-1)])),_:1},8,["title","value"]),l(r(u),{title:r(a)("routes.overview.空闲存储"),value:n.hardDisk?.free||0,valueStyle:{fontSize:"18px"}},{suffix:A(()=>o[1]||(o[1]=[f("span",null," G",-1)])),_:1},8,["title","value"])]),l($,{option:s.value,class:"h-140px w-240px"},null,8,["option"])]))}}),W={class:"flex"},b="p-14px rounded-16px bg-#fff dark:bg-#100C2A flex-center flex-1 mr-10px",Z=m({__name:"top-info",props:{data:{},hardDisk:{}},setup(p){const{t:a}=S(),t=F({version:"",startTime:"",localIP:"",os:"",arch:"",cpus:0,goVersion:"",plugins:[]});return P().then(e=>{Object.assign(t,e),t.startTime=T.toDateString(new Date(e.startTime),"yyyy-MM-dd HH:mm:ss")}).catch(e=>{console.error(`getSysInfo-err: ${e}`)}),(e,s)=>(c(),_("div",W,[l(H,{class:w([b,"min-w-320px"]),hardDisk:e.hardDisk},null,8,["hardDisk"]),f("div",{class:w([b,"min-w-140px"])},[l(r(N),{icon:"streams",size:"70",class:"text-#bb86fc"}),l(r(u),{title:r(a)("routes.overview.当前流数"),value:e.data},null,8,["title","value"])]),f("div",{class:w([b,"min-w-210px flex-col flex-items-start"])},[l(r(u),{title:r(a)("routes.overview.本地IP"),value:t.localIP,valueStyle:{fontSize:"18px",textAlign:"left"}},null,8,["title","value"]),l(r(u),{title:r(a)("routes.overview.启动时间"),value:t.startTime,valueStyle:{fontSize:"18px"}},{suffix:A(()=>[s[0]||(s[0]=z(" [")),l(r(M),{value:t.startTime,class:"text-primary"},null,8,["value"]),s[1]||(s[1]=z("] "))]),_:1},8,["title","value"])]),f("div",{class:w([b,"min-w-210px flex-col flex-items-start"])},[l(r(u),{class:"overflow-auto",title:r(a)("routes.overview.当前版本"),value:t.version,valueStyle:{fontSize:"18px"}},null,8,["title","value"]),l(r(u),{title:r(a)("routes.overview.Go版本"),value:t.goVersion,valueStyle:{fontSize:"18px"}},null,8,["title","value"]),l(r(u),{title:r(a)("routes.overview.插件数"),value:t.plugins.length,valueStyle:{fontSize:"18px"}},null,8,["title","value"])]),f("div",{class:w([b,"min-w-210px flex-col flex-items-start"])},[l(r(u),{class:"overflow-auto",title:r(a)("routes.overview.操作系统"),value:t.os,valueStyle:{fontSize:"18px"}},null,8,["title","value"]),l(r(u),{class:"overflow-auto",title:r(a)("routes.overview.CPU架构"),value:t.arch,valueStyle:{fontSize:"18px"}},null,8,["title","value"]),l(r(u),{title:r(a)("routes.overview.CPU核数"),value:t.cpus,valueStyle:{fontSize:"18px"}},null,8,["title","value"])])]))}}),O=m({__name:"memory",setup(p,{expose:a}){const{t}=S();let e=[y()],s=[0];const n={backgroundColor:"",color:["#80FFA5"],title:{get text(){return t("routes.overview.内存使用情况")}},tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}},formatter:function(i){var d=i[0].name+"<br>";for(let h of i)d+=h.seriesName+" : "+h.value+"%<br>";return d}},legend:{get data(){return[t("routes.overview.内存使用率")]}},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:[{get name(){return t("routes.overview.内存使用率")},type:"line",stack:"Total",smooth:!0,lineStyle:{width:0},showSymbol:!1,areaStyle:{opacity:.8,color:new I(0,0,0,1,[{offset:0,color:"rgb(128, 255, 165)"},{offset:1,color:"rgb(1, 191, 236)"}])},emphasis:{focus:"series"},data:s}]},o=v(n);return a({handleUpdate:i=>{x(e,y()),x(s,Math.round(i)),o.value={...n}}}),(i,d)=>(c(),C($,{option:o.value,class:"h-300px p-14px rounded-16px bg-#fff dark:bg-#100C2A"},null,8,["option"]))}}),j=m({__name:"cpu",setup(p,{expose:a}){const{t}=S();let e=[y()],s=[0];const n={backgroundColor:"",color:["#00DDFF"],title:{get text(){return t("routes.overview.CPU使用情况")}},tooltip:{trigger:"axis",axisPointer:{type:"cross",label:{backgroundColor:"#6a7985"}},formatter:function(i){var d=i[0].name+"<br>";for(let h of i)d+=h.seriesName+" : "+h.value+"%<br>";return d}},legend:{get data(){return[t("routes.overview.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:[{get name(){return t("routes.overview.CPU使用率")},type:"line",stack:"Total",smooth:!0,lineStyle:{width:0},showSymbol:!1,areaStyle:{opacity:.8,color:new I(0,0,0,1,[{offset:0,color:"rgb(0, 221, 255)"},{offset:1,color:"rgb(77, 119, 255)"}])},emphasis:{focus:"series"},data:s}]},o=v(n);return a({handleUpdate:i=>{x(e,y()),x(s,Math.round(i)),o.value={...n}}}),(i,d)=>(c(),C($,{option:o.value,class:"p-14px rounded-16px bg-#fff dark:bg-#100C2A h-300px"},null,8,["option"]))}}),V=m({__name:"network-item",props:{network:{}},setup(p){const{t:a}=S(),t=p,e={text:t.network.name||"",receiveData:[k(t.network.receiveSpeed||0)],sentData:[k(t.network.sentSpeed||0)],timeData:[y()],sent:t.network.sent,receive:t.network.receive},s={backgroundColor:"",title:{text:e.text,top:-5},tooltip:{trigger:"axis",formatter:function(o){var g=o[0].name+"<br>";for(let i of o)g+=i.seriesName?.split(":")[0]+" : "+i.value+" KB/s <br>";return g}},legend:{get data(){return[`${a("routes.overview.发送")}: ${D(e.sent||0)}`,`${a("routes.overview.接收")}: ${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:[{get name(){return`${a("routes.overview.发送")} (KB/s)`},type:"value"},{get name(){return`${a("routes.overview.接收")} (KB/s)`},gridIndex:1,type:"value",inverse:!0}],series:[{get name(){return`${a("routes.overview.发送")}: ${D(e.sent||0)}`},type:"line",smooth:!0,showSymbol:!0,data:e.sentData,label:{show:!0},lineStyle:{color:"#bb86fc"},itemStyle:{color:"#bb86fc"}},{get name(){return`${a("routes.overview.接收")}: ${D(e.receive)}`},type:"line",xAxisIndex:1,yAxisIndex:1,showSymbol:!0,data:e.receiveData,label:{show:!0},lineStyle:{color:"#5a00ff"},itemStyle:{color:"#5a00ff"}}]},n=v(s);return R(()=>t.network,o=>{e.text=o.name,e.timeData=x(e.timeData,y()),e.sentData=x(e.sentData,k(o.sentSpeed||0)),e.receiveData=x(e.receiveData,k(o.receiveSpeed||0)),e.sent=o.sent,e.receive=o.receive,n.value={...s}},{immediate:!1}),(o,g)=>(c(),C($,{option:n.value,class:"rounded-16px bg-#fff dark:bg-#100C2A h-328px p-14px"},null,8,["option"]))}}),X={class:"flex flex-wrap mt-8px"},Y=m({__name:"network",setup(p,{expose:a}){const t=v([]);return a({handleUpdate:s=>{t.value=s}}),(s,n)=>(c(),_("div",X,[(c(!0),_(U,null,B(t.value,o=>(c(),C(V,{key:o.name,network:o,class:"flex-1 min-w-380px mr-8px mb-8px"},null,8,["network"]))),128))]))}}),q={class:"mt-8px flex"},J=m({name:"Overview"}),ie=m({...J,setup(p){const a=E(),t=v(),e=v(),s=v(),n=a.registerSummaryCallback(o=>{t?.value?.handleUpdate(o?.memory?.usage),e?.value?.handleUpdate(o?.cpuUsage||0),s?.value?.handleUpdate(o?.netWork)});return G(n),(o,g)=>(c(),_(U,null,[l(Z,{hardDisk:r(a).summary?.hardDisk,data:r(a).summary?.streamCount||0},null,8,["hardDisk","data"]),f("div",q,[l(O,{ref_key:"memoryRef",ref:t,class:"flex-1 mr-10px"},null,512),l(j,{ref_key:"cpuRef",ref:e,class:"flex-1"},null,512)]),l(Y,{ref_key:"networkRef",ref:s},null,512)],64))}});export{ie as default};
  2. //# sourceMappingURL=index-498ea54c.js.map