← Back
Editing: index-legacy62.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)}var e=["port","node_site_id","node_site_name"],r=["port"];function n(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(n=0;n<a.length;n++)r=a[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function o(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 a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach((function(e){i(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function i(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 o=n.call(e,r||"default");if("object"!=t(o))return o;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 u(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */u=function(){return r};var e,r={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},c=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function p(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{p({},"")}catch(e){p=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof g?e:g,i=Object.create(o.prototype),u=new D(n||[]);return a(i,"_invoke",{value:E(t,r,u)}),i}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=f;var v="suspendedStart",h="suspendedYield",m="executing",b="completed",y={};function g(){}function _(){}function x(){}var w={};p(w,c,(function(){return this}));var k=Object.getPrototypeOf,C=k&&k(k(B([])));C&&C!==n&&o.call(C,c)&&(w=C);var O=x.prototype=g.prototype=Object.create(w);function j(t){["next","throw","return"].forEach((function(e){p(t,e,(function(t){return this._invoke(e,t)}))}))}function L(e,r){function n(a,i,u,c){var l=d(e[a],e,i);if("throw"!==l.type){var s=l.arg,p=s.value;return p&&"object"==t(p)&&o.call(p,"__await")?r.resolve(p.__await).then((function(t){n("next",t,u,c)}),(function(t){n("throw",t,u,c)})):r.resolve(p).then((function(t){s.value=t,u(s)}),(function(t){return n("throw",t,u,c)}))}c(l.arg)}var i;a(this,"_invoke",{value:function(t,e){function o(){return new r((function(r,o){n(t,e,r,o)}))}return i=i?i.then(o,o):o()}})}function E(t,r,n){var o=v;return function(a,i){if(o===m)throw Error("Generator is already running");if(o===b){if("throw"===a)throw i;return{value:e,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=P(u,n);if(c){if(c===y)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===v)throw o=b,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=m;var l=d(t,r,n);if("normal"===l.type){if(o=n.done?b:h,l.arg===y)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=b,n.method="throw",n.arg=l.arg)}}}function P(t,r){var n=r.method,o=t.iterator[n];if(o===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")),y;var a=d(o,t.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,y;var i=a.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,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}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 S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function D(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function B(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 _.prototype=x,a(O,"constructor",{value:x,configurable:!0}),a(x,"constructor",{value:_,configurable:!0}),_.displayName=p(x,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===_||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,x):(t.__proto__=x,p(t,s,"GeneratorFunction")),t.prototype=Object.create(O),t},r.awrap=function(t){return{__await:t}},j(L.prototype),p(L.prototype,l,(function(){return this})),r.AsyncIterator=L,r.async=function(t,e,n,o,a){void 0===a&&(a=Promise);var i=new L(f(t,e,n,o),a);return r.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},j(O),p(O,s,"Generator"),p(O,c,(function(){return this})),p(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=B,D.prototype={constructor:D,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(S),!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,o){return u.type="throw",u.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}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"),l=o.call(i,"finallyLoc");if(c&&l){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(!l)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,y):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),y},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),S(r),y}},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;S(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:B(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},r}function c(t,e,r,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void r(t)}u.done?e(c):Promise.resolve(c).then(n,o)}function l(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var a=t.apply(e,r);function i(t){c(a,n,o,i,u,"next",t)}function u(t){c(a,n,o,i,u,"throw",t)}i(void 0)}))}}System.register(["./utils-lib-legacy.js?v=VERSION_NUMBER","./useController-legacy10.js?v=VERSION_NUMBER","./index-legacy103.js?v=VERSION_NUMBER","./base-lib-legacy.js?v=VERSION_NUMBER","./column-legacy.js?v=VERSION_NUMBER","./index-legacy145.js?v=VERSION_NUMBER"],(function(t,o){"use strict";var i,c,s,p,f,d,v,h,m,b,y,g,_,x,w,k,C,O,j,L,E,P,T,S,D,B,N,q,R,H,G,F,z,I,A,M,U,V,J,Y,K,Q,W,X,$,Z,tt,et,rt,nt;return{setters:[function(t){i=t.M,c=t.eO,s=t.n,p=t.L,f=t.K,d=t.eP,v=t.aH,h=t.eQ,m=t.p,b=t.eR,y=t.eS,g=t.eT,_=t.u,x=t.aM,w=t.a6,k=t.eU,C=t.aj,O=t.R,j=t.a7,L=t.a8,E=t.eV,P=t.eW,T=t.eX,S=t.al,D=t.e},function(t){B=t.u,N=t.c,q=t.o},function(t){R=t._},function(t){H=t.s,G=t.j,F=t.r,z=t.c,I=t.e,A=t.aw,M=t.au,U=t.B,V=t.ax,J=t.q,Y=t.v,K=t.A,Q=t.y,W=t.x,X=t.J,$=t.bL,Z=t.P},function(t){tt=t.c,et=t.a,rt=t.u},function(t){nt=t._}],execute:function(){var ot=G("CLB-HTTP-STORE",(function(){var t=F(),e=F([]);return{httpRowData:t,isHttpClbEdit:F(!1),addNodeData:e,HttpNodeList:F([]),nodeClbHttpRefresh:F(!1),domainList:F([])}})),at=t("u",(function(){return H(ot())})),it=at(),ut=it.httpRowData,ct=it.isHttpClbEdit,lt=it.addNodeData,st=it.nodeClbHttpRefresh,pt=it.domainList,ft=B().testLinkStatus,dt=function(){var t=l(u().mark((function t(e,r,n,a){var c,f,d,v,h;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c=a.label,f=a.value,d=[],v=[],n.value.forEach((function(t){void 0!==t.hash&&null!==t.hash?v.push(t.hash):void 0!==t.index&&null!==t.index&&d.push(t.index)})),h=function(){var t=l(u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:e=n.value.map((function(t){return t.load_id})),t.t0=f,t.next="delete"===t.t0?4:7;break;case 4:return t.next=6,g({load_ids:JSON.stringify(e)});case 6:return t.abrupt("return",t.sent);case 7:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),t.next=6,s({title:"批量".concat(c,"负载均衡"),area:46,component:function(){return p((function(){return o.import("./index-legacy118.js?v=VERSION_NUMBER")}),void 0,o.meta.url)},compData:{resultTitle:"批量".concat(c,"负载均衡"),resultData:n.value,resultColumn:[{label:"名称",prop:"ps"},tt()],autoTitle:"批量".concat(c,"负载均衡")},showFooter:!0,onConfirm:function(){var t=l(u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i.load("正在删除,请稍候..."),t.prev=1,t.next=4,h();case 4:i.success("删除成功"),st.value=!0,t.next=11;break;case 8:t.prev=8,t.t0=t.catch(1),i.error("删除失败");case 11:return t.prev=11,e.close(),t.finish(11);case 14:case"end":return t.stop()}}),t,null,[[1,8,11,14]])})));return function(){return t.apply(this,arguments)}}()});case 6:case"end":return t.stop()}}),t)})));return function(e,r,n,o){return t.apply(this,arguments)}}(),vt=function(){var t=l(u().mark((function t(e){var r,n;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(ut.value=e,ct.value=!!e,ct.value){t.next=18;break}return r=i.load("正在获取网站列表,请稍后..."),t.prev=4,t.next=7,c();case 7:(n=t.sent).msg&&!1===n.status&&i.error(n.msg),pt.value=n.data.map((function(t){return{label:t.site_name,value:t.site_id}})),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(4);case 15:return t.prev=15,r.close(),t.finish(15);case 18:s({isAsync:!0,title:"".concat(e?"编辑【".concat(e.ps,"】"):"添加HTTP负载均衡"),area:110,btn:"".concat(e?"保存":"确认"),compData:e||{},component:function(){return p((function(){return o.import("./index-legacy342.js?v=VERSION_NUMBER")}),void 0,o.meta.url)}});case 19:case"end":return t.stop()}}),t,null,[[4,12,15,18]])})));return function(e){return t.apply(this,arguments)}}(),ht={load_id:"",name:"",site_name:"",http_alg:"round_robin",ps:"",request:"",error:"",qps:"",upstream_time:"",last_request_time:"",nodes:[]},mt=(t("h",(function(){try{var t,e=ut.value||{};return a(a(a({},ht),e),{},{http_alg:(null==e||null===(t=e.http_config)||void 0===t?void 0:t.http_alg)||"round_robin",nodes:(null==e?void 0:e.nodes)||[]})}catch(r){return a({},ht)}})),t("a",l(u().mark((function t(){var e,r;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,f({loading:"正在获取节点列表,请稍后...",request:d()});case 2:(e=t.sent).msg&&!1===e.status&&i.error(e.msg),r=e.data.data.map((function(t){return{label:t.remarks,value:t.id,server_ip:t.server_ip,version:t.version,useful_version:t.useful_version}})),s({title:"添加节点",area:54,btn:["添加","取消"],compData:{nodes:r},component:function(){return p((function(){return o.import("./index-legacy343.js?v=VERSION_NUMBER")}),void 0,o.meta.url)}});case 6:case"end":return t.stop()}}),t)})))),t("t",function(){var t=l(u().mark((function t(r,o){var c,l,s,p,f,d,m,b,y,g,_,x;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(ft.value=!0,c=r.value,l=c.port,s=c.node_site_id,p=c.node_site_name,f=n(c,e),d=o.some((function(t){return t.label===p})),t.prev=3,m=/^(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)){3}$/,r.value.node_id){t.next=7;break}return t.abrupt("return",i.error("请选择负载均衡节点"));case 7:if(v(p)||m.test(p)){t.next=10;break}return i.error("请输入正确的节点网站格式"),t.abrupt("return");case 10:if(l){t.next=12;break}return t.abrupt("return",i.error("请输入端口"));case 12:return b=a(a({port:Number(l)},d?{node_site_id:s,node_site_name:p}:{node_site_name:p}),f),t.next=15,N({mod_name:"node",sub_mod_name:"load",def_name:"check_http_node",ws_callback:"check_http_node",data:a({},b)},{loading:!1});case 15:t.next=20;break;case 17:t.prev=17,t.t0=t.catch(3);case 20:if(t.prev=20,d){t.next=31;break}if(r.value.node_id){t.next=24;break}return t.abrupt("return",ft.value=!1);case 24:return t.next=26,h({node_id:r.value.node_id});case 26:g=t.sent,_=g.data,x=null===(y=_.data.find((function(t){return t.site_name==p})))||void 0===y?void 0:y.site_id,r.value.node_site_id=x,o.push({label:p,value:x,port:Number(l)});case 31:return ft.value=!1,t.finish(20);case 33:case"end":return t.stop()}}),t,null,[[3,17,20,33]])})));return function(e,r){return t.apply(this,arguments)}}()),function(){var t=l(u().mark((function t(e){return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,m({icon:"warning-filled",title:"删除负载均衡【".concat(e.ps,"】"),content:"即将删除负载均衡,是否继续操作?"});case 2:return t.next=4,f({loading:"正在删除负载均衡,请稍后...",request:b({load_id:e.load_id}),message:!0,success:function(t){st.value=!0}});case 4:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}()),bt=function(t){ut.value=t,s({title:"配置高级设置",area:46,btn:!0,compData:t,component:function(){return p((function(){return o.import("./index-legacy344.js?v=VERSION_NUMBER")}),void 0,o.meta.url)}})},yt=(t("r",(function(t){lt.value.splice(t,1)})),t("H",function(){var t=l(u().mark((function t(e){var r;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,f({request:y(e),message:!0,loading:"正在设置负载均衡,请稍后...",success:function(t){t.msg&&!1===t.status&&(i.error(t.msg)||i.success("设置成功"))}});case 3:return r=t.sent,t.abrupt("return",r.status);case 7:return t.prev=7,t.t0=t.catch(0),t.abrupt("return",!1);case 11:return t.prev=11,st.value=!0,t.finish(11);case 14:case"end":return t.stop()}}),t,null,[[0,7,11,14]])})));return function(e){return t.apply(this,arguments)}}()),t("e",(function(t){for(var e,r=[],n=/http_(\d{3})/g;null!==(e=n.exec(t));)r.push(e[1]);return r})),[{label:"删除",value:"delete",event:dt}]),gt=(t("c",(function(t){return function(e,r){var n=e?t.filter(function(t){return function(e){return 0===e.label.toLowerCase().indexOf(t.toLowerCase())}}(e)):t;r(n)}})),{class:"node-clb-http"}),_t={class:"flex items-center"},xt={class:"flex items-center"},wt=z({__name:"index",setup:function(t){var e,r=_().mainHeight,n=B().nodesStatusList,o=at(),a=(o.httpRowData,o.isHttpClbEdit,o.nodeClbHttpRefresh),c=L(yt),s=x({options:[{type:"button",label:"添加负载均衡",active:!0,onClick:function(){return vt()}}]}).BtOperation,p=w({request:(e=l(u().mark((function t(e){var r,n,o,a,c;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.p,n=e.limit,o=e.search,t.next=3,k({page:r,page_size:n,search:o});case 3:return a=t.sent,(c=a.data).msg&&!1===c.status&&i.error(c.msg),t.abrupt("return",{data:c.data,total:C(c.page),other:{}});case 7:case"end":return t.stop()}}),t)}))),function(t){return e.apply(this,arguments)}),columns:[et({type:"page",key:"load_id"}),{label:"负载均衡名称",prop:"ps"},{label:"网站",prop:"site_name",width:180,isCustom:!0},{label:"节点数量",prop:"nodes",isCustom:!0,render:function(t){return I(V,{trigger:"hover",title:"节点详细信息",placement:"bottom","popper-class":"node-clb-popover",width:"auto","open-delay":100,"close-delay":0},{default:function(){return I(A,{data:t.nodes,style:{width:"auto"},"max-height":"480px"},{default:function(){return[I(M,{prop:"node_remarks",label:"节点",width:"120"},null),I(M,{prop:"node_site_name",label:"节点网站",width:"120"},null),I(M,{prop:"port",label:"端口"},null),I(M,{prop:"path",label:"验证路径"},null),I(M,{prop:"node_status",label:"节点状态"},{default:function(t){var e=t.row,r=n.value.find((function(t){return t.value===e.node_status}));return I("span",null,[(null==r?void 0:r.label)||"/"])}}),I(M,{prop:"weight",label:"权重"},null),I(M,{prop:"max_fail",label:"最大失败次数","min-width":"100"},null),I(M,{prop:"fail_timeout",label:"恢复时间(秒)","min-width":"100"},null),I(M,{prop:"ps",label:"备注"},null)]}})},reference:function(){return I("div",{style:"color: #999;"},[t.nodes.length,I("span",{class:"ml-4px size-12px bt-ico-ask"},[U("!")])])}})}},{label:"请求数",prop:"requests",isCustom:!0},{label:"错误数",prop:"errors",isCustom:!0},{label:"并发数",prop:"qps",isCustom:!0},{label:"回源耗时(秒)",prop:"max_upstream_time",isCustom:!0,render:function(t){return I("div",null,[t.max_upstream_time])}},{label:"上次访问",prop:"last_update",isCustom:!0,render:function(t){return I("div",null,[0===t.last_update?"--":O(t.last_update)])}},rt([{onClick:q,title:"日志"},{onClick:vt,title:"编辑"},{onClick:bt,title:"配置"},{onClick:mt,title:"删除"}])],extension:[c,j(a)]}),f=p.BtTable,d=p.BtPage,v=p.BtRefresh,h=p.BtSearch,m=p.BtColumn,b=p.BtBatch;p.BtErrorMask,p.refresh,p.config,p.classList;return function(t,e){var n=R;return J(),Y("div",gt,[I(n,null,{"header-left":K((function(){return[Q("div",_t,[I(W(s))])]})),"header-right":K((function(){return[Q("div",xt,[I(W(h),{class:X(["mr-[10px]","!w-[210px]"]),placeholder:"请输入负载名称"}),I(W(v),{class:"mr-[10px]"}),I(W(m))])]})),content:K((function(){return[I(W(f),{"min-height":W(r)},null,8,["min-height"])]})),"footer-left":K((function(){return[I(W(b))]})),"footer-right":K((function(){return[I(W(d))]})),_:1})])}}}),kt=G("CLB-TCPUDP-STORE",(function(){return{tcpudpRowData:F(),isTcpudpClbEdit:F(!1),addTcpudpNodeData:F([]),nodeClbTcpudpRefresh:F(!1)}})),Ct=t("b",(function(){return H(kt())})),Ot=Ct(),jt=Ot.tcpudpRowData,Lt=Ot.isTcpudpClbEdit,Et=Ot.nodeClbTcpudpRefresh,Pt=B().testLinkStatus,Tt=function(){var t=l(u().mark((function t(e,r,n,a){var c,f,d,v,h;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return c=a.label,f=a.value,d=[],v=[],n.value.forEach((function(t){void 0!==t.hash&&null!==t.hash?v.push(t.hash):void 0!==t.index&&null!==t.index&&d.push(t.index)})),h=function(){var t=l(u().mark((function t(){return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:t.t0=f,t.next="delete"===t.t0?3:6;break;case 3:return t.next=5,P({load_ids:JSON.stringify(n.value.map((function(t){return t.load_id})))});case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),t.next=6,s({title:"批量".concat(c,"负载均衡"),area:46,component:function(){return p((function(){return o.import("./index-legacy118.js?v=VERSION_NUMBER")}),void 0,o.meta.url)},compData:{resultTitle:"批量".concat(c,"负载均衡"),resultData:n.value,resultColumn:[{label:"名称",prop:"ps"},tt()],autoTitle:"批量".concat(c,"负载均衡")},showFooter:!0,onConfirm:function(){var t=l(u().mark((function t(){var e;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=i.load("正在删除,请稍候..."),t.prev=1,t.next=4,h();case 4:i.success("删除成功"),Et.value=!0,t.next=11;break;case 8:t.prev=8,t.t0=t.catch(1),i.error("删除失败");case 11:return t.prev=11,e.close(),t.finish(11);case 14:case"end":return t.stop()}}),t,null,[[1,8,11,14]])})));return function(){return t.apply(this,arguments)}}()});case 6:case"end":return t.stop()}}),t)})));return function(e,r,n,o){return t.apply(this,arguments)}}(),St=function(t){jt.value=t,Lt.value=!!t,s({isAsync:!0,title:"".concat(t?"编辑【".concat(t.ps,"】"):"添加TCP/UDP负载均衡"),area:74,btn:"".concat(t?"保存":"确认"),compData:t||{},component:function(){return p((function(){return o.import("./index-legacy345.js?v=VERSION_NUMBER")}),void 0,o.meta.url)}})},Dt=(t("d",(function(){try{var t,e,r,n,o,a,i,u,c;return{load_id:(null===(t=jt.value)||void 0===t?void 0:t.load_id)||0,name:(null===(e=jt.value)||void 0===e?void 0:e.name)||"",type:(null===(r=jt.value)||void 0===r||null===(r=r.tcp_config)||void 0===r?void 0:r.type)||"tcp",host:(null===(n=jt.value)||void 0===n||null===(n=n.tcp_config)||void 0===n?void 0:n.host)||"127.0.0.1",port:(null===(o=jt.value)||void 0===o||null===(o=o.tcp_config)||void 0===o?void 0:o.port)||null,proxy_timeout:(null===(a=jt.value)||void 0===a||null===(a=a.tcp_config)||void 0===a?void 0:a.proxy_timeout)||8,proxy_connect_timeout:(null===(i=jt.value)||void 0===i||null===(i=i.tcp_config)||void 0===i?void 0:i.proxy_connect_timeout)||86400,ps:(null===(u=jt.value)||void 0===u?void 0:u.ps)||"",nodes:(null===(c=jt.value)||void 0===c?void 0:c.nodes)||[]}}catch(l){return{}}})),t("f",l(u().mark((function t(){var e,r;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,f({loading:"正在获取节点列表,请稍后...",request:d()});case 2:(e=t.sent).msg&&!1===e.status&&i.error(e.msg),r=e.data.data.map((function(t){return{label:t.remarks,value:t.id,server_ip:t.server_ip,version:t.version,useful_version:t.useful_version}})),s({title:"添加节点",area:56,btn:!0,compData:{nodes:r},component:function(){return p((function(){return o.import("./index-legacy346.js?v=VERSION_NUMBER")}),void 0,o.meta.url)}});case 6:case"end":return t.stop()}}),t)})))),t("g",function(){var t=l(u().mark((function t(e){var o,c,l;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,Pt.value=!0,o=e.port,""!=(c=n(e,r)).node_id){t.next=6;break}return i.error("请选择负载均衡节点"),t.abrupt("return",!1);case 6:return l=a({type:"tcp",port:Number(o)},c),t.next=9,N({mod_name:"node",sub_mod_name:"load",def_name:"check_tcp_node",ws_callback:"check_tcp_node",data:a({},l)},{loading:!1});case 9:t.next=14;break;case 11:t.prev=11,t.t0=t.catch(0);case 14:return t.prev=14,Pt.value=!1,t.finish(14);case 17:case"end":return t.stop()}}),t,null,[[0,11,14,17]])})));return function(e){return t.apply(this,arguments)}}()),function(){var t=l(u().mark((function t(e){return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,m({icon:"warning-filled",title:"删除负载均衡【".concat(e.ps,"】"),content:"即将删除负载均衡,是否继续操作?"});case 3:return t.next=5,f({loading:"正在删除负载均衡,请稍后...",request:E({load_id:e.load_id}),message:!0,success:function(t){Et.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)}}()),Bt=[{label:"删除",value:"delete",event:Tt}],Nt={class:"node-clb-tcpudp"},qt={class:"flex items-center"},Rt={class:"flex items-center"},Ht=z({__name:"index",setup:function(t){var e,r=_().mainHeight,n=Ct().nodeClbTcpudpRefresh,o=[{content:"添加负载均衡",dropdownClass:"bg-white",splitButton:!0,active:!0,event:function(){return St()}}],a=L(Bt),c=w({request:(e=l(u().mark((function t(e){var r,n,o,a,c;return u().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=e.p,n=e.limit,o=e.search,t.next=3,T({page:r,page_size:n,search:o});case 3:return a=t.sent,(c=a.data).msg&&!1===c.status&&i.error(c.msg),t.abrupt("return",{data:c.data,total:C(c.page),other:{}});case 7:case"end":return t.stop()}}),t)}))),function(t){return e.apply(this,arguments)}),columns:[et({type:"page",key:"load_id"}),{label:"负载均衡名称",prop:"ps"},{label:"监听地址",prop:"host",isCustom:!0,render:function(t){return I("span",null,[t.tcp_config.host,U(":"),t.tcp_config.port])}},{label:"节点数量",prop:"nodes",isCustom:!0,render:function(t){return I(V,{trigger:"hover",title:"节点详细信息",placement:"bottom","popper-class":"node-clb-popover",width:"auto","open-delay":100,"close-delay":0},{default:function(){return I(A,{data:null==t?void 0:t.nodes,"max-height":"480px"},{default:function(){return[I(M,{prop:"host",label:"节点IP",width:"110"},null),I(M,{prop:"requests",label:"请求数"},null),I(M,{prop:"errors",label:"错误数"},null),I(M,{prop:"qps",label:"并发数"},null),I(M,{prop:"max_upstream_time",label:"回源耗时(秒)",width:"120"},null),I(M,{prop:"ps",label:"备注",width:"120"},null),I(M,{prop:"last_update",label:"上次访问",width:"150"},{default:function(){var e;return[0===(null==t||null===(e=t.nodes)||void 0===e?void 0:e.last_update)?"--":O(null==t?void 0:t.nodes.last_update)]}})]}})},reference:function(){return I("div",{style:"color: #999;"},[t.nodes.length,I("span",{class:"ml-4px size-12px bt-ico-ask"},[U("!")])])}})}},{label:"请求数",prop:"requests",isCustom:!0},{label:"错误数",prop:"errors",isCustom:!0},{label:"并发数",prop:"qps",isCustom:!0},{label:"回源耗时(秒)",prop:"max_upstream_time",isCustom:!0,render:function(t){return I("span",null,[t.max_upstream_time])}},{label:"上次访问",prop:"last_update",isCustom:!0,render:function(t){return I("div",null,[0===t.last_update?"--":O(t.last_update)])}},rt([{onClick:q,title:"日志"},{onClick:St,title:"编辑"},{onClick:Dt,title:"删除"}])],extension:[a,j(n)]}),s=c.BtTable,p=c.BtPage,f=c.BtRefresh,d=c.BtColumn,v=c.BtBatch,h=c.BtSearch;c.BtErrorMask,c.classList,c.config;return function(t,e){var n=nt,a=R;return J(),Y("div",Nt,[I(a,null,{"header-left":K((function(){return[Q("div",qt,[I(n,{options:o})])]})),"header-right":K((function(){return[Q("div",Rt,[I(W(h),{class:X(["mr-[10px]","!w-[210px]"]),placeholder:"请输入负载名称"}),I(W(f),{class:"mr-[10px]"}),I(W(d))])]})),content:K((function(){return[I(W(s),{"min-height":W(r)},null,8,["min-height"])]})),"footer-left":K((function(){return[I(W(v))]})),"footer-right":K((function(){return[I(W(p))]})),_:1})])}}}),Gt={class:"node-clb module-ui"},Ft=D(z({__name:"index",setup:function(t){var e=B().activeTabs,r=F([{label:"HTTP",name:"http",render:function(){return I(wt,null,null)}},{label:"TCP/UDP",name:"tcpudp",lazy:!0,render:function(){return I(Ht,null,null)}}]);return $((function(){})),function(t,n){var o=S;return J(),Y("div",Gt,[I(o,{type:"card",modelValue:W(e),"onUpdate:modelValue":n[0]||(n[0]=function(t){return Z(e)?e.value=t:null}),options:W(r)},null,8,["modelValue","options"])])}}}),[["__scopeId","data-v-27315d6c"]]),zt=Object.freeze(Object.defineProperty({__proto__:null,default:Ft},Symbol.toStringTag,{value:"Module"}));t("i",zt)}}}))}();
Save File
Cancel