← Back
Editing: index-legacy363.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 r};var n,r={},o=Object.prototype,i=o.hasOwnProperty,a=Object.defineProperty||function(t,e,n){t[e]=n.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",s=u.toStringTag||"@@toStringTag";function f(t,e,n){return Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(n){f=function(t,e,n){return t[e]=n}}function p(t,e,n,r){var o=e&&e.prototype instanceof w?e:w,i=Object.create(o.prototype),u=new G(r||[]);return a(i,"_invoke",{value:S(t,n,u)}),i}function h(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}r.wrap=p;var d="suspendedStart",v="suspendedYield",y="executing",m="completed",g={};function w(){}function b(){}function x(){}var _={};f(_,c,(function(){return this}));var L=Object.getPrototypeOf,k=L&&L(L(F([])));k&&k!==o&&i.call(k,c)&&(_=k);var j=x.prototype=w.prototype=Object.create(_);function E(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function O(e,n){function r(o,a,u,c){var l=h(e[o],e,a);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==t(f)&&i.call(f,"__await")?n.resolve(f.__await).then((function(t){r("next",t,u,c)}),(function(t){r("throw",t,u,c)})):n.resolve(f).then((function(t){s.value=t,u(s)}),(function(t){return r("throw",t,u,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(t,e){function i(){return new n((function(n,o){r(t,e,n,o)}))}return o=o?o.then(i,i):i()}})}function S(t,e,r){var o=d;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===m){if("throw"===i)throw a;return{value:n,done:!0}}for(r.method=i,r.arg=a;;){var u=r.delegate;if(u){var c=P(u,r);if(c){if(c===g)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(o===d)throw o=m,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);o=y;var l=h(t,e,r);if("normal"===l.type){if(o=r.done?m:v,l.arg===g)continue;return{value:l.arg,done:r.done}}"throw"===l.type&&(o=m,r.method="throw",r.arg=l.arg)}}}function P(t,e){var r=e.method,o=t.iterator[r];if(o===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=n,P(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),g;var i=h(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=n),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 C(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function G(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function F(e){if(e||""===e){var r=e[c];if(r)return r.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=n,t.done=!0,t};return a.next=a}}throw new TypeError(t(e)+" is not iterable")}return b.prototype=x,a(j,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:b,configurable:!0}),b.displayName=f(x,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,f(t,s,"GeneratorFunction")),t.prototype=Object.create(j),t},r.awrap=function(t){return{__await:t}},E(O.prototype),f(O.prototype,l,(function(){return this})),r.AsyncIterator=O,r.async=function(t,e,n,o,i){void 0===i&&(i=Promise);var a=new O(p(t,e,n,o),i);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(j),f(j,s,"Generator"),f(j,c,(function(){return this})),f(j,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),n=[];for(var r in e)n.push(r);return n.reverse(),function t(){for(;n.length;){var r=n.pop();if(r in e)return t.value=r,t.done=!1,t}return t.done=!0,t}},r.values=F,G.prototype={constructor:G,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(C),!t)for(var e in this)"t"===e.charAt(0)&&i.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},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 r(r,o){return u.type="throw",u.arg=t,e.next=r,o&&(e.method="next",e.arg=n),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var c=i.call(a,"catchLoc"),l=i.call(a,"finallyLoc");if(c&&l){if(this.prev<a.catchLoc)return r(a.catchLoc,!0);if(this.prev<a.finallyLoc)return r(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return r(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return r(a.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&i.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var o=r;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 n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),C(n),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var o=r.arg;C(n)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:F(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),g}},r}function n(t,e,n,r,o,i,a){try{var u=t[i](a),c=u.value}catch(t){return void n(t)}u.done?e(c):Promise.resolve(c).then(r,o)}function r(t){return function(){var e=this,r=arguments;return new Promise((function(o,i){var a=t.apply(e,r);function u(t){n(a,o,i,u,c,"next",t)}function c(t){n(a,o,i,u,c,"throw",t)}u(void 0)}))}}System.register(["./index-legacy103.js?v=VERSION_NUMBER","./base-lib-legacy.js?v=VERSION_NUMBER","./utils-lib-legacy.js?v=VERSION_NUMBER","./index-legacy116.js?v=VERSION_NUMBER","./column-legacy.js?v=VERSION_NUMBER","./site-legacy.js?v=VERSION_NUMBER","./__commonjsHelpers__-legacy.js?v=VERSION_NUMBER","./index-legacy104.js?v=VERSION_NUMBER"],(function(t,n){"use strict";var o,i,a,u,c,l,s,f,p,h,d,v,y,m,g,w,b,x,_,L,k,j,E,O,S,P,N,C,G,F,M,T,V,I,A,H;return{setters:[function(t){o=t._},function(t){i=t.c,a=t.r,u=t.p,c=t.G,l=t.q,s=t.v,f=t.e,p=t.A,h=t.B,d=t.H,v=t.x,y=t.y,m=t.P,g=t.F,w=t.a_,b=t.M,x=t.z,_=t.D,L=t.bN,k=t.bM},function(t){j=t.K,E=t.a5,O=t.R,S=t.ai,P=t.w,N=t.l,C=t.j,G=t.b,F=t.p,M=t.e},function(t){T=t._},function(t){V=t.u},function(t){I=t.getPM2Monit,A=t.getPM2Logs,H=t.setPM2Status},null,null],execute:function(){var n={class:"p-2rem"},q={class:"p-2rem"},D={class:"p-2rem w-full relative"},U=["title"],Y=i({__name:"index",setup:function(t){var i=G(),M=a([]),Y=a(!1),z=a(!1),B=a(""),J=a(!1),K=a({}),R=a({}),Q=a(""),W=a(!1),X=function(){var t=r(e().mark((function t(){var n,r,o=arguments;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=o.length>0&&void 0!==o[0]&&o[0],t.next=3,j({loading:Y,request:I(),data:{data:[Array,function(t){return t.map((function(t){var e;return t.id=null!==(e=t.id)&&void 0!==e?e:t.name+"(集群)",t}))}]}});case 3:r=t.sent,M.value=r.data,n&&i.success("刷新成功");case 6:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),Z=function(){var t=r(e().mark((function t(n,r){var o,i,a;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,J.value=!0,o={mode:n.mode,log_type:r},E(n.id)?o.id=n.id:o.name=n.name,t.next=6,A(o);case 6:i=t.sent,a=i.data,B.value=a.data,t.next=14;break;case 11:t.prev=11,t.t0=t.catch(0);case 14:return t.prev=14,J.value=!1,t.finish(14);case 17:case"end":return t.stop()}}),t,null,[[0,11,14,17]])})));return function(e,n){return t.apply(this,arguments)}}(),$=function(){var t=r(e().mark((function t(n){var r,o,i,a,u=arguments;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=u.length>1&&void 0!==u[1]&&u[1],o="online"===n.status?"stop":"start",i=r?"重启":"stop"===o?"停止":"启动",t.next=5,F({title:"修改集群状态",content:"即将".concat(i,"集群,是否继续?")});case 5:return a={mode:n.mode,status:r?"restart":o,name:n.name},E(n.id)?a.id=n.id:a.name=n.name,t.next=9,j({loading:"正在".concat(i,"集群,请稍后..."),request:H(a)});case 9:t.sent.status&&X();case 11:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),tt=function(t,e){B.value="",z.value=!0,K.value=t,Q.value=e,Z(t,e)},et=[{label:"ID",prop:"id",width:100},{label:"服务名称",prop:"name",width:110,render:function(t){return t.data?t.name:f("span",{class:"text-primary cursor-pointer",onClick:function(){return function(t){K.value=t,R.value=t.pm2_env,W.value=!0}(t)}},[t.name])}},{label:"pid",prop:"pid",render:function(t){var e;return null!==(e=t.pid)&&void 0!==e?e:"--"}},{label:"运行用户",prop:"user",width:75},{label:"重启次数",prop:"restart",width:75,render:function(t){return t.restart||"--"}},{label:"创建时间",prop:"addtime",width:150,render:function(t){return O(t.uptime)}},{label:"cpu使用率",prop:"cpu",render:function(t){return S(t.cpu)?t.cpu+"%":"--"}},{label:"内存占用",prop:"memory",render:function(t){return void 0!==t.memory?P(t.memory):"--"}},{label:"日志",prop:"log",width:120,render:function(t){return f("div",null,[f("span",{class:"bt-link cursor-pointer",onClick:function(){return tt(t,"all")}},[h("全部/")]),f("span",{class:"bt-link cursor-pointer",onClick:function(){return tt(t,"err")}},[h("错误/")]),f("span",{class:"bt-link cursor-pointer",onClick:function(){return tt(t,"out")}},[h("运行")])])}},{label:"自动重载",width:75,prop:"auto_restart",render:function(t){return t.data?"--":t.auto_restart?"是":"否"}},{label:"状态",prop:"status",render:function(t){var e="online"===t.status;return f("span",{class:"text-".concat(e?"primary":"danger")},[e?"运行中":"已停止"])}},V([{onClick:function(t){return $(t)},isHide:function(t){return!("online"===t.status)},title:"停止",width:26},{onClick:function(t){return $(t)},isHide:function(t){return"online"===t.status},title:"启动",width:26},{onClick:function(t){return $(t,!0)},title:"重启",width:26}])];return u((function(){X()})),function(t,e){var r=_,i=N,a=T,u=C,j=L,E=k,O=o,S=c("bt-loading");return l(),s("div",n,[f(O,null,{"header-left":p((function(){return[f(r,{onClick:e[0]||(e[0]=function(t){return X(!0)}),type:"default"},{default:p((function(){return e[4]||(e[4]=[h("刷新数据")])})),_:1})]})),content:p((function(){return[d(f(i,{column:v(et),data:v(M),"row-key":"id","max-height":500,"tree-props":{children:"data"}},null,8,["column","data"]),[[S,v(Y)]])]})),"footer-left":p((function(){return e[5]||(e[5]=[y("ul",{class:"mt-8px leading-8 text-[1.2rem] list-disc ml-20px"},[y("li",null,"如果pm2项目无法加载监控信息,可修改node命令行版本号再试")],-1)])})),popup:p((function(){return[f(u,{title:"日志展示",modelValue:v(z),"onUpdate:modelValue":e[2]||(e[2]=function(t){return m(z)?z.value=t:null}),area:[60]},{default:p((function(){return[y("div",q,[f(r,{loading:v(J),type:"primary",onClick:e[1]||(e[1]=function(t){return Z(v(K),v(Q))})},{default:p((function(){return e[6]||(e[6]=[h("刷新日志")])})),_:1},8,["loading"]),d(f(a,{title:"全屏查看日志",class:"h-[40rem] mt-12px",content:v(B)},null,8,["content"]),[[S,v(J)]])])]})),_:1},8,["modelValue"]),f(u,{title:"详情展示【".concat(v(K).name,"】"),modelValue:v(W),"onUpdate:modelValue":e[3]||(e[3]=function(t){return m(W)?W.value=t:null}),area:70},{default:p((function(){return[y("div",D,[f(E,{column:1,border:"",class:"max-h-[46rem] w-full overflow-auto table-descriptions"},{default:p((function(){return[(l(!0),s(g,null,w(Object.entries(v(R)),(function(t,e){return l(),b(j,{key:e},{label:p((function(){return[h(x(t[0]),1)]})),default:p((function(){return[y("span",{title:String(JSON.stringify(t[1])),class:"w-340px truncate inline-block"},x(t[1]),9,U)]})),_:2},1024)})),128))]})),_:1})])]})),_:1},8,["title","modelValue"])]})),_:1})])}}});t("default",M(Y,[["__scopeId","data-v-ff66eccd"]]))}}}))}();
Save File
Cancel