← Back
Editing: index-legacy129.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,a=o.hasOwnProperty,u=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},s=i.iterator||"@@iterator",l=i.asyncIterator||"@@asyncIterator",c=i.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 p(t,e,r,n){var o=e&&e.prototype instanceof _?e:_,a=Object.create(o.prototype),i=new N(n||[]);return u(a,"_invoke",{value:O(t,r,i)}),a}function h(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}n.wrap=p;var d="suspendedStart",m="suspendedYield",y="executing",v="completed",g={};function _(){}function b(){}function w(){}var x={};f(x,s,(function(){return this}));var q=Object.getPrototypeOf,k=q&&q(q(S([])));k&&k!==o&&a.call(k,s)&&(x=k);var j=w.prototype=_.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(o,u,i,s){var l=h(e[o],e,u);if("throw"!==l.type){var c=l.arg,f=c.value;return f&&"object"==t(f)&&a.call(f,"__await")?r.resolve(f.__await).then((function(t){n("next",t,i,s)}),(function(t){n("throw",t,i,s)})):r.resolve(f).then((function(t){c.value=t,i(c)}),(function(t){return n("throw",t,i,s)}))}s(l.arg)}var o;u(this,"_invoke",{value:function(t,e){function a(){return new r((function(r,o){n(t,e,r,o)}))}return o=o?o.then(a,a):a()}})}function O(t,e,n){var o=d;return function(a,u){if(o===y)throw Error("Generator is already running");if(o===v){if("throw"===a)throw u;return{value:r,done:!0}}for(n.method=a,n.arg=u;;){var i=n.delegate;if(i){var s=V(i,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===d)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var l=h(t,e,n);if("normal"===l.type){if(o=n.done?v:m,l.arg===g)continue;return{value:l.arg,done:n.done}}"throw"===l.type&&(o=v,n.method="throw",n.arg=l.arg)}}}function V(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,V(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var a=h(o,t.iterator,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,g;var u=a.arg;return u?u.done?(e[t.resultName]=u.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,g):u:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,g)}function z(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 B(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(z,this),this.reset(!0)}function S(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,u=function t(){for(;++o<e.length;)if(a.call(e,o))return t.value=e[o],t.done=!1,t;return t.value=r,t.done=!0,t};return u.next=u}}throw new TypeError(t(e)+" is not iterable")}return b.prototype=w,u(j,"constructor",{value:w,configurable:!0}),u(w,"constructor",{value:b,configurable:!0}),b.displayName=f(w,c,"GeneratorFunction"),n.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},n.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,f(t,c,"GeneratorFunction")),t.prototype=Object.create(j),t},n.awrap=function(t){return{__await:t}},L(E.prototype),f(E.prototype,l,(function(){return this})),n.AsyncIterator=E,n.async=function(t,e,r,o,a){void 0===a&&(a=Promise);var u=new E(p(t,e,r,o),a);return n.isGeneratorFunction(e)?u:u.next().then((function(t){return t.done?t.value:u.next()}))},L(j),f(j,c,"Generator"),f(j,s,(function(){return this})),f(j,"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=S,N.prototype={constructor:N,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(B),!t)for(var e in this)"t"===e.charAt(0)&&a.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 i.type="throw",i.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var o=this.tryEntries.length-1;o>=0;--o){var u=this.tryEntries[o],i=u.completion;if("root"===u.tryLoc)return n("end");if(u.tryLoc<=this.prev){var s=a.call(u,"catchLoc"),l=a.call(u,"finallyLoc");if(s&&l){if(this.prev<u.catchLoc)return n(u.catchLoc,!0);if(this.prev<u.finallyLoc)return n(u.finallyLoc)}else if(s){if(this.prev<u.catchLoc)return n(u.catchLoc,!0)}else{if(!l)throw Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return n(u.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&&a.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 u=o?o.completion:{};return u.type=t,u.arg=e,o?(this.method="next",this.next=o.finallyLoc,g):this.complete(u)},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),B(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;B(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:S(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),g}},n}function r(t,e,r,n,o,a,u){try{var i=t[a](u),s=i.value}catch(t){return void r(t)}i.done?e(s):Promise.resolve(s).then(n,o)}function n(t){return function(){var e=this,n=arguments;return new Promise((function(o,a){var u=t.apply(e,n);function i(t){r(u,o,a,i,s,"next",t)}function s(t){r(u,o,a,i,s,"throw",t)}i(void 0)}))}}System.register(["./base-lib-legacy.js?v=VERSION_NUMBER","./validator-legacy.js?v=VERSION_NUMBER","./utils-lib-legacy.js?v=VERSION_NUMBER","./database-legacy.js?v=VERSION_NUMBER","./useStore-legacy2.js?v=VERSION_NUMBER","./useMethod-legacy4.js?v=VERSION_NUMBER","./__commonjsHelpers__-legacy.js?v=VERSION_NUMBER","./index-legacy104.js?v=VERSION_NUMBER","./column-legacy.js?v=VERSION_NUMBER"],(function(t,r){"use strict";var o,a,u,i,s,l,c,f,p,h,d,m,y,v,g,_,b,w,x,q,k,j,L,E,O,V,z,B,N,S,M,P;return{setters:[function(t){o=t.c,a=t.r,u=t.ay,i=t.k,s=t.g,l=t.q,c=t.v,f=t.e,p=t.A,h=t.x,d=t._,m=t.B,y=t.z,v=t.y,g=t.J,_=t.C,b=t.M,w=t.H,x=t.I,q=t.a9,k=t.al,j=t.a7},function(t){L=t.aH},function(t){E=t.N,O=t.M,V=t.K,z=t.k},function(t){B=t.addDatabaseQuota,N=t.databaseQuotaCheck,S=t.restoreDataAuth},function(t){M=t.g},function(t){P=t.k},null,null,null],execute:function(){var r={class:"p-[20px]"},T={class:"flex items-center"},C={key:0},G=["disabled"],F={class:"flex items-center"},D={class:"mt-8 leading-10 list-disc"};t("default",o({__name:"index",props:{compData:{default:{}}},setup:function(t,o){var U,A=o.expose,I=t,H=M().refreshTableList,Y=a(),J=a(!1),K=a(),Q=I.compData,R=Q.quota,Z=Q.name,$=R.used,W=R.size,X=R.quota_push,tt=R.quota_storage,et=u("popupClose"),rt=function(t,e,r){""===e&&r(new Error("请输入配置数据"));/^(0|[1-9][0-9]*)$/.test(e)&&0!==e?r():r(new Error("请输入大于等于0的正整数")),r()},nt=i({size:[{required:!0,message:"请输入容量配额",trigger:"blur"},{validator:rt}],"quota_push.size":[{trigger:"blur",validator:rt}],"quota_push.push_count":[{required:!0,message:"请输入容量配额",trigger:"blur"},{validator:rt}]}),ot=i({used:$,size:W,quota_push:X,quota_storage:tt,module:E(X.module)?X.module:null===(U=X.module)||void 0===U?void 0:U.split(",")}),at=s({get:function(){return Object.keys(tt).includes("insert_accept")?tt.insert_accept?"text-[#20a53a]":"text-danger":"text-warning"},set:function(t){return t}}),ut=s({get:function(){return Object.keys(tt).includes("insert_accept")?tt.insert_accept?"正常":"已撤销":"未配置"},set:function(t){return t}}),it=s((function(){return-1===ot.used?"未配置容量大小":function(t){var e,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;if(0===t)return"0 Bytes";var n=r<0?0:r,o=Math.floor(Math.log(t)/Math.log(1024));return parseFloat(null===(e=t/Math.pow(1024,o))||void 0===e?void 0:e.toFixed(n))+" "+["Bytes","KB","MB","GB","TB","PB","EB","ZB","YB"][o]}(ot.used)})),st=function(t){t<1&&(ot.quota_push.status=!1)},lt=function(t){t&&Number(ot.size)<=0&&(O.error("请输入容量配额"),ot.quota_push.status=!1)},ct=function(){var t=n(e().mark((function t(){var r;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:null===(r=K.value)||void 0===r||r.refresh(),O.success("刷新成功");case 2:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),ft=function(){var t=n(e().mark((function t(r){var n,o;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,Y.value.validate();case 2:return o={db_name:Z,quota_push:{module:null===(n=ot.module)||void 0===n?void 0:n.join(","),status:ot.quota_push.status,size:Number(ot.quota_push.size),push_count:Number(ot.quota_push.push_count)||0},quota_storage:{size:Number(ot.size)}},t.next=5,V({loading:"正在提交,请稍后...",request:B(JSON.stringify(o)),message:!0});case 5:H(),r();case 7:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),pt=function(){var t=n(e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return J.value=!0,t.next=3,V({request:N(),message:!0});case 3:return t.next=5,H();case 5:P.value.forEach((function(t){if(t.id===I.compData.id){var e=t.quota.quota_storage,r=Object.keys(e).includes("insert_accept");ut.value=r?e.insert_accept?"正常":"已撤销":"未配置",at.value=r?e.insert_accept?"text-[#20a53a]":"text-danger":"text-warning"}})),J.value=!1,O.success("已提交刷新权限任务,将会在后台计算运行,时间约为1分钟");case 8:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}(),ht=function(){var t=n(e().mark((function t(){return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,V({loading:"正在恢复,请稍后...",request:S({db_name:Z}),message:!0});case 2:et(),H();case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}();return A({onConfirm:ft}),function(t,e){var n=z,o=q,a=k,u=L,i=j;return l(),c("div",r,[f(i,{ref_key:"quotaDBFormRef",ref:Y,model:h(ot),rules:h(nt),class:"px-[2rem] flex justify-center flex-col justify-items-start addfrom"},{default:p((function(){return[f(o,{label:"当前已用容量:",prop:"used"},{default:p((function(){return[f(n,{modelValue:h(it).split(" ")[0],"onUpdate:modelValue":e[0]||(e[0]=function(t){return h(it).split(" ")[0]=t}),class:"mr-4",width:"16rem",readonly:"",textType:h(it).split(" ")[1]},d({_:2},[h(it).split(" ")[1]?{name:"append",fn:p((function(){return[m(y(h(it).split(" ")[1]),1)]})),key:"0"}:void 0]),1032,["modelValue","textType"])]})),_:1}),f(o,{label:"当前容量配额:",prop:"size"},{default:p((function(){return[f(n,{modelValue:h(ot).size,"onUpdate:modelValue":e[1]||(e[1]=function(t){return h(ot).size=t}),class:"mr-4",width:"16rem",type:"number",onChange:st},{append:p((function(){return e[6]||(e[6]=[m(" MB ")])})),_:1},8,["modelValue"])]})),_:1}),f(o,{label:"写入权限状态:"},{default:p((function(){return[v("div",T,[v("span",{class:g(h(at))},y(h(ut)),3),"已撤销"===h(ut)?(l(),c("span",C,[e[7]||(e[7]=m("【")),v("span",{class:"bt-link",onClick:ht},"恢复数据库写入权限"),e[8]||(e[8]=m("】"))])):_("",!0),v("i",{disabled:h(J),class:g("svgtofont-el-".concat(h(J)?"loading":"refresh"," bt-link ml-4px")),onClick:pt},null,10,G)])]})),_:1}),f(o,{label:"设置容量告警:"},{default:p((function(){return[f(a,{modelValue:h(ot).quota_push.status,"onUpdate:modelValue":e[2]||(e[2]=function(t){return h(ot).quota_push.status=t}),onChange:lt},null,8,["modelValue"])]})),_:1}),h(ot).quota_push.status?(l(),b(o,{key:0},{default:p((function(){return[f(o,{label:"触发告警大小:",prop:"quota_push.size"},{default:p((function(){return[f(n,{modelValue:h(ot).quota_push.size,"onUpdate:modelValue":e[3]||(e[3]=function(t){return h(ot).quota_push.size=t}),class:"mr-4",width:"16rem",type:"number",min:1},{append:p((function(){return e[9]||(e[9]=[m(" MB ")])})),_:1},8,["modelValue"])]})),_:1}),f(o,{label:"告警次数:",class:"mt-20px",prop:"quota_push.push_count"},{default:p((function(){return[v("div",F,[e[10]||(e[10]=v("span",{class:"text-[1.2rem] text-[#666666] whitespace-nowrap"},"每日最多触发",-1)),f(n,{modelValue:h(ot).quota_push.push_count,"onUpdate:modelValue":e[4]||(e[4]=function(t){return h(ot).quota_push.push_count=t}),class:"mx-4",width:"10rem",type:"number"},null,8,["modelValue"]),e[11]||(e[11]=v("span",{class:"text-[1.2rem] text-[#666666] whitespace-nowrap"},"次告警",-1))])]})),_:1}),f(o,{label:"告警方式:",class:"mt-20px"},{default:p((function(){return[f(u,{ref_key:"alertItemRef",ref:K,class:"!w-[28rem]",modelValue:h(ot).module,"onUpdate:modelValue":e[5]||(e[5]=function(t){return h(ot).module=t}),isMult:!0,needAll:!1,name:"channel",limit:["sms"]},null,8,["modelValue"])]})),_:1})]})),_:1})):_("",!0),v("ul",D,[w(v("li",null,[e[12]||(e[12]=m("点击配置后告警状态未更新,尝试点击【")),v("span",{class:"bt-link",onClick:ct},"手动刷新"),e[13]||(e[13]=m("】"))],512),[[x,h(ot).quota_push.status]]),e[14]||(e[14]=v("li",null,"温馨提示:此功能为企业版专享功能",-1)),e[15]||(e[15]=v("li",{class:"text-danger"},"到达限额容量后仅撤销当前数据库用户插入权限",-1)),e[16]||(e[16]=v("li",{class:"text-danger"},"使用面板导入或使用root账号导入,不受配额影响",-1)),e[17]||(e[17]=v("li",null,"配额容量:如需取消容量配额,请设为“0”",-1)),e[18]||(e[18]=v("li",null,"此处是直接计算数据文件大小,与实际占用会存在些许误差",-1)),e[19]||(e[19]=v("li",null,"写入权限状态需在后台计算获取,若进入状态不是最新,请重新手动刷新权限",-1))])]})),_:1},8,["model","rules"])])}}}))}}}))}();
Save File
Cancel