import{a1 as M,k as S,aR as T,a as F,aA as O}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{i as V}from"./index.1703796278973314.js";import{d as B}from"./dashboard.17037962789732.js";import{a as h}from"./dayjs.min.1703796278973.js";import{g as N,d as R,a as j,t as z,c as L}from"./tool.1703796278973.js";import{d as C,k as _,m as G,w as P,r as U,o as g,c as A,a as m,z as f,b as p,u as l,t as x,x as K,G as X,H as Z}from"./vue.1703796278973.js";import{_ as $}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=c=>(X("data-v-13e1edef"),c=c(),Z(),c),Q={class:"dash-board"},W={class:"header"},ee=q(()=>f("h3",null,"JVM内存使用率趋势",-1)),te=C({name:"Jvm"}),ae=C({...te,props:{serviceId:{type:String,default:void 0}},setup(c){const w=c,k=_({}),v=_(!1),s=_({type:"hour",time:[null,null]}),I=_(!1),b=()=>{s.value.type=void 0},E=async e=>{var n;v.value=!0;const t=await B(R("jvm",e));if(t.success){const a={},i=new Set;(n=t.result)!=null&&n.length?(t.result.filter(o=>{var r;return((r=o.data)==null?void 0:r.clusterNodeId)===w.serviceId}).forEach(o=>{const r=o.data.value,d=r.memoryJvmHeapFree,H=r.memoryJvmHeapTotal,y=o.data.clusterNodeId,D=((H-d)/H*100).toFixed(2);a[y]||(a[y]=[]),i.add(h(r.timestamp).format("YYYY-MM-DD HH:mm")),a[y].push(D)}),J(a,[...i.keys()])):(J([],[]),I.value=!0)}setTimeout(()=>{v.value=!1},300)},Y=(e,t)=>({data:j(e[t]),name:t,type:"line",smooth:!0,symbol:"none",areaStyle:L}),J=(e,t)=>{if(e.length===0&&t.length===0)return;const n=k.value;if(n){const a=V(n),i=Object.keys(e),u={xAxis:{type:"category",boundaryGap:!1,data:j(t)},tooltip:{trigger:"axis",valueFormatter:o=>`${o}%`},yAxis:{type:"value"},grid:{left:"50px",right:"50px"},dataZoom:[{type:"inside",start:0,end:100},{start:0,end:100}],color:["#60DFC7"],series:i.length?i.map(o=>Y(e,o)):z};a.setOption(u),window.addEventListener("resize",function(){a.resize()})}};return G(()=>s.value.type,e=>{if(e===void 0)return;const t=N(e);s.value.time=[h(t),h(new Date)]},{immediate:!0,deep:!0}),P(()=>{const e=s.value.time;e&&Array.isArray(e)&&e.length===2&&e[0]&&w.serviceId&&E(s.value)}),(e,t)=>{const n=U("AIcon"),a=M,i=S,u=T,o=F,r=O;return g(),A(r,{spinning:l(v)},{default:m(()=>[f("div",Q,[f("div",W,[ee,p(u,{onChange:b,allowClear:!1,"show-time":{format:"HH:mm:ss"},format:"YYYY-MM-DD HH:mm:ss",value:l(s).time,"onUpdate:value":t[1]||(t[1]=d=>l(s).time=d)},{suffixIcon:m(()=>[p(n,{type:"CalendarOutlined"})]),renderExtraFooter:m(()=>[p(i,{"default-value":"a","button-style":"solid",style:{"margin-right":"10px"},value:l(s).type,"onUpdate:value":t[0]||(t[0]=d=>l(s).type=d)},{default:m(()=>[p(a,{value:"hour"},{default:m(()=>[x(" 最近1小时 ")]),_:1}),p(a,{value:"today"},{default:m(()=>[x(" 今日 ")]),_:1}),p(a,{value:"week"},{default:m(()=>[x(" 近一周 ")]),_:1})]),_:1},8,["value"])]),_:1},8,["value"])]),f("div",null,[l(I)?(g(),A(o,{key:0,style:{height:"200px","margin-top":"100px"}})):(g(),K("div",{key:1,ref_key:"chartRef",ref:k,style:{width:"100%",height:"300px"}},null,512))])])]),_:1},8,["spinning"])}}});const Ee=$(ae,[["__scopeId","data-v-13e1edef"]]);export{Ee as default};
