← Back
Editing: index-legacy351.js
!function(){function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t=function(){return n};var r,n={},o=Object.prototype,i=o.hasOwnProperty,a=Object.defineProperty||function(e,t,r){e[t]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",s=u.toStringTag||"@@toStringTag";function f(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{f({},"")}catch(r){f=function(e,t,r){return e[t]=r}}function d(e,t,r,n){var o=t&&t.prototype instanceof b?t:b,i=Object.create(o.prototype),u=new I(n||[]);return a(i,"_invoke",{value:S(e,r,u)}),i}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}n.wrap=d;var h="suspendedStart",v="suspendedYield",y="executing",g="completed",m={};function b(){}function w(){}function _(){}var x={};f(x,c,(function(){return this}));var j=Object.getPrototypeOf,O=j&&j(j(T([])));O&&O!==o&&i.call(O,c)&&(x=O);var L=_.prototype=b.prototype=Object.create(x);function E(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function P(t,r){function n(o,a,u,c){var l=p(t[o],t,a);if("throw"!==l.type){var s=l.arg,f=s.value;return f&&"object"==e(f)&&i.call(f,"__await")?r.resolve(f.__await).then((function(e){n("next",e,u,c)}),(function(e){n("throw",e,u,c)})):r.resolve(f).then((function(e){s.value=e,u(s)}),(function(e){return n("throw",e,u,c)}))}c(l.arg)}var o;a(this,"_invoke",{value:function(e,t){function i(){return new r((function(r,o){n(e,t,r,o)}))}return o=o?o.then(i,i):i()}})}function S(e,t,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===g){if("throw"===i)throw a;return{value:r,done:!0}}for(n.method=i,n.arg=a;;){var u=n.delegate;if(u){var c=k(u,n);if(c){if(c===m)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=p(e,t,n);if("normal"===l.type){if(o=n.done?g:v,l.arg===m)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=g,n.method="throw",n.arg=l.arg)}}}function k(e,t){var n=t.method,o=e.iterator[n];if(o===r)return t.delegate=null,"throw"===n&&e.iterator.return&&(t.method="return",t.arg=r,k(e,t),"throw"===t.method)||"return"!==n&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=p(o,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,m;var a=i.arg;return a?a.done?(t[e.resultName]=a.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=r),t.delegate=null,m):a:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function G(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function T(t){if(t||""===t){var n=t[c];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,a=function e(){for(;++o<t.length;)if(i.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=r,e.done=!0,e};return a.next=a}}throw new TypeError(e(t)+" is not iterable")}return w.prototype=_,a(L,"constructor",{value:_,configurable:!0}),a(_,"constructor",{value:w,configurable:!0}),w.displayName=f(_,s,"GeneratorFunction"),n.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===w||"GeneratorFunction"===(t.displayName||t.name))},n.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,_):(e.__proto__=_,f(e,s,"GeneratorFunction")),e.prototype=Object.create(L),e},n.awrap=function(e){return{__await:e}},E(P.prototype),f(P.prototype,l,(function(){return this})),n.AsyncIterator=P,n.async=function(e,t,r,o,i){void 0===i&&(i=Promise);var a=new P(d(e,t,r,o),i);return n.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},E(L),f(L,s,"Generator"),f(L,c,(function(){return this})),f(L,"toString",(function(){return"[object Generator]"})),n.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},n.values=T,I.prototype={constructor:I,reset:function(e){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),!e)for(var t in this)"t"===t.charAt(0)&&i.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=r)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,o){return u.type="throw",u.arg=e,t.next=n,o&&(t.method="next",t.arg=r),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],u=a.completion;if("root"===a.tryLoc)return n("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 n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){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"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),G(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;G(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:T(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=r),m}},n}function r(e,t,r,n,o,i,a){try{var u=e[i](a),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function n(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?n(Object(r),!0).forEach((function(t){i(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):n(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function i(t,r,n){return(r=function(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var o=n.call(t,r||"default");if("object"!=e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===r?String:Number)(t)}(t,"string");return"symbol"==e(r)?r:r+""}(r))in t?Object.defineProperty(t,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[r]=n,t}System.register(["./base-lib-legacy.js?v=VERSION_NUMBER","./utils-lib-legacy.js?v=VERSION_NUMBER","./index-legacy63.js?v=VERSION_NUMBER","./form-item-legacy.js?v=VERSION_NUMBER","./useController-legacy10.js?v=VERSION_NUMBER","./__commonjsHelpers__-legacy.js?v=VERSION_NUMBER","./index-legacy103.js?v=VERSION_NUMBER","./column-legacy.js?v=VERSION_NUMBER","./index-legacy104.js?v=VERSION_NUMBER","./useController-legacy6.js?v=VERSION_NUMBER","./site-legacy.js?v=VERSION_NUMBER","./validator-legacy.js?v=VERSION_NUMBER","./useStore-legacy4.js?v=VERSION_NUMBER"],(function(e,n){"use strict";var i,a,u,c,l,s,f,d,p,h,v,y,g,m,b,w,_,x,j,O,L,E,P,S,k,N,G,I,T,q,C;return{setters:[function(e){i=e.c,a=e.r,u=e.g,c=e.H,l=e.G,s=e.e,f=e.B,d=e.ac,p=e.T,h=e.aQ,v=e.aW,y=e.S,g=e.D,m=e.a4,b=e.q,w=e.v,_=e.x,x=e.i},function(e){j=e.G,O=e.a9,L=e.x,E=e.M,P=e.iU,S=e.e},function(e){k=e.u,N=e.o},function(e){G=e.b,I=e.k,T=e.h,q=e.f},function(e){C=e.a},null,null,null,null,null,null,null,null],execute:function(){var n={class:"p-[2rem] master-redis-add-form"};var F=i({__name:"index",setup:function(e,i){var S,F,R=i.expose,D=k(),V=D.redisAvailableNodes,A=D.openNodesLoading,H=a(!1),U=j({data:{slave_node_ids:[]},options:function(e){return u((function(){return[G("主从名称","group_name",{attrs:{placeholder:"请输入主从复制组名称",class:"!w-[46rem]"},rules:[{required:!0,message:"主从名称不能为空",trigger:["blur","change"]}]}),I("主节点选择","master_node_id",V.value.nodes||[],{attrs:{placeholder:"请选择主节点",class:"!w-[46rem]",loading:A.value,onChange:function(t){var r=V.value.nodes.find((function(e){return e.value===t}));e.value.master_ip=r.server_ip,e.value.slave_node_ids=(e.value.slave_node_ids||[]).filter((function(e){return e!==t}))}},rules:[{required:!0,message:"请选择主节点",trigger:["blur","change"]}]}),G("主节点IP","master_ip",{attrs:{placeholder:"请输入主节点IP地址",class:"!w-[46rem]"},rules:[o({required:!0},O())]}),T("可用从节点",(function(){var t,r;return c(s("div",{class:"slave-checkbox-list border w-full rounded p-[12px] max-h-[42rem] overflow-y-auto",style:{minHeight:A.value?"10rem":"auto"}},[!A.value&&!V.value.row.length&&s("div",{class:"text-[12px] text-[#a8abb2] leading-[12px]"},[f("暂无可用Redis从节点,请先在前往 节点管理 - "),s("span",{class:"bt-link",onClick:function(){return location.href="/node/node-mgt"}},[f("添加节点")])]),s(d,{modelValue:e.value.slave_node_ids,"onUpdate:modelValue":function(t){return e.value.slave_node_ids=t}},(r=t=V.value.row.map((function(t){var r=s("span",{class:"text-[12px] flex-1"},[t.server_ip,f(" - "),t.name]);return s("div",{class:"flex justify-between items-center mb-[8px] last:mb-0",key:t.id},[s(p,{value:t.id,class:"mr-[8px]",disabled:t.id===e.value.master_node_id||t.is_in_replication_group},{default:function(){var e;return[t.is_in_replication_group?s(h,{content:"节点已在主从组 - ".concat(null===(e=t.group_info)||void 0===e?void 0:e.group_name),placement:"top"},{default:function(){return r}}):r]}}),s("span",{class:"ml-[12px] text-[12px] px-[8px] py-[2px] leading-[22px] rounded",style:{background:1===C(t.redis_version,"7.0.0")?"#f6ffed":"#fff7e6",color:1===C(t.redis_version,"7.0.0")?"#52c41a":"#fa8c16"}},[f("Redis "),t.redis_version])])})),"function"==typeof r||"[object Object]"===Object.prototype.toString.call(r)&&!x(r)?t:{default:function(){return[t]}}))]),[[l("bt-loading"),A.value]])}),"slave_node_ids",{rules:[{required:!0,trigger:["blur","change"],validator:function(e,t,r){if(!t||0===t.length)return H.value=!1,void r(new Error("请选择主从节点"));var n=V.value.row.filter((function(e){return t.includes(e.id)})).map((function(e){return e.redis_version})),o=n.every((function(e){return e===n[0]}));H.value=!o,r()}}]}),H.value&&T(" ",(function(){return s(v,{"show-icon":!0,title:"警告:检测到版本不一致,建议使用相同版本的Redis节点",effect:"light",closable:!1,type:"warning"},null)})),T("Redis密码",(function(){return s("div",{class:"flex items-center w-full"},[s(y,{modelValue:e.value.redis_password,"onUpdate:modelValue":function(t){return e.value.redis_password=t},placeholder:"请输入Redis密码",class:"!w-[38rem]",type:"password","show-password":!0},null),s(g,{class:"ml-[8px]",type:"default",onClick:function(){return e.value.redis_password=L(16)}},{default:function(){return[f("生成密码")]}})])}),"redis_password",{rules:[{required:!0,message:"Redis密码不能为空",trigger:["blur","change"]}]}),q(" ",[{content:"设置的密码将会覆盖当前redis密码"},{content:"redis密码建议使用包含字母、数字和特殊字符的复杂密码确保安全性"},{content:"如有安全组,请执行以下两步操作"},{content:"在主节点与从节点设置本机IP为白名单,放行6379端口"},{content:"在主节点机器,设置从节点IP为白名单,放行6379端口"}])]}))},submit:(S=t().mark((function e(r,n,i){var a,u,c,l;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=null,e.prev=1,e.next=4,n();case 4:return a=E.load("正在创建主从复制组,请稍候..."),u=o(o({},r.value),{},{slave_node_ids:JSON.stringify(r.value.slave_node_ids)}),e.next=8,P(u);case 8:return(c=e.sent).data.status?(N(c.data.msg.task_id),E.success(c.data.msg.message)):E.error(c.data.msg||"创建主从复制组失败"),e.abrupt("return",c.status);case 13:return e.prev=13,e.t0=e.catch(1),e.abrupt("return",!1);case 16:return e.prev=16,null===(l=a)||void 0===l||l.close(),e.finish(16);case 19:case"end":return e.stop()}}),e,null,[[1,13,16,19]])})),F=function(){var e=this,t=arguments;return new Promise((function(n,o){var i=S.apply(e,t);function a(e){r(i,n,o,a,u,"next",e)}function u(e){r(i,n,o,a,u,"throw",e)}a(void 0)}))},function(e,t,r){return F.apply(this,arguments)})}),B=U.BtForm;U.param;return R({onConfirm:U.submit}),m((function(){V.value={row:[],nodes:[]},A.value=!0})),function(e,t){return b(),w("div",n,[s(_(B))])}}});e("default",S(F,[["__scopeId","data-v-515c307e"]]))}}}))}();
Save File
Cancel