← Back
Editing: container-monitor-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",v="suspendedYield",d="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===d)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=d;var c=p(t,e,n);if("normal"===c.type){if(o=n.done?y:v,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,v,d,y,g,b,w,x,_,k,L,E,S;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.ay,m=t.w,v=t.p,d=t.aD,y=t.G,g=t.H,b=t.x,w=t.q,x=t.v,_=t.y,k=t.B,L=t.z,E=t.e,S=t.n},null],execute:function(){var n={class:"flex flex-col !h-full"},j={class:"card"},O={class:"con flex items-center"},P={class:"p-[1.5rem] text-[1.2rem] font-bold"},N={class:"text-[#919191]"},G={class:"p-[1.5rem] text-[1.2rem] font-bold"},B={class:"text-[#919191]"},I={class:"chartCon flex flex-wrap w-full justify-between"},A={class:"flex w-[49%]"},T={class:"card w-full flex-1 mb-[1rem]"},z={class:"chart w-full h-[19rem]"},D={class:"flex w-[49%]"},F={class:"card w-full flex-1 mb-[1rem]"},K={class:"chart w-full h-[19rem]"},M={class:"flex w-[49%]"},R={class:"card w-full flex-1 mb-[1rem]"},C={class:"chart w-full h-[19rem]"},U={class:"flex w-[49%]"},q={class:"card w-full flex-1 mb-[1rem]"},H={class:"chart w-full h-[19rem]"},J=u({__name:"container-monitor",props:{compData:{default:function(){return{}}}},setup:function(t){var c=t,u=f(),J=f(),Y=f(),Q=f(),V=f(!1),W=f(),X=h({cpu_list:[],mem_list:{usage:[],cache:[]},disk_list:{read:[],write:[]},network_list:{tx:[],rx:[]},time_list:[],limit:"",top_limit:"",bottom_limit:""}),Z=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:X.limit=a(c.limit),X.top_limit=a(c.tx_total),X.bottom_limit=a(c.rx_total),X.time_list.push(n),X.mem_list.usage.push([n,a(c.usage,!1,null,"MB")]),X.mem_list.cache.push([n,a(c.cache,!1,null,"MB")]),X.cpu_list.push([n,c.cpu_usage]),X.disk_list.read.push([n,a(c.read_total,!1,null,"MB")]),X.disk_list.write.push([n,a(c.write_total,!1,null,"MB")]),X.network_list.tx.push([n,a(c.tx,!1,null,"KB")]),X.network_list.rx.push([n,a(c.rx,!1,null,"KB")]),u=$("cpu"),f=$("mem"),h=$("disk"),p=$("network"),u.xAxis.data=X.time_list,u.series[0].data=X.cpu_list,f.series[0].data=X.mem_list.usage,f.series[1].data=X.mem_list.cache,h.series[0].data=X.disk_list.read,h.series[1].data=X.disk_list.write,p.series[0].data=X.network_list.tx,p.series[1].data=X.network_list.rx,rt.value=u,nt.value=f,ot.value=h,it.value=p,V.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)}}(),$=function(t){var e="/MB",r=tt();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},tt=function(){return{tooltip:{trigger:"axis",axisPointer:{type:"cross"}},grid:{x:50,y:50,x2:30,y2:30},xAxis:{type:"time",scale:!0,splitNumber:2,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"}}}}},et=p("tabActive");m((function(){return et.value}),(function(){"monitor"!==et.value&&(W.value&&clearInterval(W.value),W.value=null)}));var rt=f($("cpu")),nt=f($("mem")),ot=f($("disk")),it=f($("network"));return v((function(){var t;V.value=!0,t=c.compData.row,S((function(){rt.value=$("cpu"),nt.value=$("mem"),ot.value=$("disk"),it.value=$("network"),u.value.chart.resize(),J.value.chart.resize(),Y.value.chart.resize(),Q.value.chart.resize(),Z(t)})),W.value=setInterval((function(){Z(c.compData.row)}),3e3)})),d((function(){clearInterval(W.value)})),function(t,e){var r=s,o=y("bt-loading");return g((w(),x("div",n,[_("div",j,[e[2]||(e[2]=_("div",{class:"title"},"基础信息",-1)),_("div",O,[_("div",P,[e[0]||(e[0]=k(" 内存限额:")),_("span",N,L(b(X).limit),1)]),_("div",G,[e[1]||(e[1]=k(" 流量情况:")),_("span",B," 上行:"+L(b(X).top_limit)+" - 下行:"+L(b(X).bottom_limit),1)])])]),_("div",I,[_("div",A,[_("div",T,[e[3]||(e[3]=_("div",{class:"title"},"CPU",-1)),_("div",z,[E(r,{ref_key:"CPURef",ref:u,options:b(rt)},null,8,["options"])])])]),_("div",D,[_("div",F,[e[4]||(e[4]=_("div",{class:"title"},"内存",-1)),_("div",K,[E(r,{ref_key:"memRef",ref:J,options:b(nt)},null,8,["options"])])])]),_("div",M,[_("div",R,[e[5]||(e[5]=_("div",{class:"title"},"磁盘IO",-1)),_("div",C,[E(r,{ref_key:"diskRef",ref:Y,options:b(ot)},null,8,["options"])])])]),_("div",U,[_("div",q,[e[6]||(e[6]=_("div",{class:"title"},"网络IO",-1)),_("div",H,[E(r,{ref_key:"netRef",ref:Q,options:b(it)},null,8,["options"])])])])])])),[[o,b(V)],[o,"正在获取监控数据,请稍候...","title"]])}}});t("default",c(J,[["__scopeId","data-v-aa6cce5f"]]))}}}))}();
Save File
Cancel