← Back
Editing: index-legacy28.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 n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),n.push.apply(n,r)}return n}function n(t){for(var n=1;n<arguments.length;n++){var o=null!=arguments[n]?arguments[n]:{};n%2?e(Object(o),!0).forEach(function(e){r(t,e,o[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))})}return t}function r(e,n,r){return(n=function(e){var n=function(e,n){if("object"!=t(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var o=r.call(e,n||"default");if("object"!=t(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===n?String:Number)(e)}(e,"string");return"symbol"==t(n)?n:n+""}(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function o(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var t,e,n="function"==typeof Symbol?Symbol:{},r=n.iterator||"@@iterator",u=n.toStringTag||"@@toStringTag";function i(n,r,o,u){var i=r&&r.prototype instanceof l?r:l,s=Object.create(i.prototype);return a(s,"_invoke",function(n,r,o){var a,u,i,l=0,s=o||[],f=!1,m={p:0,n:0,v:t,a:p,f:p.bind(t,4),d:function(e,n){return a=e,u=0,i=t,m.n=n,c}};function p(n,r){for(u=n,i=r,e=0;!f&&l&&!o&&e<s.length;e++){var o,a=s[e],p=m.p,v=a[2];n>3?(o=v===r)&&(i=a[(u=a[4])?5:(u=3,3)],a[4]=a[5]=t):a[0]<=p&&((o=n<2&&p<a[1])?(u=0,m.v=r,m.n=a[1]):p<v&&(o=n<3||a[0]>r||r>v)&&(a[4]=n,a[5]=r,m.n=v,u=0))}if(o||n>1)return c;throw f=!0,r}return function(o,s,v){if(l>1)throw TypeError("Generator is already running");for(f&&1===s&&p(s,v),u=s,i=v;(e=u<2?t:i)||!f;){a||(u?u<3?(u>1&&(m.n=-1),p(u,i)):m.n=i:m.v=i);try{if(l=2,a){if(u||(o="next"),e=a[o]){if(!(e=e.call(a,i)))throw TypeError("iterator result is not an object");if(!e.done)return e;i=e.value,u<2&&(u=0)}else 1===u&&(e=a.return)&&e.call(a),u<2&&(i=TypeError("The iterator does not provide a '"+o+"' method"),u=1);a=t}else if((e=(f=m.n<0)?i:n.call(r,m))!==c)break}catch(e){a=t,u=1,i=e}finally{l=1}}return{value:e,done:f}}}(n,o,u),!0),s}var c={};function l(){}function s(){}function f(){}e=Object.getPrototypeOf;var m=[][r]?e(e([][r]())):(a(e={},r,function(){return this}),e),p=f.prototype=l.prototype=Object.create(m);function v(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,a(t,u,"GeneratorFunction")),t.prototype=Object.create(p),t}return s.prototype=f,a(p,"constructor",f),a(f,"constructor",s),s.displayName="GeneratorFunction",a(f,u,"GeneratorFunction"),a(p),a(p,u,"Generator"),a(p,r,function(){return this}),a(p,"toString",function(){return"[object Generator]"}),(o=function(){return{w:i,m:v}})()}function a(t,e,n,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}a=function(t,e,n,r){function u(e,n){a(t,e,function(t){return this._invoke(e,n,t)})}e?o?o(t,e,{value:n,enumerable:!r,configurable:!r,writable:!r}):t[e]=n:(u("next",0),u("throw",1),u("return",2))},a(t,e,n,r)}function u(t,e,n,r,o,a,u){try{var i=t[a](u),c=i.value}catch(t){return void n(t)}i.done?e(c):Promise.resolve(c).then(r,o)}function i(t){return function(){var e=this,n=arguments;return new Promise(function(r,o){var a=t.apply(e,n);function i(t){u(a,r,o,i,c,"next",t)}function c(t){u(a,r,o,i,c,"throw",t)}i(void 0)})}}function c(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return l(t,e);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}System.register(["./index-legacy93.js?v=1765440387","./index-legacy102.js?v=1765440387","./utils-lib-legacy.js?v=1765440387","./index-legacy135.js?v=1765440387","./base-lib-legacy.js?v=1765440387","./useMethods-legacy.js?v=1765440387","./use-socket-request-legacy.js?v=1765440387","./__commonjsHelpers__-legacy.js?v=1765440387","./column-legacy.js?v=1765440387","./index-legacy94.js?v=1765440387"],function(t,e){"use strict";var r,a,u,l,s,f,m,p,v,d,y,b,g,h,_,w,k,j,O,S,x,P,E,T,N,C,D,A,q,M,I,G,L,R,U,J,F,H,B,V,K,Q,W,$,z,X,Y,Z,tt,et,nt,rt,ot;return{setters:[function(t){r=t._},function(t){a=t._},function(t){u=t.ay,l=t.u,s=t.l,f=t.L,m=t.K,p=t.aN,v=t.v,d=t.aO,y=t.M,b=t.o,g=t.aP,h=t.aQ,_=t.aR,w=t.aA,k=t.aS,j=t.aT,O=t.aU,S=t.c,x=t.J,P=t.ak,E=t.k,T=t.a0,N=t.e},function(t){C=t._},function(t){D=t.k,A=t.r,q=t.U,M=t.c,I=t.w,G=t.p,L=t.n,R=t.a5,U=t.G,J=t.q,F=t.v,H=t.e,B=t.A,V=t.y,K=t.x,Q=t.B,W=t.H},function(t){$=t.u,z=t.a,X=t.b,Y=t.e,Z=t.r,tt=t.C,et=t.t,nt=t.o,rt=t.N},function(t){ot=t.u},null,null,null],execute:function(){var at,ut,it=u().refs,ct=it.customLimit,lt=it.cpuAndMemData,st=it.maxCPU,ft=it.maxMem,mt=it.maxGpus,pt=l(),vt=pt.mainHeight,dt=pt.enterpriseRec,yt=D({loading:!1,total:0,p:1,limit:Number(localStorage.getItem("dockercontainerlimit"))||20,usedList:[],search:""}),bt=A([]),gt=q([]),ht=A([]),_t=A("all"),wt=[{label:"启动",value:"start",event:$},{label:"重启",value:"restart",event:$},{label:"停止",value:"stop",event:$},{label:"强制停止",value:"kill",event:$},{label:"暂停",value:"pause",event:$},{label:"恢复",value:"unpause",event:$},{label:"删除",value:"delete",event:$}],kt=[{active:!0,content:"创建容器",event:function(){return z()}},{content:"日志管理",event:function(){return Jt()}},{content:"清理容器",event:function(){return Ht()}}].concat(c(dt.value?[{content:"安全检测",event:(at=i(o().m(function t(){return o().w(function(t){for(;;)switch(t.n){case 0:s({title:"安全检测",area:70,component:function(){return f(function(){return e.import("./index-legacy132.js?v=1765440387")},void 0,e.meta.url)}});case 1:return t.a(2)}},t)})),function(){return at.apply(this,arguments)})}]:[])),jt=function(){ct.value.container=!0,localStorage.setItem("dockercontainerlimit",String(yt.limit)),Ut(!1)},Ot=function(){var t=i(o().m(function t(e,n){return o().w(function(t){for(;;)switch(t.n){case 0:m({loading:"正在设置容器状态,请稍候...",request:h({data:JSON.stringify({id:e.id,status:n})}),message:!0,success:Ut});case 1:return t.a(2)}},t)}));return function(e,n){return t.apply(this,arguments)}}(),St=function(){var t=i(o().m(function t(e){return o().w(function(t){for(;;)switch(t.n){case 0:m({loading:"正在获取容器目录,请稍候...",request:_({data:JSON.stringify({id:e.id})}),success:function(t){w("Path",t.data.path),window.location.href=window.location.origin+"/files"},error:function(t){y.error((null==t?void 0:t.msg)||"获取容器目录失败")}});case 1:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),xt=function(){var t=i(o().m(function t(e){return o().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,b({title:"删除容器【".concat(e.name,"】"),content:"删除容器【".concat(e.name,"】,是否继续操作?")});case 1:m({loading:"正在删除容器,请稍候...",request:k({data:JSON.stringify({id:e.id})}),message:!0,success:Ut}),t.n=3;break;case 2:t.p=2,t.v;case 3:return t.a(2)}},t,null,[[0,2]])}));return function(e){return t.apply(this,arguments)}}(),Pt=function(){var t=i(o().m(function t(e,n){return o().w(function(t){for(;;)switch(t.n){case 0:m({loading:"正在设置容器置顶,请稍候...",request:j({type:"top"==n?"add":"del",container_name:e.name}),message:!0,success:function(){e.is_top="top"==n?1:0,Gt()}});case 1:return t.a(2)}},t)}));return function(e,n){return t.apply(this,arguments)}}(),Et=function(){var t=i(o().m(function t(){var e,n,r;return o().w(function(t){for(;;)switch(t.n){case 0:if(yt.p=1,""!==yt.search){t.n=1;break}return yt.total=bt.value.length,Ut(!1),t.a(2);case 1:e=yt.search.toLowerCase(),n=["name","id","image"],r=bt.value.filter(function(t){return n.some(function(n){var r;return null===(r=t[n])||void 0===r?void 0:r.toLowerCase().includes(e)})}),yt.total=r.length,gt.value=X({limit:yt.limit,list:r,p:yt.p})||[];case 2:return t.a(2)}},t)}));return function(){return t.apply(this,arguments)}}(),Tt=A(Y({reNameEvent:function(t){return Z(t)},realMonitorEvent:function(t){return tt(t)},terminalEvent:et,dirEvent:St,logDataEvent:function(t){return Jt(t)},deleteDataEvent:xt,conDetailEvent:nt,setStatusEvent:Ot,openContainerBackups:function(t){return Ft(t)},openProxyDetails:function(t){return nt(t,"proxy")},changeTaskTopEvent:Pt,moreEvent:function(t,e){switch(t){case"terminal":et(e);break;case"reName":Z(e);break;case"realMonitor":tt(e);break;case"proxyDetails":nt(e,"proxy");break;case"dir":St(e);break;case"log":Jt(e)}},setStatusTitle:(ut=i(o().m(function t(e){var r;return o().w(function(t){for(;;)switch(t.n){case 0:if("all"!==e){t.n=2;break}return _t.value=e,t.n=1,Ut();case 1:return t.a(2,t.v);case 2:gt.value=(null===(r=ht.value[e])||void 0===r?void 0:r.map(function(t){var e=bt.value.find(function(e){return e.id===t.id});return n(n({},t),{},{backup_count:(null==e?void 0:e.backup_count)||0,remark:(null==e?void 0:e.remark)||""})}))||[];case 3:return t.a(2)}},t)})),function(t){return ut.apply(this,arguments)}),statusFilterKey:_t})),Nt=null,Ct=function(){var t;null===(t=Nt)||void 0===t||t.socketDestroy(),Nt=ot("/ws_model")},Dt=function(){var t=i(o().m(function t(e){var n,r;return o().w(function(t){for(;;)switch(t.n){case 0:try{(n=e).data.container_stats_data&&Mt(n.data),n.end&&(null===(r=Nt)||void 0===r||r.socketRequest({params:{model_index:"btdocker",mod_name:"container",def_name:"get_all_stats",ws_callback:"get_all_stats"},onMessage:Dt}))}catch(o){}case 1:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),At=function(){var t=i(o().m(function t(){var e,n;return o().w(function(t){for(;;)switch(t.n){case 0:Ct(),n={model_index:"btdocker",mod_name:"container",def_name:"get_all_stats",ws_callback:"get_all_stats"},null===(e=Nt)||void 0===e||e.socketRequest({params:n,onMessage:Dt});case 1:return t.a(2)}},t)}));return function(){return t.apply(this,arguments)}}(),qt=function(t){return t.id},Mt=function(t){if(t.container_stats_data){var e=t.container_stats_data;gt.value.forEach(function(t){if("running"===t.status){var n=e.find(function(e){return e.id==t.id});n&&(lt.value[t.id]={cpu_usage:n.cpu_usage||0,mem_percent:n.mem_percent||0})}})}},It=function(){var t;null===(t=Nt)||void 0===t||t.socketDestroy(),Nt=null,yt.loading=!1,yt.total=0,yt.p=1,yt.search="",yt.usedList=[],yt.limit=Number(localStorage.getItem("dockercontainerlimit"))||20,bt.value=[],gt.value=[],ht.value=[]},Gt=function(){bt.value=bt.value.sort(function(t,e){return 1==t.is_top&&1!=e.is_top?-1:1!=t.is_top&&1==e.is_top?1:t.created_time>e.created_time?-1:1}),gt.value=X({limit:yt.limit,list:bt.value,p:yt.p})||[]},Lt=function(){setTimeout(function(){vt.value>900?yt.limit=20:yt.limit=10},0)},Rt=!0,Ut=function(){var t=i(o().m(function t(e){return o().w(function(t){for(;;)switch(t.n){case 0:if(!1!==e){t.n=1;break}return gt.value=X(n(n({},yt),{},{list:bt.value}))||[],t.a(2);case 1:return Rt&&(yt.loading=!0),t.n=2,m({request:p(),data:{container_list:Array,grouped_by_status:Object,mem_total:Number,online_cpus:Number,gpu:Number},success:function(t){Rt=!1;var e=t.container_list;t.container_list.forEach(function(t){lt.value[t.id]={cpu_usage:0,mem_percent:0}}),bt.value=e,yt.total=e.length,gt.value=X(n(n({},yt),{},{list:e}))||[],yt.loading=!1,ht.value=t,st.value=t.online_cpus,ft.value=Number(v(Number(t.mem_total),!1,0,"MB")),mt.value=t.gpu||0}});case 2:return t.n=3,m({request:d(),data:Array,success:function(t){bt.value.forEach(function(e,n){var r=t.find(function(t){return t.id===e.id});r&&(e.backup_count=r.backup_count,e.remark=r.remark)}),At()}});case 3:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}(),Jt=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!bt.value.length)return y.error("容器列表为空");s({component:function(){return f(function(){return e.import("./index-legacy133.js?v=1765440387")},void 0,e.meta.url)},title:"容器日志",area:92,compData:{row:t,list:bt.value}})},Ft=function(t){return s({component:function(){return f(function(){return e.import("./index-legacy134.js?v=1765440387")},void 0,e.meta.url)},title:"备份容器 - ["+t.name+"]",area:79,compData:{row:t}})},Ht=function(){var t=i(o().m(function t(){return o().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,b({content:"将删除所有已停止、未使用的容器,是否继续?",title:"清理容器",width:"42rem",type:"check",check:{content:'删除<span class="text-danger">所有</span>容器,包含正在运行的容器',onConfirm:function(){var t=i(o().m(function t(e){return o().w(function(t){for(;;)switch(t.n){case 0:yt.loading=!0,m({request:g({type:e?1:0}),message:!0,success:Ut,error:function(){yt.loading=!1}});case 1:return t.a(2)}},t)}));return function(e){return t.apply(this,arguments)}}()}});case 1:return t.a(2)}},t)}));return function(){return t.apply(this,arguments)}}(),Bt={class:"relative container-table-tab"},Vt={class:"flex items-center"},Kt=M({__name:"index",setup:function(t,e){var n=e.expose,s=u(),f=s.refs,m=f.refreshWs,p=f.isRefreshTableList,v=f.customLimit,d=s.resetRefresh,y=l().mainHeight,b=A(null);return I(function(){return m.value},function(t){t&&(m.value=!1,At())}),I(function(){return p.value},function(t){t&&(d(),Ut())}),G(i(o().m(function t(){return o().w(function(t){for(;;)switch(t.n){case 0:Tt.value=O(JSON.parse(localStorage.getItem("dockerContainerTableColumn")||"[]")||[],Tt.value),Ut(),L(function(){v.value.container||Lt()});case 1:return t.a(2)}},t)}))),n({init:Ut,destroy:It}),R(function(){return It()}),function(t,e){var n=C,o=S,u=x,i=P,l=E,s=T,f=a,m=r,p=U("bt-loading");return J(),F("div",Bt,[H(m,null,{"header-left":B(function(){return[V("div",Vt,[H(n,{options:K(kt)},null,8,["options"]),H(o,{class:"ml-[1.6rem]",onClick:K(rt)},{default:B(function(){return c(e[3]||(e[3]=[Q("需求反馈",-1)]))}),_:1},8,["onClick"]),H(o,{class:"ml-[1.6rem]",href:"https://www.bt.cn/bbs/thread-140412-1-1.html"},{default:B(function(){return c(e[4]||(e[4]=[Q(">>使用帮助",-1)]))}),_:1})])]}),"header-right":B(function(){return[H(u,{class:"!w-[26rem] mr-1rem",modelValue:K(yt).search,"onUpdate:modelValue":e[0]||(e[0]=function(t){return K(yt).search=t}),onSearch:K(Et),placeholder:"请输入容器名、ID、容器镜像"},null,8,["modelValue","onSearch"]),H(i,{name:"dockerContainerTableColumn",column:K(Tt),tableRef:K(b)},null,8,["column","tableRef"])]}),content:B(function(){return[W(H(l,{ref_key:"containerTable",ref:b,key:"containerTable",column:K(Tt),data:K(gt),"row-key":K(qt),description:"容器列表为空","max-height":K(y)-230},null,8,["column","data","row-key","max-height"]),[[p,K(yt).loading],[p,"正在加载容器列表,请稍后...","title"]])]}),"footer-left":B(function(){return[H(s,{"table-ref":K(b),options:K(wt)},null,8,["table-ref","options"])]}),"footer-right":B(function(){return[H(f,{page:K(yt).p,"onUpdate:page":e[1]||(e[1]=function(t){return K(yt).p=t}),row:K(yt).limit,"onUpdate:row":e[2]||(e[2]=function(t){return K(yt).limit=t}),useStorage:!1,total:K(yt).total,onChange:K(jt)},null,8,["page","row","total","onChange"])]}),_:1})])}}});t("default",N(Kt,[["__scopeId","data-v-7a068085"]]))}}})}();
Save File
Cancel