2 lines
26 KiB
JavaScript
2 lines
26 KiB
JavaScript
import{E as lt}from"./el-alert-CXL71XZC.js";import{E as rt}from"./index-DX856o1n.js";import{E as nt,a as it}from"./el-select-ChgtowfW.js";import{E as st}from"./el-drawer-BtSlTJ5l.js";import{E as ot}from"./el-empty-Bo2Y2-ei.js";import{E as ut}from"./el-progress-C9JvFucC.js";import{E as dt}from"./el-switch-D1Sruu1c.js";import{a as vt,E as mt}from"./el-table-QP_Oajod.js";import{v as ct}from"./directive-Hg9QyZNN.js";import{d as pt,G as Oe,ah as gt,c as ae,s as D,w as le,M as ye,y as Z,at as ft,o as J,e as Re,g as me,K as ht,q as e,aa as s,x as F,f as He,ad as yt,n as ce,j,P as wt}from"./index-Bh7OCVQ6.js";import"./el-scrollbar-CaowckgH.js";import"./el-popper-DXUOirs5.js";import"./el-tooltip-l0sNRNKZ.js";import"./el-checkbox-DW4KRHKX.js";import"./el-tag-EWyo0LW4.js";import{_ as we,ah as bt,aw as _t,a5 as We,E as kt,B as R,aI as Ke,aJ as St,az as pe,aK as ge,X as Fe,aL as Ie,Y as qe,ax as se,aM as xt,a7 as Pt,ae as Xe,ad as Ye,aN as Ze,a1 as Je,ab as Et,aO as Ct,a4 as Mt,aP as At,aQ as Nt,aR as Gt,R as Lt,O as Q,K as Dt,aC as Vt,aD as Tt,aE as Ut,aF as zt,aG as $t,aH as Qe}from"./install-CKJv4Eli.js";import{P as Bt}from"./PageCard-CMQfFXGQ.js";import{i as Ot}from"./install-BhlbDUs6.js";import{S as je,c as Rt}from"./createSeriesDataSimply-B7uwAzSs.js";import{_ as Ht}from"./_plugin-vue_export-helper-DlAUqK2U.js";import"./vnode-DteOvKRf.js";import"./index-CbMDc3mX.js";import"./castArray-D7TxxtMv.js";import"./index-D8uNZmS-.js";import"./raf-Ds9zb_jQ.js";import"./scroll-D7E-_vui.js";import"./index-DZNyKCz8.js";import"./clamp-C0ioKl68.js";import"./toNumber-C-377O8t.js";import"./_baseIteratee-CE851Oh7.js";import"./index-kerXeogY.js";import"./index-BglXcY1N.js";import"./use-dialog-DGK1R5_0.js";import"./validator-DBeDZ8zk.js";import"./_baseClone-DA_-m_Rr.js";import"./debounce-DfTkVg-e.js";import"./omit-Ba69VK-X.js";import"./el-card-V1WOK_5K.js";var Wt=(function(){function E(){this.angle=0,this.width=10,this.r=10,this.x=0,this.y=0}return E})(),Kt=(function(E){we(r,E);function r(l){var v=E.call(this,l)||this;return v.type="pointer",v}return r.prototype.getDefaultShape=function(){return new Wt},r.prototype.buildPath=function(l,v){var k=Math.cos,w=Math.sin,n=v.r,b=v.width,u=v.angle,N=v.x-k(u)*b*(b>=n/3?1:2),_=v.y-w(u)*b*(b>=n/3?1:2);u=v.angle-Math.PI/2,l.moveTo(N,_),l.lineTo(v.x+k(u)*b,v.y+w(u)*b),l.lineTo(v.x+k(v.angle)*n,v.y+w(v.angle)*n),l.lineTo(v.x-k(u)*b,v.y-w(u)*b),l.lineTo(N,_)},r})(bt);function Ft(E,r){var l=E.get("center"),v=r.getWidth(),k=r.getHeight(),w=Math.min(v,k),n=R(l[0],r.getWidth()),b=R(l[1],r.getHeight()),u=R(E.get("radius"),w/2);return{cx:n,cy:b,r:u}}function fe(E,r){var l=E==null?"":E+"";return r&&(At(r)?l=r.replace("{value}",l):Nt(r)&&(l=r(E))),l}var It=(function(E){we(r,E);function r(){var l=E!==null&&E.apply(this,arguments)||this;return l.type=r.type,l}return r.prototype.render=function(l,v,k){this.group.removeAll();var w=l.get(["axisLine","lineStyle","color"]),n=Ft(l,k);this._renderMain(l,v,k,w,n),this._data=l.getData()},r.prototype.dispose=function(){},r.prototype._renderMain=function(l,v,k,w,n){var b=this.group,u=l.get("clockwise"),N=-l.get("startAngle")/180*Math.PI,_=-l.get("endAngle")/180*Math.PI,V=l.getModel("axisLine"),z=V.get("roundCap"),T=z?je:We,m=V.get("show"),c=V.getModel("lineStyle"),$=c.get("width"),S=[N,_];_t(S,!u),N=S[0],_=S[1];for(var f=_-N,G=N,L=[],H=0;m&&H<w.length;H++){var U=Math.min(Math.max(w[H][0],0),1);_=N+f*U;var C=new T({shape:{startAngle:G,endAngle:_,cx:n.cx,cy:n.cy,clockwise:u,r0:n.r-$,r:n.r},silent:!0});C.setStyle({fill:w[H][1]}),C.setStyle(c.getLineStyle(["color","width"])),L.push(C),G=_}L.reverse(),kt(L,function(B){return b.add(B)});var o=function(B){if(B<=0)return w[0][1];var i;for(i=0;i<w.length;i++)if(w[i][0]>=B&&(i===0?0:w[i-1][0])<B)return w[i][1];return w[i-1][1]};this._renderTicks(l,v,k,o,n,N,_,u,$),this._renderTitleAndDetail(l,v,k,o,n),this._renderAnchor(l,n),this._renderPointer(l,v,k,o,n,N,_,u,$)},r.prototype._renderTicks=function(l,v,k,w,n,b,u,N,_){for(var V=this.group,z=n.cx,T=n.cy,m=n.r,c=+l.get("min"),$=+l.get("max"),S=l.getModel("splitLine"),f=l.getModel("axisTick"),G=l.getModel("axisLabel"),L=l.get("splitNumber"),H=f.get("splitNumber"),U=R(S.get("length"),m),C=R(f.get("length"),m),o=b,B=(u-b)/L,i=B/H,h=S.getModel("lineStyle").getLineStyle(),M=f.getModel("lineStyle").getLineStyle(),x=S.get("distance"),y,p,A=0;A<=L;A++){if(y=Math.cos(o),p=Math.sin(o),S.get("show")){var d=x?x+_:_,P=new Ke({shape:{x1:y*(m-d)+z,y1:p*(m-d)+T,x2:y*(m-U-d)+z,y2:p*(m-U-d)+T},style:h,silent:!0});h.stroke==="auto"&&P.setStyle({stroke:w(A/L)}),V.add(P)}if(G.get("show")){var d=G.get("distance")+x,K=fe(St(A*($-c)/L+c,Gt),G.get("formatter")),W=w(A/L),g=y*(m-U-d)+z,re=p*(m-U-d)+T,ne=G.get("rotate"),X=0;ne==="radial"?(X=-o+2*Math.PI,X>Math.PI/2&&(X+=Math.PI)):ne==="tangential"?X=-o-Math.PI/2:Lt(ne)&&(X=ne*Math.PI/180),X===0?V.add(new pe({style:ge(G,{text:K,x:g,y:re,verticalAlign:p<-.8?"top":p>.8?"bottom":"middle",align:y<-.4?"left":y>.4?"right":"center"},{inheritColor:W}),silent:!0})):V.add(new pe({style:ge(G,{text:K,x:g,y:re,verticalAlign:"middle",align:"center"},{inheritColor:W}),silent:!0,originX:g,originY:re,rotation:X}))}if(f.get("show")&&A!==L){var d=f.get("distance");d=d?d+_:_;for(var a=0;a<=H;a++){y=Math.cos(o),p=Math.sin(o);var t=new Ke({shape:{x1:y*(m-d)+z,y1:p*(m-d)+T,x2:y*(m-C-d)+z,y2:p*(m-C-d)+T},silent:!0,style:M});M.stroke==="auto"&&t.setStyle({stroke:w((A+a/H)/L)}),V.add(t),o+=i}o-=i}else o+=B}},r.prototype._renderPointer=function(l,v,k,w,n,b,u,N,_){var V=this.group,z=this._data,T=this._progressEls,m=[],c=l.get(["pointer","show"]),$=l.getModel("progress"),S=$.get("show"),f=l.getData(),G=f.mapDimension("value"),L=+l.get("min"),H=+l.get("max"),U=[L,H],C=[b,u];function o(i,h){var M=f.getItemModel(i),x=M.getModel("pointer"),y=R(x.get("width"),n.r),p=R(x.get("length"),n.r),A=l.get(["pointer","icon"]),d=x.get("offsetCenter"),P=R(d[0],n.r),K=R(d[1],n.r),W=x.get("keepAspect"),g;return A?g=Ze(A,P-y/2,K-p,y,p,null,W):g=new Kt({shape:{angle:-Math.PI/2,width:y,r:p,x:P,y:K}}),g.rotation=-(h+Math.PI/2),g.x=n.cx,g.y=n.cy,g}function B(i,h){var M=$.get("roundCap"),x=M?je:We,y=$.get("overlap"),p=y?$.get("width"):_/f.count(),A=y?n.r-p:n.r-(i+1)*p,d=y?n.r:n.r-i*p,P=new x({shape:{startAngle:b,endAngle:h,cx:n.cx,cy:n.cy,clockwise:N,r0:A,r:d}});return y&&(P.z2=se(f.get(G,i),[L,H],[100,0],!0)),P}(S||c)&&(f.diff(z).add(function(i){var h=f.get(G,i);if(c){var M=o(i,b);Fe(M,{rotation:-((isNaN(+h)?C[0]:se(h,U,C,!0))+Math.PI/2)},l),V.add(M),f.setItemGraphicEl(i,M)}if(S){var x=B(i,b),y=$.get("clip");Fe(x,{shape:{endAngle:se(h,U,C,y)}},l),V.add(x),Ie(l.seriesIndex,f.dataType,i,x),m[i]=x}}).update(function(i,h){var M=f.get(G,i);if(c){var x=z.getItemGraphicEl(h),y=x?x.rotation:b,p=o(i,y);p.rotation=y,qe(p,{rotation:-((isNaN(+M)?C[0]:se(M,U,C,!0))+Math.PI/2)},l),V.add(p),f.setItemGraphicEl(i,p)}if(S){var A=T[h],d=A?A.shape.endAngle:b,P=B(i,d),K=$.get("clip");qe(P,{shape:{endAngle:se(M,U,C,K)}},l),V.add(P),Ie(l.seriesIndex,f.dataType,i,P),m[i]=P}}).execute(),f.each(function(i){var h=f.getItemModel(i),M=h.getModel("emphasis"),x=M.get("focus"),y=M.get("blurScope"),p=M.get("disabled"),A=w(se(f.get(G,i),U,[0,1],!0));if(c){var d=f.getItemGraphicEl(i),P=f.getItemVisual(i,"style"),K=P.fill;if(d instanceof xt){var W=d.style;d.useStyle(Pt({image:W.image,x:W.x,y:W.y,width:W.width,height:W.height},P))}else d.useStyle(P),d.type!=="pointer"&&d.setColor(K);d.setStyle(h.getModel(["pointer","itemStyle"]).getItemStyle()),d.style.fill==="auto"&&d.setStyle("fill",A),d.z2EmphasisLift=0,Xe(d,h),Ye(d,x,y,p)}if(S){var g=m[i];g.useStyle(f.getItemVisual(i,"style")),g.setStyle(h.getModel(["progress","itemStyle"]).getItemStyle()),g.style.fill==="auto"&&g.setStyle("fill",A),g.z2EmphasisLift=0,Xe(g,h),Ye(g,x,y,p)}}),this._progressEls=m)},r.prototype._renderAnchor=function(l,v){var k=l.getModel("anchor"),w=k.get("show");if(w){var n=k.get("size"),b=k.get("icon"),u=k.get("offsetCenter"),N=k.get("keepAspect"),_=Ze(b,v.cx-n/2+R(u[0],v.r),v.cy-n/2+R(u[1],v.r),n,n,null,N);_.z2=k.get("showAbove")?1:0,_.setStyle(k.getModel("itemStyle").getItemStyle()),this.group.add(_)}},r.prototype._renderTitleAndDetail=function(l,v,k,w,n){var b=this,u=l.getData(),N=u.mapDimension("value"),_=+l.get("min"),V=+l.get("max"),z=new Je,T=[],m=[],c=l.isAnimationEnabled(),$=l.get(["pointer","showAbove"]);u.diff(this._data).add(function(S){T[S]=new pe({silent:!0}),m[S]=new pe({silent:!0})}).update(function(S,f){T[S]=b._titleEls[f],m[S]=b._detailEls[f]}).execute(),u.each(function(S){var f=u.getItemModel(S),G=u.get(N,S),L=new Je,H=w(se(G,[_,V],[0,1],!0)),U=f.getModel("title");if(U.get("show")){var C=U.get("offsetCenter"),o=n.cx+R(C[0],n.r),B=n.cy+R(C[1],n.r),i=T[S];i.attr({z2:$?0:2,style:ge(U,{x:o,y:B,text:u.getName(S),align:"center",verticalAlign:"middle"},{inheritColor:H})}),L.add(i)}var h=f.getModel("detail");if(h.get("show")){var M=h.get("offsetCenter"),x=n.cx+R(M[0],n.r),y=n.cy+R(M[1],n.r),p=R(h.get("width"),n.r),A=R(h.get("height"),n.r),d=l.get(["progress","show"])?u.getItemVisual(S,"style").fill:H,i=m[S],P=h.get("formatter");i.attr({z2:$?0:2,style:ge(h,{x,y,text:fe(G,P),width:isNaN(p)?null:p,height:isNaN(A)?null:A,align:"center",verticalAlign:"middle"},{inheritColor:d})}),Et(i,{normal:h},G,function(W){return fe(W,P)}),c&&Ct(i,S,u,l,{getFormattedLabel:function(W,g,re,ne,X,a){return fe(a?a.interpolatedValue:G,P)}}),L.add(i)}z.add(L)}),this.group.add(z),this._titleEls=T,this._detailEls=m},r.type="gauge",r})(Mt),qt=(function(E){we(r,E);function r(){var l=E!==null&&E.apply(this,arguments)||this;return l.type=r.type,l.visualStyleAccessPath="itemStyle",l}return r.prototype.getInitialData=function(l,v){return Rt(this,["value"])},r.type="series.gauge",r.defaultOption={z:2,colorBy:"data",center:["50%","50%"],legendHoverLink:!0,radius:"75%",startAngle:225,endAngle:-45,clockwise:!0,min:0,max:100,splitNumber:10,axisLine:{show:!0,roundCap:!1,lineStyle:{color:[[1,Q.color.neutral10]],width:10}},progress:{show:!1,overlap:!0,width:10,roundCap:!1,clip:!0},splitLine:{show:!0,length:10,distance:10,lineStyle:{color:Q.color.axisTick,width:3,type:"solid"}},axisTick:{show:!0,splitNumber:5,length:6,distance:10,lineStyle:{color:Q.color.axisTickMinor,width:1,type:"solid"}},axisLabel:{show:!0,distance:15,color:Q.color.axisLabel,fontSize:12,rotate:0},pointer:{icon:null,offsetCenter:[0,0],show:!0,showAbove:!0,length:"60%",width:6,keepAspect:!1},anchor:{show:!1,showAbove:!1,size:6,icon:"circle",offsetCenter:[0,0],keepAspect:!1,itemStyle:{color:Q.color.neutral00,borderWidth:0,borderColor:Q.color.theme[0]}},title:{show:!0,offsetCenter:[0,"20%"],color:Q.color.secondary,fontSize:16,valueAnimation:!1},detail:{show:!0,backgroundColor:Q.color.transparent,borderWidth:0,borderColor:Q.color.neutral40,width:100,height:null,padding:[5,10],offsetCenter:[0,"40%"],color:Q.color.primary,fontSize:30,fontWeight:"bold",lineHeight:30,valueAnimation:!1}},r})(Dt);function Xt(E){E.registerChartView(It),E.registerSeriesModel(qt)}Vt([Tt,Ot,Xt,Ut,zt,$t]);const Yt={class:"monitor-actions"},Zt={class:"update-time"},Jt={class:"performance-content"},Qt={class:"overview-grid","aria-label":"硬件资源概览"},jt={class:"overview-card"},ea={class:"metric-heading"},ta={class:"metric-number"},aa={class:"overview-card"},la={class:"metric-heading"},ra={class:"metric-number"},na={class:"overview-card"},ia={class:"metric-heading"},sa={class:"metric-number"},oa={class:"overview-card"},ua={class:"network-values"},da={class:"panel resource-panel","aria-labelledby":"resource-trend-title"},va={class:"panel-heading"},ma={class:"sample-count"},ca={class:"gpu-section","aria-labelledby":"gpu-pool-title"},pa={class:"section-heading"},ga={class:"gpu-summary"},fa={key:1,class:"gpu-grid"},ha=["aria-label","onClick","onKeydown"],ya={class:"gpu-card-heading"},wa={class:"gpu-identity"},ba={class:"gpu-index"},_a={class:"gpu-primary"},ka={class:"gpu-metrics"},Sa={class:"panel host-panel","aria-labelledby":"host-info-title"},xa={class:"host-info-grid"},Pa={key:0,class:"drawer-heading"},Ea={class:"gpu-index"},Ca={class:"drawer-metrics","aria-label":"GPU 关键指标"},Ma={key:0},Aa={class:"drawer-section","aria-labelledby":"gpu-trend-title"},Na={class:"drawer-section","aria-labelledby":"gpu-process-title"},Ga={class:"drawer-section-heading"},La={class:"drawer-section device-properties","aria-labelledby":"gpu-property-title"},Da=pt({__name:"HardwareView",setup(E){const r=Z({}),l=Z(!0),v=Z(!1),k=Z(""),w=Z(null),n=Z(!0),b=Z(5e3),u=Z([]),N=Z(!1),_=Z(0);let V=null,z=!1,T=!1;const m=j(()=>r.value.gpu??[]),c=j(()=>m.value[_.value]),$=j(()=>m.value.length?Math.round(m.value.reduce((a,t)=>a+o(t.gpu_percent),0)/m.value.length):0),S=j(()=>m.value.reduce((a,t)=>a+Number(t.memory_total_gb||0),0)),f=j(()=>m.value.reduce((a,t)=>a+Number(t.memory_used_gb||0),0)),G=j(()=>m.value.filter(a=>i(a).key==="busy").length),L=j(()=>{var ee,I,ie;const a=m.value.some(te=>i(te).key==="offline"),t=o((ee=r.value.cpu)==null?void 0:ee.percent)>=90||o((I=r.value.memory)==null?void 0:I.percent)>=90||o((ie=r.value.disk)==null?void 0:ie.percent)>=90||m.value.some(te=>i(te).key==="warning");return a?{label:"存在离线设备",className:"is-danger"}:t?{label:"资源需要关注",className:"is-warning"}:{label:"平台运行正常",className:"is-healthy"}}),H=j(()=>({animationDuration:300,color:["#4f46e5","#0ea5e9","#10b981","#f59e0b"],tooltip:{trigger:"axis",valueFormatter:a=>`${a}%`},legend:{top:0,right:0,itemWidth:10,itemHeight:10,textStyle:{color:"#606266"}},grid:{left:14,right:14,top:42,bottom:8,containLabel:!0},xAxis:{type:"category",boundaryGap:!1,data:u.value.map(a=>a.time),axisLine:{lineStyle:{color:"#dcdfe6"}},axisLabel:{color:"#909399",hideOverlap:!0}},yAxis:{type:"value",min:0,max:100,axisLabel:{formatter:"{value}%",color:"#909399"},splitLine:{lineStyle:{color:"#ebeef5",type:"dashed"}}},series:[C("CPU",u.value.map(a=>a.cpu)),C("内存",u.value.map(a=>a.memory)),C("磁盘",u.value.map(a=>a.disk)),C("GPU 平均",u.value.map(a=>a.gpuAverage))]})),U=j(()=>{const a=u.value.map(t=>({time:t.time,gpu:t.gpu[_.value]})).filter(t=>t.gpu);return{animationDuration:300,color:["#4f46e5","#0ea5e9","#f59e0b"],tooltip:{trigger:"axis",valueFormatter:t=>`${t}%`},legend:{top:0,right:0,itemWidth:10,itemHeight:10},grid:{left:12,right:12,top:40,bottom:6,containLabel:!0},xAxis:{type:"category",boundaryGap:!1,data:a.map(t=>t.time),axisLine:{lineStyle:{color:"#dcdfe6"}},axisLabel:{color:"#909399",hideOverlap:!0}},yAxis:{type:"value",min:0,max:100,axisLabel:{formatter:"{value}%",color:"#909399"},splitLine:{lineStyle:{color:"#ebeef5",type:"dashed"}}},series:[C("利用率",a.map(t=>t.gpu.usage)),C("显存",a.map(t=>t.gpu.memory))]}});function C(a,t){return{name:a,type:"line",data:t,showSymbol:!1,smooth:!0,lineStyle:{width:2},areaStyle:{opacity:.05}}}function o(a){return Math.min(100,Math.max(0,Number(a||0)))}function B(a){return a?a.memory_percent!=null?o(a.memory_percent):a.memory_total_gb?Math.round(a.memory_used_gb/a.memory_total_gb*100):0:0}function i(a){return a.status==="offline"?{key:"offline",label:"离线",className:"is-danger"}:a.status==="warning"||a.temperature>=80||B(a)>=90?{key:"warning",label:"需关注",className:"is-warning"}:a.status==="busy"||a.gpu_percent>=10?{key:"busy",label:"运行中",className:"is-busy"}:{key:"idle",label:"空闲",className:"is-idle"}}function h(a){return a>=90?"#f56c6c":a>=75?"#e6a23c":"#4f46e5"}function M(a){var ie,te,ve;const t=a.gpu??[],ee=t.length?Math.round(t.reduce((Y,he)=>Y+o(he.gpu_percent),0)/t.length):0,I=new Date;u.value=[...u.value,{time:I.toLocaleTimeString("zh-CN",{hour12:!1,hour:"2-digit",minute:"2-digit",second:"2-digit"}),cpu:o((ie=a.cpu)==null?void 0:ie.percent),memory:o((te=a.memory)==null?void 0:te.percent),disk:o((ve=a.disk)==null?void 0:ve.percent),gpuAverage:ee,gpu:t.map(Y=>({usage:o(Y.gpu_percent),memory:B(Y),temperature:o(Y.temperature)}))}].slice(-60)}async function x(){if(!(T||z)){T=!0,v.value=!0,p();try{const a=await ft();r.value=a,w.value=new Date,k.value="",M(a)}catch(a){k.value=a instanceof Error?a.message:"监控数据更新失败,请稍后重试"}finally{l.value=!1,v.value=!1,T=!1,y()}}}function y(){p(),!z&&n.value&&document.visibilityState==="visible"&&(V=setTimeout(x,b.value))}function p(){V&&(clearTimeout(V),V=null)}function A(){y()}function d(){n.value?y():p()}function P(){document.visibilityState==="hidden"?p():n.value&&x()}function K(a){_.value=a,N.value=!0,wt(()=>{var t;return(t=document.querySelector(".gpu-detail-drawer .el-drawer__body"))==null?void 0:t.focus()})}function W(a,t){(a.key==="Enter"||a.key===" ")&&(a.preventDefault(),K(t))}function g(a,t=1){return Number(a||0).toFixed(t).replace(/\.0$/,"")}function re(a){return a==null?"--":g(a)}function ne(a){if(!a)return"-";const t=Math.floor(a/86400),ee=Math.floor(a%86400/3600),I=Math.floor(a%3600/60);return`${t?`${t}天 `:""}${ee}小时 ${I}分钟`}function X(a){return a?a.toLocaleTimeString("zh-CN",{hour12:!1}):"等待首次更新"}return Oe(x),Oe(()=>document.addEventListener("visibilitychange",P)),gt(()=>{z=!0,p(),document.removeEventListener("visibilitychange",P)}),(a,t)=>{const ee=dt,I=it,ie=nt,te=rt,ve=lt,Y=ut,he=ot,oe=mt,et=vt,tt=st,at=ct;return J(),ae(ye,null,[D(Bt,{title:"平台性能",subtitle:"实时监控计算、存储、网络与 GPU 资源池状态"},{extra:le(()=>[e("div",Yt,[e("div",{class:ce(["health-state",L.value.className])},[t[3]||(t[3]=e("span",{class:"health-dot","aria-hidden":"true"},null,-1)),F(" "+s(L.value.label),1)],2),e("span",Zt,"更新于 "+s(X(w.value)),1),D(ee,{modelValue:n.value,"onUpdate:modelValue":t[0]||(t[0]=q=>n.value=q),"inline-prompt":"","active-text":"自动","inactive-text":"暂停","aria-label":"自动刷新",onChange:d},null,8,["modelValue"]),D(ie,{modelValue:b.value,"onUpdate:modelValue":t[1]||(t[1]=q=>b.value=q),class:"interval-select",size:"small","aria-label":"刷新频率",disabled:!n.value,onChange:A},{default:le(()=>[D(I,{value:1e3,label:"1 秒"}),D(I,{value:3e3,label:"3 秒"}),D(I,{value:5e3,label:"5 秒"}),D(I,{value:1e4,label:"10 秒"})]),_:1},8,["modelValue","disabled"]),D(te,{loading:v.value,"aria-label":"立即刷新平台性能数据",onClick:x},{default:le(()=>[...t[4]||(t[4]=[e("i",{class:"fa fa-refresh","aria-hidden":"true"},null,-1),F(" 刷新 ",-1)])]),_:1},8,["loading"])])]),default:le(()=>{var q,ue,be,_e,ke,Se,xe,Pe,Ee,Ce,Me,Ae,Ne,Ge,Le,De,Ve,Te,Ue,ze,$e;return[k.value?(J(),Re(ve,{key:0,class:"load-alert",type:"warning",closable:!1,"show-icon":"",title:"最新数据获取失败,当前仍展示上一次成功采集的数据",description:k.value},null,8,["description"])):me("",!0),ht((J(),ae("div",Jt,[e("section",Qt,[e("article",jt,[e("div",ea,[t[6]||(t[6]=e("span",{class:"metric-icon is-cpu"},[e("i",{class:"fa fa-microchip"})],-1)),e("div",null,[t[5]||(t[5]=e("h3",null,"CPU",-1)),e("p",null,s(((q=r.value.cpu)==null?void 0:q.model)||`${((ue=r.value.cpu)==null?void 0:ue.cores)||0} 个逻辑核心`),1)])]),e("strong",ta,[F(s(o((be=r.value.cpu)==null?void 0:be.percent)),1),t[7]||(t[7]=e("small",null,"%",-1))]),D(Y,{percentage:o((_e=r.value.cpu)==null?void 0:_e.percent),"stroke-width":6,"show-text":!1,color:h(o((ke=r.value.cpu)==null?void 0:ke.percent))},null,8,["percentage","color"])]),e("article",aa,[e("div",la,[t[9]||(t[9]=e("span",{class:"metric-icon is-memory"},[e("i",{class:"fa fa-database"})],-1)),e("div",null,[t[8]||(t[8]=e("h3",null,"内存",-1)),e("p",null,s(g((Se=r.value.memory)==null?void 0:Se.used_gb))+" / "+s(g((xe=r.value.memory)==null?void 0:xe.total_gb))+" GB",1)])]),e("strong",ra,[F(s(o((Pe=r.value.memory)==null?void 0:Pe.percent)),1),t[10]||(t[10]=e("small",null,"%",-1))]),D(Y,{percentage:o((Ee=r.value.memory)==null?void 0:Ee.percent),"stroke-width":6,"show-text":!1,color:h(o((Ce=r.value.memory)==null?void 0:Ce.percent))},null,8,["percentage","color"])]),e("article",na,[e("div",ia,[t[12]||(t[12]=e("span",{class:"metric-icon is-disk"},[e("i",{class:"fa fa-hdd-o"})],-1)),e("div",null,[t[11]||(t[11]=e("h3",null,"磁盘",-1)),e("p",null,s(g((Me=r.value.disk)==null?void 0:Me.used_gb))+" / "+s(g((Ae=r.value.disk)==null?void 0:Ae.total_gb))+" GB",1)])]),e("strong",sa,[F(s(o((Ne=r.value.disk)==null?void 0:Ne.percent)),1),t[13]||(t[13]=e("small",null,"%",-1))]),D(Y,{percentage:o((Ge=r.value.disk)==null?void 0:Ge.percent),"stroke-width":6,"show-text":!1,color:h(o((Le=r.value.disk)==null?void 0:Le.percent))},null,8,["percentage","color"])]),e("article",oa,[t[18]||(t[18]=e("div",{class:"metric-heading"},[e("span",{class:"metric-icon is-network"},[e("i",{class:"fa fa-exchange"})]),e("div",null,[e("h3",null,"网络吞吐"),e("p",null,"实时接收 / 发送")])],-1)),e("div",ua,[e("strong",null,[t[14]||(t[14]=e("i",{class:"fa fa-arrow-down"},null,-1)),F(" "+s(re((De=r.value.network)==null?void 0:De.download_mb_s))+" ",1),t[15]||(t[15]=e("small",null,"MB/s",-1))]),e("strong",null,[t[16]||(t[16]=e("i",{class:"fa fa-arrow-up"},null,-1)),F(" "+s(re((Ve=r.value.network)==null?void 0:Ve.upload_mb_s))+" ",1),t[17]||(t[17]=e("small",null,"MB/s",-1))])])])]),e("section",da,[e("div",va,[t[19]||(t[19]=e("div",null,[e("h2",{id:"resource-trend-title"},"系统资源趋势"),e("p",null,"展示最近 60 次前端采集快照")],-1)),e("span",ma,s(u.value.length)+" / 60 个采样点",1)]),D(He(Qe),{class:"resource-chart",option:H.value,autoresize:"","aria-label":"CPU、内存、磁盘和GPU平均利用率趋势图"},null,8,["option"])]),e("section",ca,[e("div",pa,[e("div",null,[t[20]||(t[20]=e("h2",{id:"gpu-pool-title"},"GPU 资源池",-1)),e("p",null,"共 "+s(m.value.length)+" 张卡,"+s(G.value)+" 张运行中 · 显存 "+s(g(f.value))+" / "+s(g(S.value))+" GB",1)]),e("div",ga,[t[21]||(t[21]=e("span",null,"平均利用率",-1)),e("strong",null,s($.value)+"%",1)])]),!m.value.length&&!l.value?(J(),Re(he,{key:0,description:"当前未检测到 GPU 设备"})):(J(),ae("div",fa,[(J(!0),ae(ye,null,yt(m.value,(O,de)=>(J(),ae("article",{key:O.uuid||O.id||de,class:"gpu-card",role:"button",tabindex:"0","aria-label":`查看 GPU ${de} 详情`,onClick:Be=>K(de),onKeydown:Be=>W(Be,de)},[e("div",ya,[e("div",wa,[e("span",ba,"GPU "+s(de),1),e("h3",null,s(O.name),1)]),e("span",{class:ce(["status-pill",i(O).className])},[t[22]||(t[22]=e("i",null,null,-1)),F(s(i(O).label),1)],2)]),e("div",_a,[e("strong",null,[F(s(o(O.gpu_percent)),1),t[23]||(t[23]=e("small",null,"%",-1))]),t[24]||(t[24]=e("span",null,"计算利用率",-1))]),D(Y,{percentage:o(O.gpu_percent),"stroke-width":7,"show-text":!1,color:h(o(O.gpu_percent))},null,8,["percentage","color"]),e("dl",ka,[e("div",null,[t[25]||(t[25]=e("dt",null,"显存",-1)),e("dd",null,s(g(O.memory_used_gb))+" / "+s(g(O.memory_total_gb))+" GB",1)]),e("div",null,[t[26]||(t[26]=e("dt",null,"温度",-1)),e("dd",{class:ce({"is-hot":O.temperature>=80,"is-warm":O.temperature>=70&&O.temperature<80})},s(O.temperature)+"°C",3)]),e("div",null,[t[27]||(t[27]=e("dt",null,"功耗",-1)),e("dd",null,s(g(O.power_w,0))+" W",1)]),e("div",null,[t[28]||(t[28]=e("dt",null,"风扇",-1)),e("dd",null,s(O.fan_speed??"-")+s(O.fan_speed!=null?"%":""),1)])]),t[29]||(t[29]=e("div",{class:"gpu-card-footer"},[F("查看设备详情 "),e("i",{class:"fa fa-angle-right"})],-1))],40,ha))),128))]))]),e("section",Sa,[t[34]||(t[34]=e("div",{class:"panel-heading compact"},[e("div",null,[e("h2",{id:"host-info-title"},"主机信息"),e("p",null,"节点运行环境与基础状态")])],-1)),e("dl",xa,[e("div",null,[t[30]||(t[30]=e("dt",null,"操作系统",-1)),e("dd",null,s(((Te=r.value.system)==null?void 0:Te.os)||"-"),1)]),e("div",null,[t[31]||(t[31]=e("dt",null,"运行时长",-1)),e("dd",null,s(ne((Ue=r.value.system)==null?void 0:Ue.uptime_seconds)),1)]),e("div",null,[t[32]||(t[32]=e("dt",null,"运行进程",-1)),e("dd",null,s(((ze=r.value.system)==null?void 0:ze.process_count)??"-"),1)]),e("div",null,[t[33]||(t[33]=e("dt",null,"GPU 驱动",-1)),e("dd",null,s((($e=m.value[0])==null?void 0:$e.driver_version)||"-"),1)])])])])),[[at,l.value]])]}),_:1}),D(tt,{modelValue:N.value,"onUpdate:modelValue":t[2]||(t[2]=q=>N.value=q),class:"gpu-detail-drawer",size:"min(720px, 92vw)","destroy-on-close":""},{header:le(()=>[c.value?(J(),ae("div",Pa,[e("span",Ea,"GPU "+s(_.value),1),e("div",null,[e("h2",null,s(c.value.name),1),e("p",null,s(c.value.uuid||"设备详细运行信息"),1)]),e("span",{class:ce(["status-pill",i(c.value).className])},[t[35]||(t[35]=e("i",null,null,-1)),F(s(i(c.value).label),1)],2)])):me("",!0)]),default:le(()=>{var q;return[c.value?(J(),ae(ye,{key:0},[e("section",Ca,[e("div",null,[t[36]||(t[36]=e("span",null,"计算利用率",-1)),e("strong",null,s(o(c.value.gpu_percent))+"%",1)]),e("div",null,[t[37]||(t[37]=e("span",null,"显存占用",-1)),e("strong",null,s(B(c.value))+"%",1),e("small",null,s(g(c.value.memory_used_gb))+" / "+s(g(c.value.memory_total_gb))+" GB",1)]),e("div",null,[t[38]||(t[38]=e("span",null,"温度",-1)),e("strong",null,s(c.value.temperature)+"°C",1)]),e("div",null,[t[39]||(t[39]=e("span",null,"实时功耗",-1)),e("strong",null,s(g(c.value.power_w,0))+" W",1),c.value.power_limit_w?(J(),ae("small",Ma,"上限 "+s(c.value.power_limit_w)+" W",1)):me("",!0)])]),e("section",Aa,[t[40]||(t[40]=e("div",{class:"drawer-section-heading"},[e("h3",{id:"gpu-trend-title"},"设备趋势"),e("span",null,"最近 60 次采样")],-1)),D(He(Qe),{class:"gpu-detail-chart",option:U.value,autoresize:"","aria-label":"单卡利用率和显存占用趋势图"},null,8,["option"])]),e("section",Na,[e("div",Ga,[t[41]||(t[41]=e("h3",{id:"gpu-process-title"},"GPU 进程",-1)),e("span",null,s(((q=c.value.processes)==null?void 0:q.length)||0)+" 个",1)]),D(et,{data:c.value.processes||[],stripe:"","empty-text":"当前没有占用此 GPU 的进程"},{default:le(()=>[D(oe,{prop:"pid",label:"PID",width:"90"}),D(oe,{prop:"task_name",label:"任务","min-width":"130","show-overflow-tooltip":""}),D(oe,{prop:"name",label:"进程","min-width":"130","show-overflow-tooltip":""}),D(oe,{prop:"user",label:"用户",width:"100"}),D(oe,{label:"显存",width:"110",align:"right"},{default:le(({row:ue})=>[F(s(ue.memory_used_gb!=null?`${g(ue.memory_used_gb)} GB`:"-"),1)]),_:1})]),_:1},8,["data"])]),e("section",La,[t[46]||(t[46]=e("div",{class:"drawer-section-heading"},[e("h3",{id:"gpu-property-title"},"设备属性")],-1)),e("dl",null,[e("div",null,[t[42]||(t[42]=e("dt",null,"风扇转速",-1)),e("dd",null,s(c.value.fan_speed!=null?`${c.value.fan_speed}%`:"-"),1)]),e("div",null,[t[43]||(t[43]=e("dt",null,"核心频率",-1)),e("dd",null,s(c.value.clock_mhz?`${c.value.clock_mhz} MHz`:"-"),1)]),e("div",null,[t[44]||(t[44]=e("dt",null,"驱动版本",-1)),e("dd",null,s(c.value.driver_version||"-"),1)]),e("div",null,[t[45]||(t[45]=e("dt",null,"设备标识",-1)),e("dd",null,s(c.value.uuid||c.value.id||`GPU-${_.value}`),1)])])])],64)):me("",!0)]}),_:1},8,["modelValue"])],64)}}}),yl=Ht(Da,[["__scopeId","data-v-91b73178"]]);export{yl as default};
|