import{a1 as b,k as O,aR as H,a as L,aA as T}from"./index.17037962789732.js";import"./index.1703796278973303.js";import"./index.170379627897317.js";import"./index.170379627897322.js";import"./index.170379627897323.js";import"./index.170379627897315.js";import"./index.1703796278973301.js";import{d as V}from"./dashboard.17037962789732.js";import{g as D,n as F,t as Y,e as z}from"./tool.1703796278973.js";import{a as A}from"./dayjs.min.1703796278973.js";import{i as M}from"./index.1703796278973314.js";import{d as E,k as y,m as U,w as G,r as K,o as h,c as C,a as n,z as c,b as i,u as d,t as f,x as P,G as J,H as X}from"./vue.1703796278973.js";import{_ as q}from"./_plugin-vue_export-helper.1703796278973.js";import"./index.17037962789733.js";import"./isArray.1703796278973.js";import"./editor.api.1703796278973.js";import"./preload-helper.1703796278973.js";import"./monaco.contribution.1703796278973.js";import"./system.1703796278973.js";import"./comm.1703796278973.js";import"./index.170379627897332.js";import"./index.170379627897333.js";import"./index.170379627897334.js";import"./default.1703796278973.js";import"./permission.1703796278973.js";import"./consts.1703796278973.js";import"./404.1703796278973.js";const Q=m=>(J("data-v-7cbe5299"),m=m(),X(),m),W={class:"dash-board"},Z={class:"header"},j={class:"left"},tt=Q(()=>c("h3",{style:{width:"80px"}},"网络流量",-1)),et={class:"right"},at=E({name:"Network"}),ot=E({...at,props:{serviceId:{type:String,default:void 0}},setup(m){const g=m,w=y({}),v=y(!1),s=y({type:"bytesRead",time:{type:"hour",time:[null,null]}}),k=y(!1),S=t=>{s.value.time.type=void 0},B=async t=>{v.value=!0;const e=await V(F(t));if(e.success){const a={},l=new Set;e.result.length?(e.result.filter(p=>{var o;return((o=p.data)==null?void 0:o.clusterNodeId)===g.serviceId}).forEach(p=>{const o=p.data.value,_=[],r=p.data.clusterNodeId;o.forEach(N=>{_.push(N.value),l.add(N.timeString)}),a[r]={_data:a[r]?a[r]._data.concat(_):_}}),I(a,[...l.keys()])):(I([],[]),k.value=!0)}setTimeout(()=>{v.value=!1},300)},x=t=>{let e="";return t>=1024&&t<1024*1024?e=`${Number((t/1024).toFixed(2))}KB`:t>=1024*1024?e=`${Number((t/1024/1024).toFixed(2))}M`:e=`${t}B`,e},R=t=>{const{value:e}=t;return`${t==null?void 0:t.axisValueLabel}<br />${t==null?void 0:t.marker}${t==null?void 0:t.seriesName} &nbsp; ${x(e)}`},$=(t,e)=>({data:t[e]._data,name:e,type:"line",smooth:!0,areaStyle:z}),I=(t,e)=>{if(t.length===0&&e.length===0)return;const a=w.value;if(a){const l=M(a),u=Object.keys(t),p={xAxis:{type:"category",boundaryGap:!1,data:e},yAxis:{type:"value",axisLabel:{formatter:o=>x(o)}},grid:{left:"70px",right:10,bottom:"24px",top:24},tooltip:{trigger:"axis",formatter:o=>R(o[0])},color:["#979AFF"],series:u.length?u.map(o=>$(t,o)):Y};l.setOption(p),window.addEventListener("resize",function(){l.resize()})}};return U(()=>s.value.time.type,t=>{if(t===void 0)return;const e=D(t);s.value.time.time=[A(e),A(new Date)]},{immediate:!0,deep:!0}),G(()=>{const t=s.value.time.time;t&&Array.isArray(t)&&t.length===2&&t[0]&&g.serviceId&&B(s.value)}),(t,e)=>{const a=b,l=O,u=K("AIcon"),p=H,o=L,_=T;return h(),C(_,{spinning:d(v)},{default:n(()=>[c("div",W,[c("div",Z,[c("div",j,[tt,i(l,{"button-style":"solid",value:d(s).type,"onUpdate:value":e[0]||(e[0]=r=>d(s).type=r)},{default:n(()=>[i(a,{value:"bytesRead"},{default:n(()=>[f(" 上行 ")]),_:1}),i(a,{value:"bytesSent"},{default:n(()=>[f(" 下行 ")]),_:1})]),_:1},8,["value"])]),c("div",et,[i(l,{"default-value":"a","button-style":"solid",style:{"margin-right":"10px"},value:d(s).time.type,"onUpdate:value":e[1]||(e[1]=r=>d(s).time.type=r)},{default:n(()=>[i(a,{value:"hour"},{default:n(()=>[f(" 最近1小时 ")]),_:1}),i(a,{value:"today"},{default:n(()=>[f(" 今日 ")]),_:1}),i(a,{value:"week"},{default:n(()=>[f(" 近一周 ")]),_:1})]),_:1},8,["value"]),i(p,{allowClear:!1,"show-time":{format:"HH:mm:ss"},format:"YYYY-MM-DD HH:mm:ss",value:d(s).time.time,"onUpdate:value":e[2]||(e[2]=r=>d(s).time.time=r),onChange:S},{suffixIcon:n(()=>[i(u,{type:"CalendarOutlined"})]),_:1},8,["value"])])]),c("div",null,[d(k)?(h(),C(o,{key:0,style:{height:"250px","margin-top":"100px"}})):(h(),P("div",{key:1,ref_key:"chartRef",ref:w,style:{width:"100%",height:"350px"}},null,512))])])]),_:1},8,["spinning"])}}});const $t=q(ot,[["__scopeId","data-v-7cbe5299"]]);export{$t as default};
