Files
Nexus/web/app/assets/FleetTrendEChart-lgdTP3R-.js
T

35 lines
68 KiB
JavaScript
Raw Normal View History

import{Er as e,Nr as t,Zt as n,_i as r,bi as i,pn as a,qr as o,wr as s}from"./index-CDcgx9V8.js";import{$ as c,$t as l,An as u,B as d,Bn as f,Bt as p,C as m,Cn as h,Ct as g,Dt as _,En as v,F as y,Fn as b,Ft as x,G as S,Hn as C,I as ee,In as w,It as te,Jt as T,L as ne,Ln as re,Lt as ie,M as ae,Mn as oe,Mt as se,N as ce,Nn as le,O as ue,On as E,P as de,Pn as fe,Q as pe,Qt as me,R as D,Sn as O,St as k,T as he,Tn as A,Tt as ge,U as _e,V as ve,Vn as ye,Vt as be,Xt as j,Y as xe,Yt as Se,Z as Ce,Zt as we,_ as Te,_n as Ee,_t as De,a as Oe,an as ke,at as Ae,b as je,bn as M,bt as Me,c as Ne,ct as Pe,d as Fe,dn as Ie,dt as Le,en as Re,f as ze,ft as Be,g as Ve,gn as He,hn as Ue,ht as We,i as Ge,in as Ke,it as qe,j as Je,jn as N,jt as Ye,kn as P,kt as Xe,l as Ze,ln as Qe,lt as $e,mn as et,mt as tt,n as nt,nt as rt,o as it,on as at,ot,pt as st,q as ct,r as lt,rn as ut,rt as dt,s as ft,sn as pt,st as mt,t as ht,tt as gt,u as _t,un as F,ut as vt,v as yt,vn as bt,vt as xt,w as St,wn as I,wt as Ct,x as wt,xn as Tt,xt as Et,y as L,yn as Dt,yt as Ot,z as kt,zn as At}from"./dist-DCycUQQT.js";import{a as jt,c as Mt,i as Nt,l as Pt,n as Ft,o as It,r as Lt,s as Rt,t as zt,u as Bt}from"./install-BY4V-NK4.js";import{c as Vt,p as Ht,u as Ut}from"./StatCardsRow-CdfBB9tI.js";import{t as Wt}from"./_plugin-vue_export-helper-BDNMzG2s.js";var Gt=function(e){C(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.type=t.type,n.hasSymbolVisual=!0,n}return t.prototype.getInitialData=function(e,t){return Ve(null,this,{useEncodeDefaulter:!0})},t.prototype.getProgressive=function(){return this.option.progressive??(this.option.large?5e3:this.get(`progressive`))},t.prototype.getProgressiveThreshold=function(){return this.option.progressiveThreshold??(this.option.large?1e4:this.get(`progressiveThreshold`))},t.prototype.brushSelector=function(e,t,n){return n.point(t.getItemLayout(e))},t.prototype.getZLevelKey=function(){return this.getData().count()>this.getProgressiveThreshold()?this.id:``},t.type=`series.scatter`,t.dependencies=[`grid`,`polar`,`geo`,`singleAxis`,`calendar`,`matrix`],t.defaultOption={coordinateSystem:`cartesian2d`,z:2,legendHoverLink:!0,symbolSize:10,large:!1,largeThreshold:2e3,itemStyle:{opacity:.8},emphasis:{scale:!0},clip:!0,select:{itemStyle:{borderColor:D.color.primary}},universalTransition:{divideShape:`clone`}},t}(ce),Kt=4,qt=function(){function e(){}return e}(),Jt=function(e){C(t,e);function t(t){var n=e.call(this,t)||this;return n._off=0,n.hoverDataIdx=-1,n}return t.prototype.getDefaultShape=function(){return new qt},t.prototype.reset=function(){this.notClear=!1,this._off=0},t.prototype.beforeBrush=function(e){e&&!e.contentRetained&&this.reset()},t.prototype.buildPath=function(e,t){var n=t.points,r=t.size,i=this.symbolProxy,a=i.shape,o=e.getContext?e.getContext():e,s=o&&r[0]<Kt,c=this.softClipShape,l;if(s){this._ctx=o;return}for(this._ctx=null,l=this._off;l<n.length;){var u=n[l++],d=n[l++];isNaN(u)||isNaN(d)||c&&!c.contain(u,d)||(a.x=u-r[0]/2,a.y=d-r[1]/2,a.width=r[0],a.height=r[1],i.buildPath(e,a,!0))}this.incremental&&(this._off=l,this.notClear=!0)},t.prototype.afterBrush=function(){var e=this.shape,t=e.points,n=e.size,r=this._ctx,i=this.softClipShape,a;if(r){for(a=this._off;a<t.length;){var o=t[a++],s=t[a++];isNaN(o)||isNaN(s)||i&&!i.contain(o,s)||r.fillRect(o-n[0]/2,s-n[1]/2,n[0],n[1])}this.incremental&&(this._off=a,this.notClear=!0)}},t.prototype.findDataIndex=function(e,t){for(var n=this.shape,r=n.points,i=n.size,a=Math.max(i[0],4),o=Math.max(i[1],4),s=r.length/2-1;s>=0;s--){var c=s*2,l=r[c]-a/2,u=r[c+1]-o/2;if(e>=l&&t>=u&&e<=l+a&&t<=u+o)return s}return-1},t.prototype.contain=function(e,t){var n=this.transformCoordToLocal(e,t),r=this.getBoundingRect();return e=n[0],t=n[1],r.contain(e,t)?(this.hoverDataIdx=this.findDataIndex(e,t))>=0:(this.hoverDataIdx=-1,!1)},t.prototype.getBoundingRect=function(){var e=this._rect;if(!e){for(var t=this.shape,n=t.points,r=t.size,i=r[0],a=r[1],o=1/0,s=1/0,c=-1/0,l=-1/0,u=0;u<n.length;){var d=n[u++],f=n[u++];o=Math.min(d,o),c=Math.max(d,c),s=Math.min(f,s),l=Math.max(f,l)}e=this._r
`))}),t.join(`
`+J+`
`)}function jr(e){return b(e,function(e){var t=e.getRawData(),n=[e.name],r=[];return t.each(t.dimensions,function(){for(var e=arguments.length,i=arguments[e-1],a=t.getName(i),o=0;o<e-1;o++)r[o]=arguments[o];n.push((a?a+Y:``)+r.join(Y))}),n.join(`
`)}).join(`
`+J+`
`)}function Mr(e){var t=kr(e);return{value:v([Ar(t.seriesGroupByCategoryAxis),jr(t.other)],function(e){return!!e.replace(/[\n\t\s]/g,``)}).join(`
`+J+`
`),meta:t.meta}}function X(e){return e.replace(/^\s\s*/,``).replace(/\s\s*$/,``)}function Nr(e){if(e.slice(0,e.indexOf(`
`)).indexOf(Y)>=0)return!0}var Pr=RegExp(`[`+Y+`]+`,`g`);function Fr(e){for(var t=e.split(/\n+/g),n=X(t.shift()).split(Pr),r=[],i=b(n,function(e){return{name:e,data:[]}}),a=0;a<t.length;a++){var o=X(t[a]).split(Pr);r.push(o.shift());for(var s=0;s<o.length;s++)i[s]&&(i[s].data[a]=o[s])}return{series:i,categories:r}}function Ir(e){for(var t=e.split(/\n+/g),n=X(t.shift()),r=[],i=0;i<t.length;i++){var a=X(t[i]);if(a){var o=a.split(Pr),s=``,c=void 0,l=!1;isNaN(o[0])?(l=!0,s=o[0],o=o.slice(1),r[i]={name:s,value:[]},c=r[i].value):c=r[i]=[];for(var u=0;u<o.length;u++)c.push(+o[u]);c.length===1&&(l?r[i].value=c[0]:r[i]=c[0])}}return{name:n,data:r}}function Lr(e,t){var n=e.split(RegExp(`
*`+J+`
*`,`g`)),r={series:[]};return I(n,function(e,n){if(Nr(e)){var i=Fr(e),a=t[n],o=a.axisDim+`Axis`;a&&(r[o]=r[o]||[],r[o][a.axisIndex]={data:i.categories},r.series=r.series.concat(i.series))}else{var i=Ir(e);r.series.push(i)}}),r}var Rr=function(e){C(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.onclick=function(e,t){setTimeout(function(){t.dispatchAction({type:`hideTip`})});var n=t.getDom(),r=this.model;this._dom&&n.removeChild(this._dom);var i=document.createElement(`div`);i.style.cssText=`position:absolute;top:0;bottom:0;left:0;right:0;padding:5px`,i.style.backgroundColor=r.get(`backgroundColor`)||D.color.neutral00;var a=document.createElement(`h4`),o=r.get(`lang`)||[];a.innerHTML=o[0]||r.get(`title`),a.style.cssText=`margin:10px 20px`,a.style.color=r.get(`textColor`);var s=document.createElement(`div`),c=document.createElement(`textarea`);s.style.cssText=`overflow:auto`;var l=r.get(`optionToContent`),d=r.get(`contentToOption`),f=Mr(e);if(N(l)){var p=l(t.getOption());fe(p)?s.innerHTML=p:u(p)&&s.appendChild(p)}else{c.readOnly=r.get(`readOnly`);var m=c.style;m.cssText=`display:block;width:100%;height:100%;font-family:monospace;font-size:14px;line-height:1.6rem;resize:none;box-sizing:border-box;outline:none`,m.color=r.get(`textColor`),m.borderColor=r.get(`textareaBorderColor`),m.backgroundColor=r.get(`textareaColor`),c.value=f.value,s.appendChild(c)}var h=f.meta,g=document.createElement(`div`);g.style.cssText=`position:absolute;bottom:5px;left:0;right:0`;var _=`float:right;margin-right:20px;border:none;cursor:pointer;padding:2px 5px;font-size:12px;border-radius:3px`,v=document.createElement(`div`),y=document.createElement(`div`);_+=`;background-color:`+r.get(`buttonColor`),_+=`;color:`+r.get(`buttonTextColor`);var b=this;function x(){n.removeChild(i),b._dom=null}Ie(v,`click`,x),Ie(y,`click`,function(){if(d==null&&l!=null||d!=null&&l==null){x();return}var e;try{e=N(d)?d(s,t.getOption()):Lr(c.value,h)}catch(e){throw x(),Error(`Data view format error `+e)}e&&t.dispatchAction({type:`changeDataView`,newOption:e}),x()}),v.innerHTML=o[1],y.innerHTML=o[2],y.style.cssText=v.style.cssText=_,!r.get(`readOnly`)&&g.appendChild(y),g.appendChild(v),i.appendChild(a),i.appendChild(s),i.appendChild(g),s.style.height=n.clientHeight-80+`px`,n.appendChild(i),this._dom=i},t.prototype.dispose=function(e,t){this._dom&&t.getDom().removeChild(this._dom)},t.getDefaultOption=function(e){return{show:!0,readOnly:!1,optionToContent:null,contentToOption:null,icon:`M17.5,17.3H33 M17.5,17.3H33 M45.4,29.5h-28 M11.5,2v56H51V14.8L38.4,2H11.5z M38.4,2.2v12.7H51 M45.4,41.7h-28`,title:e.getLocaleModel().get([`toolbox`,`dataView`,`title`]),lang:e.getLocaleModel().get([`toolbox`,`dataView`,`lang`]),backgroundColor:D.color.background,textColor:D.color.primary,textareaColor:D.color.background,textareaBorderColor:D.color.border,buttonColor:D.color.accent50,buttonTextColor:D.color.neutral00}},t}(K);function zr(e,t){return b(e,function(e,n){var r=t&&t[n];if(le(r)&&!P(r)){le(e)&&!P(e)||(e={value:e});var i=r.name!=null&&e.name==null;return e=h(e,r),i&&delete e.name,e}else return e})}wt({type:`changeDataView`,event:`dataViewChanged`,update:`prepareAndUpdate`},function(e,t){var n=[];I(e.newOption.series,function(e){var r=t.getSeriesByName(e.name)[0];if(!r)n.push(A({type:`scatter`},e));else{var i=r.get(`data`);n.push({name:e.name,data:zr(e.data,i)})}}),t.mergeOption(h({series:n},e.newOption))});var Br=I,Vr=x();function Hr(e,t){var n=Kr(e);Br(t,function(t,r){for(var i=n.length-1;i>=0&&!n[i][r];i--);if(i<0){var a=e.queryComponents({mainType:`dataZoom`,subType:`select`,id:r})[0];if(a){var o=a.getPercentRange();n[0][r]={dataZoomId:r,start:o[0],end:o[1]}}}}),n.push(t)}function Ur(e){var t=Kr(e),n=t[t.length-1];t.length>1&&t.pop();var r={};return Br(n,function(e,n){for(var i=t.length-1;i>=0;i--)if(e=t[i][n],e){r[n]=e;break}}),r}function Wr(e){Vr(e).snapshots=null}function Gr(e){return Kr(e).length}function Kr(e){var t=Vr(e);return t.snapshots||=[{}],t.snapshots}var qr=function(e){C(t,e);function t(){return e!==null&&e.apply(this,arguments)||t
<span style="color:${r};font-weight:600">${n}</span>
${e.server_name||`—`} · ${t} ${e.value||``}
${i?`<span style="opacity:0.7"> @ ${i}</span>`:``}
</div>`}),r=t.length>8?`<div style="font-size:11px;opacity:0.7">还有 ${t.length-8} 条…</div>`:``;return`<div style="margin-top:8px;padding-top:8px;border-top:1px solid rgba(128,128,128,0.25)">
<div style="font-weight:600;font-size:12px;margin-bottom:4px">告警 ${t.length} 条(10 分钟窗口)</div>
${n.join(``)}${r}
</div>`}function b(e,t){let n=Ut(e.recorded_at),r=t>0?l.points[t-1]:null,i=(e,t,n,r,i)=>{let a=``;if(n!=null&&r!=null){let e=Math.round((n-r)*10)/10;a=`<span style="color:${e>0?`#FB8C00`:e<0?`#4CAF50`:`#9E9E9E`};font-size:11px;margin-left:6px">${e>0?`+`:``}${e}${i}</span>`}return`<tr>
<td style="padding:2px 8px 2px 0;white-space:nowrap">
<span style="display:inline-block;width:8px;height:8px;border-radius:50%;background:${e};margin-right:6px"></span>${t}
</td>
<td style="padding:2px 0;text-align:right">${n==null?`—`:`<b>${n}${i}</b>`}${a}</td>
</tr>`},a=e.sample_count!=null&&e.online_count>0?Math.round(e.sample_count/e.online_count*100):null,o=[`在线 <b>${e.online_count}</b> 台`,e.sample_count==null?null:`采样 <b>${e.sample_count}</b>`,a==null?null:`覆盖率 <b>${a}%</b>`].filter(Boolean).join(` · `);return`<div style="min-width:200px;line-height:1.5">
<div style="font-weight:600;font-size:13px;margin-bottom:8px">${n}</div>
<table style="width:100%;border-collapse:collapse;font-size:12px">${[i(f(`primary`),`CPU`,e.cpu_avg,r?.cpu_avg??null,`%`),i(f(`warning`),`内存`,e.mem_avg,r?.mem_avg??null,`%`),i(`#9C27B0`,`磁盘`,e.disk_avg,r?.disk_avg??null,`%`),i(f(`success`),`在线`,e.online_count,r?.online_count??null,` 台`)].join(``)}</table>
<div style="margin-top:8px;font-size:11px;opacity:0.75">${o}</div>
${y(e)}
</div>`}let x=s(()=>l.zoomStart==null?l.hours>=168?65:0:l.zoomStart),S=s(()=>l.zoomEnd??100),C=s(()=>{let e=d.current.value.dark,t=e?`rgba(255,255,255,0.78)`:`rgba(0,0,0,0.65)`,n=e?`rgba(255,255,255,0.14)`:`rgba(0,0,0,0.1)`,r=e?`rgba(255,255,255,0.07)`:`rgba(0,0,0,0.06)`,i=f(`primary`),a=f(`warning`),o=f(`success`),s=f(`error`),c=v();return{animationDuration:600,animationEasing:`cubicOut`,color:[i,a,`#9C27B0`,o,s],grid:{left:12,right:16,top:52,bottom:78,containLabel:!0},legend:{top:6,left:`center`,textStyle:{color:t,fontSize:12},itemWidth:18,itemHeight:8,itemGap:20,selected:{在线台数:!1,告警:c.length>0}},tooltip:{trigger:`axis`,confine:!0,axisPointer:{type:`cross`,snap:!0,crossStyle:{color:n},lineStyle:{color:i,type:`dashed`,width:1},label:{backgroundColor:e?`#333`:`#666`,formatter:e=>{let t=e.axisDimension,n=e.value;return t===`x`&&n!=null?_(Number(n),!0):t===`y`&&n!=null?`${Math.round(Number(n)*10)/10}`:``}}},backgroundColor:e?`rgba(28,28,32,0.97)`:`rgba(255,255,255,0.98)`,borderColor:n,borderWidth:1,padding:[10,12],extraCssText:`box-shadow:0 8px 24px rgba(0,0,0,0.18);border-radius:8px;`,textStyle:{color:e?`#eee`:`#222`},formatter(e){let t=(Array.isArray(e)?e:[e])[0]?.axisValue;if(t==null)return``;let n=typeof t==`number`?t:Number(t),r=Vt(l.points,n);return r<0||r>=l.points.length?``:b(l.points[r],r)}},toolbox:{right:12,top:4,itemSize:14,iconStyle:{borderColor:t},feature:{dataZoom:{yAxisIndex:`none`,title:{zoom:`框选`,back:`还原`}},restore:{title:`重置`},saveAsImage:{title:`导出图片`,name:`nexus-fleet-trend`,pixelRatio:2}}},dataZoom:[{type:`inside`,start:x.value,end:S.value,minValueSpan:Gi},{type:`slider`,height:24,bottom:10,start:x.value,end:S.value,borderColor:n,backgroundColor:e?`rgba(255,255,255,0.04)`:`rgba(0,0,0,0.03)`,fillerColor:e?`rgba(25,118,210,0.2)`:`rgba(25,118,210,0.15)`,handleStyle:{color:i,borderColor:i},moveHandleStyle:{color:i},textStyle:{color:t,fontSize:10},labelFormatter:e=>_(e,!0)}],xAxis:{type:`time`,minInterval:Gi,maxInterval:l.hours>=168?360*60*1e3:3600*1e3,axisLine:{lineStyle:{color:n}},axisLabel:{color:t,fontSize:10,hideOverlap:!0,formatter:e=>_(e,!0)},axisTick:{show:!1},splitLine:{show:!0,lineStyle:{color:r,type:`dotted`}},minorSplitLine:{show:!1}},yAxis:[{type:`value`,name:`利用率`,min:0,max:100,nameTextStyle:{color:t,fontSize:11,padding:[0,0,0,4]},axisLabel:{color:t,fontSize:10,formatter:`{value}%`},splitLine:{lineStyle:{color:r,type:`dashed`}}},{type:`value`,name:`在线台数`,position:`right`,minInterval:1,nameTextStyle:{color:t,fontSize:11},axisLabel:{color:t,fontSize:10},splitLine:{show:!1}}],series:[{name:`CPU`,type:`line`,smooth:.28,showSymbol:!1,symbolSize:7,connectNulls:!1,emphasis:{focus:`series`,scale:!0},lineStyle:{width:2.5},areaStyle:{color:{type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:`${i}40`},{offset:1,color:`${i}06`}]}},markLine:{symbol:`none`,silent:!0,data:h(l.thresholds.cpu,`CPU 告警`,s)},markPoint:g(),data:p(`cpu_avg`)},{name:`内存`,type:`line`,smooth:.28,showSymbol:!1,connectNulls:!1,emphasis:{focus:`series`},lineStyle:{width:2},areaStyle:{color:{type:`linear`,x:0,y:0,x2:0,y2:1,colorStops:[{offset:0,color:`${a}35`},{offset:1,color:`${a}05`}]}},markLine:{symbol:`none`,silent:!0,data:h(l.thresholds.mem,`内存告警`,s)},data:p(`mem_avg`)},{name:`磁盘`,type:`line`,smooth:.28,showSymbol:!1,connectNulls:!1,emphasis:{focus:`series`},lineStyle:{width:2},markLine:{symbol:`none`,silent:!0,data:h(l.thresholds.disk,`磁盘告警`,s)},data:p(`disk_avg`)},{name:`在线台数`,type:`line`,yAxisIndex:1,smooth:.28,showSymbol:!1,connectNulls:!1,emphasis:{focus:`series`},lineStyle:{width:2,type:`dashed`,opacity:.85},data:m()},...c.length?[{name:`告警`,type:`scatter`,yAxisIndex:0,symbol:`pin`,symbolSize:e=>{let t=e?.[2]??1;return Math.min(28,12+Number(t)*3)},itemStyle:{color:s},emphasis:{scale:1.2},z:12,data:c}]:[]]}});function ee(e){let t=e.batch?.[0];u(`range-change`,{startPercent:t?.start??e.start??0,endPercent:t?.end??e.end??100})}return(n,a)=>(o(),e(r(ht),{class:`fleet-echart`,style:i({height:`${t.height}px`}),option:C.value,"update-op