← Back
Editing: real-monitor-dialog-legacy.js
!function(){function t(e){return t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t(e)}function e(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */e=function(){return n};var r,n={},o=Object.prototype,i=o.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},l="function"==typeof Symbol?Symbol:{},s=l.iterator||"@@iterator",c=l.asyncIterator||"@@asyncIterator",u=l.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(r){f=function(t,e,r){return t[e]=r}}function h(t,e,r,n){var o=e&&e.prototype instanceof b?e:b,i=Object.create(o.prototype),l=new B(n||[]);return a(i,"_invoke",{value:O(t,r,l)}),i}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}n.wrap=h;var m="suspendedStart",d="suspendedYield",v="executing",y="completed",g={};function b(){}function w(){}function x(){}var _={};f(_,s,(function(){return this}));var k=Object.getPrototypeOf,L=k&&k(k(I([])));L&&L!==o&&i.call(L,s)&&(_=L);var E=x.prototype=b.prototype=Object.create(_);function S(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function j(e,r){function n(o,a,l,s){var c=p(e[o],e,a);if("throw"!==c.type){var u=c.arg,f=u.value;return f&&"object"==t(f)&&i.call(f,"__await")?r.resolve(f.__await).then((function(t){n("next",t,l,s)}),(function(t){n("throw",t,l,s)})):r.resolve(f).then((function(t){u.value=t,l(u)}),(function(t){return n("throw",t,l,s)}))}s(c.arg)}var o;a(this,"_invoke",{value:function(t,e){function i(){return new r((function(r,o){n(t,e,r,o)}))}return o=o?o.then(i,i):i()}})}function O(t,e,n){var o=m;return function(i,a){if(o===v)throw Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:r,done:!0}}for(n.method=i,n.arg=a;;){var l=n.delegate;if(l){var s=P(l,n);if(s){if(s===g)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===m)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var c=p(t,e,n);if("normal"===c.type){if(o=n.done?y:d,c.arg===g)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(o=y,n.method="throw",n.arg=c.arg)}}}function P(t,e){var n=e.method,o=t.iterator[n];if(o===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,P(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=p(o,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,g;var a=i.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,g):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function N(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function G(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function B(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function I(e){if(e||""===e){var n=e[s];if(n)return n.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,a=function t(){for(;++o<e.length;)if(i.call(e,o))return t.value=e[o],t.done=!1,t;return t.value=r,t.done=!0,t};return a.next=a}}throw new TypeError(t(e)+" is not iterable")}return w.prototype=x,a(E,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:w,configurable:!0}),w.displayName=f(x,u,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,f(t,u,"GeneratorFunction")),t.prototype=Object.create(E),t},n.awrap=function(t){return{__await:t}},S(j.prototype),f(j.prototype,c,(function(){return this})),n.AsyncIterator=j,n.async=function(t,e,r,o,i){void 0===i&&(i=Promise);var a=new j(h(t,e,r,o),i);return n.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},S(E),f(E,u,"Generator"),f(E,s,(function(){return this})),f(E,"toString",(function(){return"[object Generator]"})),n.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},n.values=I,B.prototype={constructor:B,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(G),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,o){return l.type="throw",l.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],l=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var s=i.call(a,"catchLoc"),c=i.call(a,"finallyLoc");if(s&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&i.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var o=n;break}}o&&("break"===t||"continue"===t)&&o.tryLoc<=e&&e<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=t,a.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),G(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;G(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:I(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),g}},n}function r(t,e,r,n,o,i,a){try{var l=t[i](a),s=l.value}catch(t){return void r(t)}l.done?e(s):Promise.resolve(s).then(n,o)}System.register(["./utils-lib-legacy.js?v=VERSION_NUMBER","./base-lib-legacy.js?v=VERSION_NUMBER","./__commonjsHelpers__-legacy.js?v=VERSION_NUMBER"],(function(t,n){"use strict";var o,i,a,l,s,c,u,f,h,p,m,d,v,y,g,b,w,x,_,k,L;return{setters:[function(t){o=t.K,i=t.gJ,a=t.w,l=t.R,s=t.gK,c=t.e},function(t){u=t.c,f=t.r,h=t.k,p=t.p,m=t.n,d=t.aD,v=t.G,y=t.H,g=t.x,b=t.q,w=t.v,x=t.y,_=t.B,k=t.z,L=t.e},null],execute:function(){var n={class:"flex flex-col p-[1.6rem] lib-box !h-full overflow-auto"},E={class:"card"},S={class:"con flex items-center"},j={class:"p-[1.5rem] text-[1.3rem] font-bold"},O={class:"font-normal text-[#919191]"},P={class:"p-[1.5rem] text-[1.3rem] font-bold"},N={class:"font-normal text-[#919191]"},G={class:"chartCon flex flex-wrap w-full justify-between"},B={class:"flex w-[49%]"},I={class:"card w-full flex-1 mb-[1rem]"},T={class:"chart w-full h-[30rem]"},A={class:"flex w-[49%]"},z={class:"card w-full flex-1 mb-[1rem]"},D={class:"chart w-full h-[30rem]"},F={class:"flex w-[49%]"},K={class:"card w-full flex-1 mb-[1rem]"},M={class:"chart w-full h-[30rem]"},R={class:"flex w-[49%]"},C={class:"card w-full flex-1 mb-[1rem]"},U={class:"chart w-full h-[30rem]"},q=u({__name:"real-monitor-dialog",props:{compData:{default:function(){return{}}}},setup:function(t){var c=t,u=f(),q=f(),H=f(),J=f(),Y=f(!1),Q=h({cpu_list:[],mem_list:{usage:[],cache:[]},disk_list:{read:[],write:[]},network_list:{tx:[],rx:[]},time_list:[],limit:"",top_limit:"",bottom_limit:""}),V=null,W=function(){var t,n=(t=e().mark((function t(r){var n,l,s,c,u,f,h,p;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=(new Date).getTime(),l=JSON.stringify({id:r.id,dk_status:r.status}),t.next=4,o({request:i({data:l})});case 4:if(s=t.sent,c=s.data,s.status){t.next=8;break}return t.abrupt("return",!1);case 8:Q.limit=a(c.limit),Q.top_limit=a(c.tx_total),Q.bottom_limit=a(c.rx_total),Q.time_list.push(n),Q.mem_list.usage.push([n,a(c.usage,!1,null,"MB")]),Q.mem_list.cache.push([n,a(c.cache,!1,null,"MB")]),Q.cpu_list.push([n,c.cpu_usage]),Q.disk_list.read.push([n,a(c.read_total,!1,null,"MB")]),Q.disk_list.write.push([n,a(c.write_total,!1,null,"MB")]),Q.network_list.tx.push([n,a(c.tx,!1,null,"KB")]),Q.network_list.rx.push([n,a(c.rx,!1,null,"KB")]),u=X("cpu"),f=X("mem"),h=X("disk"),p=X("network"),u.xAxis.data=Q.time_list,u.series[0].data=Q.cpu_list,f.series[0].data=Q.mem_list.usage,f.series[1].data=Q.mem_list.cache,h.series[0].data=Q.disk_list.read,h.series[1].data=Q.disk_list.write,p.series[0].data=Q.network_list.tx,p.series[1].data=Q.network_list.rx,$.value=u,tt.value=f,et.value=h,rt.value=p,Y.value=!1;case 36:case"end":return t.stop()}}),t)})),function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function l(t){r(a,o,i,l,s,"next",t)}function s(t){r(a,o,i,l,s,"throw",t)}l(void 0)}))});return function(t){return n.apply(this,arguments)}}(),X=function(t){var e="/MB",r=Z();switch(t){case"cpu":r.tooltip.formatter=function(t){var e=t[0];return l(e.data[0])+"<br>"+e.seriesName+": "+e.data[1]+"%"},r.yAxis.min=0,r.series=[{name:"CPU",type:"line",symbol:"none",smooth:!0,itemStyle:{normal:{color:"rgb(0, 153, 238)"}}}];break;case"network":e="/KB";case"mem":case"disk":var n={mem:["内存","缓存"],disk:["读取","写入"],network:["上行","下行"],color:[{mem:["rgb(185, 220, 253)","rgb(185, 220, 253,0.6)","rgb(185, 220, 253,0.3)","rgba(229,147,187)","rgba(229,147,187,0.6)","rgba(229,147,187,0.3)"],disk:["rgb(255, 70, 131)","rgb(255, 70, 131,0.6)","rgb(255, 70, 131,0.3)","rgba(46, 165, 186)","rgba(46, 165, 186,0.6)","rgba(46, 165, 186,0.3)"],network:["rgb(255, 140, 0)","rgb(255, 140, 0,0.6)","rgb(255, 140, 0,0.3)","rgb(30, 144, 255)","rgb(30, 144, 255,0.6)","rgb(30, 144, 255,0.3)"]}]};r.tooltip.formatter=function(t){for(var r=t[0].data[0],n=l(r/1e3),o="",i=0;i<t.length;i++)o+='<span style="display: inline-block; width: 10px; height: 10px; margin-rigth:10px; border-radius: 50%; background: '+t[i].color+';"></span> '+t[i].seriesName+":",o+=t[i].data[1]+e+(t.length-1!==i?"<br />":"");return"时间:"+n+"<br />"+o},r.legend={top:"18px",data:n[t]},r.series=[{name:n[t][0],type:"line",symbol:"none",itemStyle:{normal:{color:n.color[0][t][0],areaStyle:{}}}},{name:n[t][1],type:"line",symbol:"none",itemStyle:{normal:{color:n.color[0][t][4],areaStyle:{}}}}]}return r},Z=function(){return{tooltip:{trigger:"axis",axisPointer:{type:"cross"}},grid:{x:50,y:50,x2:30,y2:30},xAxis:{type:"time",scale:!0,splitNumber:4,boundaryGap:!0,axisLine:{lineStyle:{color:"#666"}},axisLabel:{formatter:function(t){return l(t/1e3,"hh:mm:ss")}}},yAxis:{type:"value",boundaryGap:[0,"100%"],splitLine:{lineStyle:{color:"#ddd"}},axisLine:{lineStyle:{color:"#666"}}}}},$=f(X("cpu")),tt=f(X("mem")),et=f(X("disk")),rt=f(X("network"));return p((function(){Y.value=!0,m((function(){var t;t=c.compData.row,m((function(){$.value=X("cpu"),tt.value=X("mem"),et.value=X("disk"),rt.value=X("network"),W(t),u.value.chart.resize(),q.value.chart.resize(),H.value.chart.resize(),J.value.chart.resize()})),V=setInterval((function(){W(c.compData.row)}),3e3)}))})),d((function(){clearInterval(V)})),function(t,e){var r=s,o=v("bt-loading");return y((b(),w("div",n,[x("div",E,[e[2]||(e[2]=x("div",{class:"title"},"基础信息",-1)),x("div",S,[x("div",j,[e[0]||(e[0]=_(" 内存限额:")),x("span",O,k(g(Q).limit),1)]),x("div",P,[e[1]||(e[1]=_(" 流量情况:")),x("span",N," 上行:"+k(g(Q).top_limit)+" - 下行:"+k(g(Q).bottom_limit),1)])])]),x("div",G,[x("div",B,[x("div",I,[e[3]||(e[3]=x("div",{class:"title"},"CPU",-1)),x("div",T,[L(r,{ref_key:"CPURef",ref:u,options:g($)},null,8,["options"])])])]),x("div",A,[x("div",z,[e[4]||(e[4]=x("div",{class:"title"},"内存",-1)),x("div",D,[L(r,{ref_key:"memRef",ref:q,options:g(tt)},null,8,["options"])])])]),x("div",F,[x("div",K,[e[5]||(e[5]=x("div",{class:"title"},"磁盘IO",-1)),x("div",M,[L(r,{ref_key:"diskRef",ref:H,options:g(et)},null,8,["options"])])])]),x("div",R,[x("div",C,[e[6]||(e[6]=x("div",{class:"title"},"网络IO",-1)),x("div",U,[L(r,{ref_key:"netRef",ref:J,options:g(rt)},null,8,["options"])])])])])])),[[o,g(Y)],[o,"正在获取监控数据,请稍候...","title"]])}}});t("default",c(q,[["__scopeId","data-v-a009d1f6"]]))}}}))}();
Save File
Cancel