← Back
Editing: index-legacy65.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(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function r(t){for(var r=1;r<arguments.length;r++){var a=null!=arguments[r]?arguments[r]:{};r%2?e(Object(a),!0).forEach((function(e){n(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):e(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function n(e,r,n){return(r=function(e){var r=function(e,r){if("object"!=t(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var a=n.call(e,r||"default");if("object"!=t(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(e)}(e,"string");return"symbol"==t(r)?r:r+""}(r))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,e}function a(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */a=function(){return r};var e,r={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",s=u.asyncIterator||"@@asyncIterator",l=u.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(e){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var a=e&&e.prototype instanceof b?e:b,o=Object.create(a.prototype),u=new A(n||[]);return i(o,"_invoke",{value:S(t,r,u)}),o}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=p;var v="suspendedStart",h="suspendedYield",y="executing",m="completed",g={};function b(){}function w(){}function _(){}var x={};f(x,c,(function(){return this}));var k=Object.getPrototypeOf,j=k&&k(k(q([])));j&&j!==n&&o.call(j,c)&&(x=j);var O=_.prototype=b.prototype=Object.create(x);function L(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function E(e,r){function n(a,i,u,c){var s=d(e[a],e,i);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==t(f)&&o.call(f,"__await")?r.resolve(f.__await).then((function(t){n("next",t,u,c)}),(function(t){n("throw",t,u,c)})):r.resolve(f).then((function(t){l.value=t,u(l)}),(function(t){return n("throw",t,u,c)}))}c(s.arg)}var a;i(this,"_invoke",{value:function(t,e){function o(){return new r((function(r,a){n(t,e,r,a)}))}return a=a?a.then(o,o):o()}})}function S(t,r,n){var a=v;return function(o,i){if(a===y)throw Error("Generator is already running");if(a===m){if("throw"===o)throw i;return{value:e,done:!0}}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var c=P(u,n);if(c){if(c===g)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===v)throw a=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=y;var s=d(t,r,n);if("normal"===s.type){if(a=n.done?m:h,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(a=m,n.method="throw",n.arg=s.arg)}}}function P(t,r){var n=r.method,a=t.iterator[n];if(a===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,P(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var o=d(a,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,g;var i=o.arg;return i?i.done?(r[t.resultName]=i.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,g):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function T(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 N(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function A(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function q(r){if(r||""===r){var n=r[c];if(n)return n.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var a=-1,i=function t(){for(;++a<r.length;)if(o.call(r,a))return t.value=r[a],t.done=!1,t;return t.value=e,t.done=!0,t};return i.next=i}}throw new TypeError(t(r)+" is not iterable")}return w.prototype=_,i(O,"constructor",{value:_,configurable:!0}),i(_,"constructor",{value:w,configurable:!0}),w.displayName=f(_,l,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,_):(t.__proto__=_,f(t,l,"GeneratorFunction")),t.prototype=Object.create(O),t},r.awrap=function(t){return{__await:t}},L(E.prototype),f(E.prototype,s,(function(){return this})),r.AsyncIterator=E,r.async=function(t,e,n,a,o){void 0===o&&(o=Promise);var i=new E(p(t,e,n,a),o);return r.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},L(O),f(O,l,"Generator"),f(O,c,(function(){return this})),f(O,"toString",(function(){return"[object Generator]"})),r.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}},r.values=q,A.prototype={constructor:A,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(N),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},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 r=this;function n(n,a){return u.type="throw",u.arg=t,r.next=n,a&&(r.method="next",r.arg=e),!!a}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=o.call(i,"catchLoc"),s=o.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.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&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=e&&e<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=e,a?(this.method="next",this.next=a.finallyLoc,g):this.complete(i)},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),N(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 a=n.arg;N(r)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:q(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),g}},r}function o(t,e,r,n,a,o,i){try{var u=t[o](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,a)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,a){var i=t.apply(e,r);function u(t){o(i,n,a,u,c,"next",t)}function c(t){o(i,n,a,u,c,"throw",t)}u(void 0)}))}}System.register(["./index-legacy103.js?v=VERSION_NUMBER","./index-legacy145.js?v=VERSION_NUMBER","./utils-lib-legacy.js?v=VERSION_NUMBER","./base-lib-legacy.js?v=VERSION_NUMBER","./column-legacy.js?v=VERSION_NUMBER"],(function(t,e){"use strict";var n,o,u,c,s,l,f,p,d,v,h,y,m,g,b,w,_,x,k,j,O,L,E,S,P,T,N,A,q,R,B,G;return{setters:[function(t){n=t._},function(t){o=t._},function(t){u=t.p,c=t.K,s=t.fc,l=t.M,f=t.eU,p=t.eX,d=t.n,v=t.L,h=t.fd,y=t.u,m=t.a6,g=t.fe,b=t.a7,w=t.a8},function(t){_=t.s,x=t.j,k=t.r,j=t.c,O=t.e,L=t.aQ,E=t.q,S=t.v,P=t.A,T=t.y,N=t.x,A=t.J},function(t){q=t.c,R=t.a,B=t.b,G=t.u}],execute:function(){var M=x("NODE-ALARM-STORE",(function(){var t=k(),e=k(!1);return{alarmRowData:t,nodeAlarmRefresh:k(!1),isAlarmEdit:e}})),C=t("u",(function(){return _(M())})),D=C(),F=D.alarmRowData,I=D.isAlarmEdit,J=D.nodeAlarmRefresh,z=function(){var t=i(a().mark((function t(e,r,n,o){var u,c,l;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=function(){var t=i(a().mark((function t(e,r){var n,o,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e.id,e.status,o=new Map([["delete",s],["start",h],["stop",h]]),i=o.get(l),t.t0=l,t.next="start"===t.t0?6:"stop"===t.t0?11:"delete"===t.t0?16:21;break;case 6:if(!i){t.next=10;break}return t.next=9,i({task_id:n,status:1});case 9:case 14:case 19:return t.abrupt("return",t.sent);case 10:case 15:case 20:return t.abrupt("break",21);case 11:if(!i){t.next=15;break}return t.next=14,i({task_id:n,status:0});case 16:if(!i){t.next=20;break}return t.next=19,i({task_id:n});case 21:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),c=o.label,l=o.value,t.next=4,e({title:"批量".concat(c,"告警"),content:"即将批量".concat(c,"告警,是否继续操作?"),column:[{label:"告警名称",prop:"title"},q()],onConfirm:function(){var t=i(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,r(u);case 2:return J.value=!0,t.abrupt("return",!1);case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()});case 4:case"end":return t.stop()}}),t)})));return function(e,r,n,a){return t.apply(this,arguments)}}(),H=(t("a",(function(){try{var t,e,r,n,a,o,i,u="clb";if(I.value)u=["222","223"].includes(null===(i=F.value)||void 0===i||null===(i=i.task_data)||void 0===i?void 0:i.tid)?"master":"clb";return{alarmType:u,lcbType:0,sendTimes:(null===(t=F.value)||void 0===t||null===(t=t.task_data)||void 0===t||null===(t=t.number_rule)||void 0===t?void 0:t.day_num)||3,failTimes:(null===(e=F.value)||void 0===e||null===(e=e.task_data)||void 0===e?void 0:e.err_num)||3,successCode:(null===(r=F.value)||void 0===r||null===(r=r.task_data)||void 0===r?void 0:r.codes)||"200,301,302,403,404",name:I.value?null===(n=F.value)||void 0===n||null===(n=n.task_data)||void 0===n?void 0:n.project:"",type:(null===(a=F.value)||void 0===a?void 0:a.sender)||[],masterType:(null===(o=F.value)||void 0===o||null===(o=o.task_data)||void 0===o?void 0:o.tid)||"222"}}catch(c){return{}}})),function(){var t=i(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,u({icon:"warning-filled",title:"删除告警任务",content:"删除后将不再告警此条任务,是否继续?"});case 3:return t.next=5,c({loading:"正在删除告警任务,请稍候...",request:s({task_id:e.id}),message:!0,success:function(){J.value=!0}});case 5:t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e){return t.apply(this,arguments)}}()),Y=function(){var t=i(a().mark((function t(r){var n,o,i,u,c;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return F.value=r||{},I.value=!!r,n=l.load("正在加载数据,请稍后..."),t.next=5,f({page:1,page_size:100});case 5:return o=t.sent,i=o.data.data,t.next=9,p({page:1,page_size:100});case 9:u=t.sent,c=u.data.data,n.close(),r||(F.value={clbList:[],tcpList:[]}),F.value.clbList=i.map((function(t){return{label:t.ps,value:t.load_id}})),F.value.tcpList=c.map((function(t){return{label:t.ps,value:t.load_id}})),d({isAsync:!0,title:"".concat(r?"修改":"添加","告警"),area:48,btn:!0,component:function(){return v((function(){return e.import("./index-legacy355.js?v=VERSION_NUMBER")}),void 0,e.meta.url)}});case 16:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),K=function(){var t=i(a().mark((function t(e){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,u({title:"".concat(e.status?"禁用":"启用","【").concat(e.title,"】任务"),content:"您真的要".concat(e.status?"禁用":"启用","【").concat(e.title,"】这个任务吗?")});case 3:return t.next=5,c({loading:"正在修改告警任务状态,请稍候...",request:h({task_id:e.id,status:Number(!e.status)}),message:!0,success:function(){J.value=!0}});case 5:t.next=10;break;case 7:t.prev=7,t.t0=t.catch(0);case 10:case"end":return t.stop()}}),t,null,[[0,7]])})));return function(e){return t.apply(this,arguments)}}(),Q=[{label:"启动",value:"start",event:z},{label:"停止",value:"stop",event:z},{label:"删除",value:"delete",event:z}],U=(t("g",(function(t){var e=t.alarmType,n=t.lcbType,a=t.sendTimes,o=t.failTimes,i=t.successCode,u=t.name,c=t.type,s=t.masterType,l={sender:c,number_rule:{day_num:Number(a),total:2},time_rule:{send_interval:0,time_range:[0,86399]}},f={status:!0,count:0,interval:600};switch(!0){case"clb"===e&&0===n:return{template_id:"220",task_data:JSON.stringify(r(r({},l),{},{task_data:r(r({},f),{},{tid:"220",type:"nodes_nginx_http_load_push",title:"节点管理-负载均衡",project:u,codes:i})}))};case"clb"===e&&1===n:return{template_id:"221",task_data:JSON.stringify(r(r({},l),{},{task_data:r(r({},f),{},{tid:"221",type:"nodes_nginx_tcp_load_push",title:"节点管理-tcp负载均衡",project:u,err_num:o})}))};case"master"===e:return{template_id:s,task_data:JSON.stringify(r(r({},l),{},{task_data:r(r({},f),{},{tid:"mysql"===s?"222":"223",type:"mysql"===s?"nodes_mysql_slave_err_push":"nodes_redis_slave_err_push",title:"mysql"===s?"节点管理-Mysql主从告警":"节点管理-Redis主从告警",project:""})}))};default:return null}})),{class:"node-clb-http module-ui"}),W={class:"flex items-center"},X={class:"flex items-center"},V=j({__name:"index",setup:function(t){var e,u=C().nodeAlarmRefresh,c=y(),s=c.mainHeight,l=c.push,f=c.getSenderAlarmListInfo,p=[{content:"添加告警",dropdownClass:"bg-white",splitButton:!0,active:!0,event:function(){return Y()}}],d=w(Q),v=new Map([["wx_account","微信公众号"],["feishu","飞书"],["mail","邮箱"],["sms","短信通知"],["dingding","钉钉"],["weixin","企业微信"],["webhook","自定义消息通道"]]),h=!0,_=m({request:(e=i(a().mark((function t(e){var n,o,i;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!h){t.next=4;break}return t.next=3,f();case 3:h=!1;case 4:return t.next=6,g({keyword:e.search,template_ids:'["220", "221", "222", "223"]'});case 6:return o=t.sent,i=o.data,t.abrupt("return",{data:null===(n=i.data)||void 0===n?void 0:n.map((function(t){var e=t.sender;return r(r({},t),{},{alarmAccounts:e.map((function(t){var e=l.value.config.find((function(e){return e.id===t}));return e?"sms"===e.sender_type?{id:t,type:e.sender_type,title:"短信"}:{id:t,type:e.sender_type,title:v.get(e.sender_type)||"",account:e.data.title}:null}))})})),total:0,other:{}});case 9:case"end":return t.stop()}}),t)}))),function(t){return e.apply(this,arguments)}),columns:[R({type:"page",key:"id"}),{label:"名称",prop:"title"},B({minWidth:100,event:K,data:["停用","正常"]}),{label:"告警方式",width:260,render:function(t){var e=(t.alarmAccounts||[]).filter((function(t){return null!==t})),r=e.map((function(t){return"sms"===(null==t?void 0:t.type)?"短信通知":"".concat((null==t?void 0:t.account)||"","(").concat((null==t?void 0:t.title)||"",")")})).join(","),n=e.map((function(t){return"sms"===(null==t?void 0:t.type)?"短信通知":"".concat(null==t?void 0:t.account,"(").concat(t.title,")")})).join(",");return O(L,{content:r,placement:"top","open-delay":500},{default:function(){return[O("span",null,[n])]}})}},{label:"告警条件",prop:"view_msg",render:function(t){return O("span",{innerHTML:t.view_msg},null)}},G([{onClick:Y,title:"修改"},{onClick:H,title:"删除"}])],extension:[d,b(u)]}),x=_.BtTable,k=(_.BtRefresh,_.BtSearch),j=_.BtColumn,q=_.BtBatch;_.BtErrorMask,_.refresh;return function(t,e){var r=o,a=n;return E(),S("div",U,[O(a,null,{"header-left":P((function(){return[T("div",W,[O(r,{options:p})])]})),"header-right":P((function(){return[T("div",X,[O(N(k),{class:A(["mr-[10px]","!w-[210px]"]),placeholder:"请输入节点地址或备注"}),O(N(j))])]})),content:P((function(){return[O(N(x),{"min-height":N(s)},null,8,["min-height"])]})),"footer-left":P((function(){return[O(N(q))]})),"footer-right":P((function(){return e[0]||(e[0]=[])})),_:1})])}}}),Z=Object.freeze(Object.defineProperty({__proto__:null,default:V},Symbol.toStringTag,{value:"Module"}));t("i",Z)}}}))}();
Save File
Cancel