← Back
Editing: index-legacy138.js
!function(){function e(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var n,a,o,i,u=[],l=!0,c=!1;try{if(o=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=o.call(r)).done)&&(u.push(n.value),u.length!==t);l=!0);}catch(e){c=!0,a=e}finally{try{if(!l&&null!=r.return&&(i=r.return(),Object(i)!==i))return}finally{if(c)throw a}}return u}}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function t(e){return t="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},t(e)}function r(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 n(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){a(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(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 o(e){return function(e){if(Array.isArray(e))return u(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||i(e)||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 i(e,t){if(e){if("string"==typeof e)return u(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(e,t):void 0}}function u(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function l(){"use strict";/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */l=function(){return r};var e,r={},n=Object.prototype,a=n.hasOwnProperty,o=Object.defineProperty||function(e,t,r){e[t]=r.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.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(e){f=function(e,t,r){return e[t]=r}}function p(e,t,r,n){var a=t&&t.prototype instanceof b?t:b,i=Object.create(a.prototype),u=new I(n||[]);return o(i,"_invoke",{value:P(e,r,u)}),i}function v(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=p;var d="suspendedStart",h="suspendedYield",m="executing",g="completed",y={};function b(){}function x(){}function w(){}var _={};f(_,u,(function(){return this}));var j=Object.getPrototypeOf,k=j&&j(j(z([])));k&&k!==n&&a.call(k,u)&&(_=k);var C=w.prototype=b.prototype=Object.create(_);function L(e){["next","throw","return"].forEach((function(t){f(e,t,(function(e){return this._invoke(t,e)}))}))}function O(e,r){function n(o,i,u,l){var c=v(e[o],e,i);if("throw"!==c.type){var s=c.arg,f=s.value;return f&&"object"==t(f)&&a.call(f,"__await")?r.resolve(f.__await).then((function(e){n("next",e,u,l)}),(function(e){n("throw",e,u,l)})):r.resolve(f).then((function(e){s.value=e,u(s)}),(function(e){return n("throw",e,u,l)}))}l(c.arg)}var i;o(this,"_invoke",{value:function(e,t){function a(){return new r((function(r,a){n(e,t,r,a)}))}return i=i?i.then(a,a):a()}})}function P(t,r,n){var a=d;return function(o,i){if(a===m)throw Error("Generator is already running");if(a===g){if("throw"===o)throw i;return{value:e,done:!0}}for(n.method=o,n.arg=i;;){var u=n.delegate;if(u){var l=S(u,n);if(l){if(l===y)continue;return l}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(a===d)throw a=g,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);a=m;var c=v(t,r,n);if("normal"===c.type){if(a=n.done?g:h,c.arg===y)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(a=g,n.method="throw",n.arg=c.arg)}}}function S(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,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),y;var o=v(a,t.iterator,r.arg);if("throw"===o.type)return r.method="throw",r.arg=o.arg,r.delegate=null,y;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,y):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,y)}function E(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 A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function I(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(E,this),this.reset(!0)}function z(r){if(r||""===r){var n=r[u];if(n)return n.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,i=function t(){for(;++o<r.length;)if(a.call(r,o))return t.value=r[o],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 x.prototype=w,o(C,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:x,configurable:!0}),x.displayName=f(w,s,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===x||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,w):(e.__proto__=w,f(e,s,"GeneratorFunction")),e.prototype=Object.create(C),e},r.awrap=function(e){return{__await:e}},L(O.prototype),f(O.prototype,c,(function(){return this})),r.AsyncIterator=O,r.async=function(e,t,n,a,o){void 0===o&&(o=Promise);var i=new O(p(e,t,n,a),o);return r.isGeneratorFunction(t)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},L(C),f(C,s,"Generator"),f(C,u,(function(){return this})),f(C,"toString",(function(){return"[object Generator]"})),r.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}},r.values=z,I.prototype={constructor:I,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(A),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.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 o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],u=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var l=a.call(i,"catchLoc"),c=a.call(i,"finallyLoc");if(l&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(l){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.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&&a.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 i=o?o.completion:{};return i.type=e,i.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(i)},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),y},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),A(r),y}},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 a=n.arg;A(r)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:z(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),y}},r}function c(e,t,r,n,a,o,i){try{var u=e[o](i),l=u.value}catch(e){return void r(e)}u.done?t(l):Promise.resolve(l).then(n,a)}function s(e){return function(){var t=this,r=arguments;return new Promise((function(n,a){var o=e.apply(t,r);function i(e){c(o,n,a,i,u,"next",e)}function u(e){c(o,n,a,i,u,"throw",e)}i(void 0)}))}}System.register(["./utils-lib-legacy.js?v=VERSION_NUMBER","./base-lib-legacy.js?v=VERSION_NUMBER","./index-legacy25.js?v=VERSION_NUMBER","./form-item-legacy.js?v=VERSION_NUMBER","./files-legacy.js?v=VERSION_NUMBER","./file-icon-legacy.js?v=VERSION_NUMBER","./files-path-legacy.js?v=VERSION_NUMBER","./__commonjsHelpers__-legacy.js?v=VERSION_NUMBER","./useStore-legacy3.js?v=VERSION_NUMBER","./index-legacy101.js?v=VERSION_NUMBER","./useMethods-legacy.js?v=VERSION_NUMBER","./column-legacy.js?v=VERSION_NUMBER","./index-legacy104.js?v=VERSION_NUMBER","./validator-legacy.js?v=VERSION_NUMBER","./vue-virtual-scroller.esm-legacy.js?v=VERSION_NUMBER","./vue-virtual-scroller-legacy.js?v=VERSION_NUMBER","./useController-legacy4.js?v=VERSION_NUMBER","./useController-legacy5.js?v=VERSION_NUMBER","./site-legacy.js?v=VERSION_NUMBER","./useStore-legacy4.js?v=VERSION_NUMBER","./useController-legacy6.js?v=VERSION_NUMBER","./useMethod-legacy5.js?v=VERSION_NUMBER","./index.vue_vue_type_style_index_0_lang-legacy.js?v=VERSION_NUMBER","./add-host.vue_vue_type_script_setup_true_lang-legacy.js?v=VERSION_NUMBER","./useController-legacy2.js?v=VERSION_NUMBER","./index-legacy140.js?v=VERSION_NUMBER","./ace-legacy.js?v=VERSION_NUMBER"],(function(r,a){"use strict";var i,u,c,f,p,v,d,h,m,g,y,b,x,w,_,j,k,C,L,O,P,S,E,A,I,z,F,G,T,D,V,N,U,q,H,R,M,W,$,B,Y,J,K,X,Q,Z,ee,te,re,ne,ae;return{setters:[function(e){i=e.K,u=e.gT,c=e.M,f=e.G,p=e.c,v=e.gU,d=e.p,h=e.gV,m=e.e,g=e.gW,y=e.n,b=e.L,x=e.gX,w=e.g6,_=e.W,j=e.al},function(e){k=e.c,C=e.r,L=e.g,O=e.e,P=e.D,S=e.B,E=e.q,A=e.v,I=e.x,z=e.y,F=e.F,G=e.a_,T=e.z,D=e.p,V=e.A,N=e.C,U=e.G,q=e.H,H=e.M,R=e.J,M=e.P,W=e.T,$=e.au,B=e.aw,Y=e.ba,J=e.aA,K=e.aC,X=e.a4},function(e){Q=e.u,Z=e.r},function(e){ee=e.b,te=e.h,re=e.f},function(e){ne=e.ag},null,function(e){ae=e.F},null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],execute:function(){var oe=Q().isSaveGitConfig,ie=function(){var e=s(l().mark((function e(t){var r,n,a,o,s;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:r=t.value,n=r.git_url,a=r.git_branch,o=r.password,s=r.name,i({request:u({git_url:n,git_branch:a,password:o,name:s}),loading:"正在保存git配置...",message:!0,success:function(e){if(!e.status)return c.error(e.msg||"保存git配置失败");oe.value=!0,c.success("保存git配置成功")}});case 2:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),ue={class:"app-import-git-container"},le=k({__name:"git-import",setup:function(e,t){var r,n=t.expose,a=Q(),u=a.apphubGitConfig,m=a.isSaveGitConfig,g=a.usingHelpLink,y=C(!1),b=f({data:u.value||{},options:function(e){return L((function(){return[ee("Git地址","git_url",{attrs:{class:"!w-[44rem]",placeholder:"请输入Git地址"},rules:[{required:!0,message:"Git地址不能为空"}]}),ee("分支","git_branch",{attrs:{class:"!w-[44rem]",placeholder:"请输入Git分支"},rules:[{required:!0,message:"分支不能为空"}]}),te(" ",(function(){return O("div",null,[O("span",{class:"text-primary cursor-pointer text-[12px] flex items-center",onClick:function(){return y.value=!y.value}},[y.value?"更多设置,点击收起":"更多设置,点击查看",O("i",{class:"ml-2 ".concat(y.value?"svgtofont-el-arrow-up":"svgtofont-el-arrow-down")},null)])])}),"")].concat(o(y.value?[ee("用户名(可选)","name",{attrs:{class:"!w-[44rem]",placeholder:"如果是私有仓库请输入用户名",onInput:function(){_.value.user=e.value.user}}}),ee("访问令牌(可选)","password",{attrs:{class:"!w-[44rem]",placeholder:"如果是私有仓库请输入访问令牌",showPassword:!0,onInput:function(){_.value.password=e.value.password}}})]:[]),[te(" ",(function(){return O("div",null,[O(P,{type:"default",onClick:function(){return ie(_)}},{default:function(){return[S("保存配置")]}})])}),""),re(" ",[{content:O("span",null,[S("使用帮助:如果您在导入应用的过程中遇到问题,请点击 "),O(p,{href:g.value},{default:function(){return["使用教程"]}})])},{content:O("span",{class:"text-red-500"},[S("安全提醒:请甄别导入应用的安全性,否则将存在安全风险!")])}])])}))},submit:(r=s(l().mark((function e(t,r,n){var a,o;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return a=c.load("正在导入应用,请稍后..."),e.prev=1,e.next=4,r();case 4:if(m.value){e.next=8;break}return c.error("导入失败,请先保存git配置"),e.abrupt("return",!1);case 8:return e.next=10,v();case 10:if((o=e.sent).status||"缺少git环境,请先安装git"!=o.msg){e.next=18;break}return null==a||a.close(),e.next=15,d({title:"提示",content:"缺少git环境,是否进行安装?",icon:"warning-filled",confirmText:"安装"});case 15:return e.next=17,i({request:h(),loading:"正在安装环境,请稍后...",message:!0});case 17:return e.abrupt("return",!1);case 18:if(o.status){e.next=21;break}return c.error(o.msg||"导入失败"),e.abrupt("return",!1);case 21:return c.success("导入成功"),Z(!0),e.abrupt("return",o.status);case 28:return e.prev=28,e.t0=e.catch(1),e.abrupt("return",!1);case 32:return e.prev=32,null==a||a.close(),e.finish(32);case 35:case"end":return e.stop()}}),e,null,[[1,28,32,35]])}))),function(e,t,n){return r.apply(this,arguments)})}),x=b.BtForm,w=b.submit,_=b.param;return n({onConfirm:w}),function(e,t){return E(),A("div",ue,[O(I(x))])}}}),ce=m(le,[["__scopeId","data-v-93cfa531"]]),se={class:"app-import-check-list"},fe={class:"max-h-[32rem] overflow-auto pr-2"},pe={class:"flex flex-col justify-center text-[12px] leading-[1.2]"},ve={class:"mb-3 font-bold"},de={class:"mb-2 text-gray-400 break-all leading-[1.5]"},he={class:"text-gray-400"},me=m(k({__name:"app-import-check-list",props:{list:{}},setup:function(e){var t=e,r=L((function(){return t.list.map((function(e){return{appid:e.appid,apptitle:e.apptitle,appdesc:e.appdesc,appversion:e.appversion[0].m_version||""}}))}));return function(e,t){return E(),A("div",se,[t[0]||(t[0]=z("div",{class:"flex items-center mb-2 text-[12px] justify-between"},[z("div",null," 应用列表 ")],-1)),z("div",fe,[(E(!0),A(F,null,G(I(r),(function(e){return E(),A("div",{key:e.appid,class:"flex items-center p-[1rem] mb-4 rounded-xl bg-white border border-gray-200 transition-all w-full hover:border-[#20a53a80]"},[z("div",pe,[z("div",ve,T(e.apptitle),1),z("div",de,T(e.appdesc),1),z("div",he,"版本:"+T(e.appversion),1)])])})),128))])])}}}),[["__scopeId","data-v-3c4ac59d"]]),ge={class:"docker-app-import-files-local-upload"},ye={class:"flex items-center mb-6"},be={key:0},xe=k({__name:"local-upload",setup:function(e,t){var r=t.expose,o=function(){var e=C([]),t=C([]),r=function(){var r=s(l().mark((function r(){var a,o,u;return l().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,ne({path:"/tmp/apphub"});case 2:if(a=r.sent,o=["zip","tar","gz","tar.gz","tgz","rar","7z","bz2","war"],u=(a.data.files||[]).filter((function(e){if(!e.nm)return!1;var t=e.nm.toLowerCase();return o.some((function(e){return t.endsWith("."+e)}))})).map((function(e){return"/tmp/apphub/".concat(e.nm)})),e.value=u,!u.length){r.next=11;break}return r.next=9,i({request:g({sfile:u}),loading:"正在获取应用列表,请稍后...",success:function(e){var r=e.data.data||[],a=[];r.forEach((function(e,t){(Array.isArray(e)?e:[e]).forEach((function(e){a.push(n(n({},e),{},{appdesc:e.parser_from?"从上传文件解析:".concat(e.parser_from):e.appdesc||"",sfile:u[t]}))}))})),t.value=a}});case 9:r.next=12;break;case 11:t.value=[];case 12:case"end":return r.stop()}}),r)})));return function(){return r.apply(this,arguments)}}(),o=function(){var e=s(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,y({title:"上传文件到【/tmp/apphub】",area:72,component:function(){return b((function(){return a.import("./index-legacy115.js?v=VERSION_NUMBER")}),void 0,a.meta.url)},compData:{path:"/tmp/apphub"},onCancel:function(){var e=s(l().mark((function e(){return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r();case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}()});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),u=function(){var r=s(l().mark((function r(){var n;return l().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(t.value.length){r.next=3;break}return c.error("应用列表为空,请上传文件"),r.abrupt("return",!1);case 3:return r.next=5,i({request:x({sfile:e.value}),loading:"正在导入应用,请稍后...",message:!0});case 5:if((n=r.sent).status){r.next=9;break}return c.error((null==n?void 0:n.msg)||"导入失败"),r.abrupt("return",!1);case 9:return Z(!0),r.abrupt("return",!0);case 11:case"end":return r.stop()}}),r)})));return function(){return r.apply(this,arguments)}}();return{fileList:e,appList:t,onConfirm:u,openFilesUpload:o,getApphubFiles:r}}(),u=o.appList,f=o.onConfirm,p=o.openFilesUpload,v=o.getApphubFiles;return D(v),r({onConfirm:f}),function(e,t){var r=P;return E(),A("div",ge,[z("div",ye,[O(r,{type:"primary",onClick:I(p)},{default:V((function(){return t[0]||(t[0]=[S("上传文件")])})),_:1},8,["onClick"]),t[1]||(t[1]=z("span",{class:"flex items-center text-[12px] text-gray-400 ml-4"},[z("i",{class:"svgtofont-el-warning-filled mr-1 mt-[2px]"}),z("span",null,"支持 .zip, .tar.gz,.gz 格式")],-1))]),I(u).length?(E(),A("div",be,[O(me,{list:I(u)},null,8,["list"])])):N("",!0)])}}}),we=m(xe,[["__scopeId","data-v-edf0b218"]]),_e={class:"docker-import-server-upload-container"},je={class:"flex items-center justify-between px-2 w-full"},ke=["onClick"],Ce={key:0,class:"mt-4 mb-4"},Le=k({__name:"server-upload",setup:function(r,a){var u=a.expose,f=function(){var r=C("/tmp/apphub"),a=C([]),u=C([]),f=C(!1),p=C([]),v=C([]),d=function(e){return e&&e.isFile&&/\.(zip|tar|gz|tar\.gz|tgz|rar)$/i.test(e.name)},h=function(){var e=s(l().mark((function e(r){var a,o,i,s,f;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(d(r)){e.next=2;break}return e.abrupt("return");case 2:if(!((a=u.value.findIndex((function(e){return e.fullpath===r.fullpath})))>-1)){e.next=8;break}u.value.splice(a,1),p.value=p.value.filter((function(e){return e.fullpath!==r.fullpath})),e.next=20;break;case 8:return i=c.load("正在解析文件中,请稍后..."),e.next=11,g({sfile:r.fullpath});case 11:if(s=e.sent,(f=Array.isArray(s.data)?s.data:(null===(o=s.data)||void 0===o?void 0:o.data)||[]).length&&"object"===t(f[0])&&null!==f[0]&&("appid"in f[0]||"appname"in f[0])){e.next=17;break}return c.error("解析失败,无法从该压缩包文件中获取应用信息"),i.close(),e.abrupt("return");case 17:i.close(),f.forEach((function(e){var t=e.parser_from||r.fullpath;p.value.push(n(n({},e),{},{fullpath:t,appdesc:"从服务器文件解析:".concat(t)}))})),u.value.push(r);case 20:v.value=p.value.map((function(e){return e.appid}));case 21:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),m=function(t){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=e(t.split(";"),5),o=a[0],i=a[1],u=a[2],l=a[3],c=a[4],s=r?(o.split(".").pop()||"").toLowerCase():"";return{name:o,mtime:i,size:u,perm:l,owner:c,isFile:r,isDir:!r,ext:s,fullpath:n.endsWith("/")?n+o:n+"/"+o}},y=function(){var e=s(l().mark((function e(){var t;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return f.value=!0,e.next=3,w({path:r.value,disk:!1});case 3:(t=e.sent).data.PATH&&r.value!==t.data.PATH&&(r.value=t.data.PATH),a.value=[].concat(o((t.data.DIR||[]).map((function(e){return m(e,!1,r.value)}))),o((t.data.FILES||[]).map((function(e){return m(e,!0,r.value)})))),f.value=!1;case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();D((function(){y()}));var b=function(){var e=s(l().mark((function e(){var t;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(p.value.length){e.next=3;break}return c.error("请选择要导入的文件"),e.abrupt("return",!1);case 3:return e.next=5,i({request:x({sfile:u.value.map((function(e){return e.fullpath}))}),loading:"正在导入应用,请稍后...",message:!0});case 5:if((t=e.sent).status){e.next=9;break}return c.error((null==t?void 0:t.msg)||"导入失败"),e.abrupt("return",!1);case 9:return Z(!0),e.abrupt("return",!0);case 11:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return{currentPath:r,fileList:a,selectedFiles:u,loading:f,parsedAppList:p,selectedApps:v,isSelectable:d,isChecked:function(e){return u.value.some((function(t){return t.fullpath===e.fullpath}))},toggleSelection:h,getIconClass:function(e){return e.isDir?"icon-bg folder-icon":["zip","rar","7z","gz","tar.gz","tgz","war"].includes(e.ext)?"icon-bg compress-icon":"icon-bg file-icon"},removeFile:function(e){u.value=u.value.filter((function(t){return t.fullpath!==e.fullpath})),p.value=p.value.filter((function(t){return t.fullpath!==e.fullpath})),v.value=p.value.map((function(e){return e.appid}))},handlePathChange:function(e){r.value=e,y()},refresh:function(){y()},enterDir:function(e){if(e.isDir){var t=r.value.replace(/\/$/,"");""===t&&(t="/"),r.value="/"===t?"/".concat(e.name):"".concat(t,"/").concat(e.name),y()}},onConfirm:b}}(),p=f.currentPath,v=f.fileList,d=f.selectedFiles,h=f.loading,m=f.parsedAppList,y=f.selectedApps,b=f.isSelectable,_=f.isChecked,j=f.toggleSelection,k=f.getIconClass,L=f.removeFile,P=f.handlePathChange,J=f.refresh,K=f.enterDir;return u({onConfirm:f.onConfirm}),function(e,t){var r=W,n=$,a=B,o=Y,i=U("bt-loading");return E(),A("div",_e,[O(ae,{initialPath:I(p),onPathChange:I(P),onRefresh:I(J),class:"mb-6"},null,8,["initialPath","onPathChange","onRefresh"]),q((E(),H(a,{data:I(v),"row-key":function(e){return e.name},"show-header":!1,height:"300",class:"server-upload-table"},{default:V((function(){return[O(n,null,{default:V((function(e){var t=e.row;return[z("div",je,[z("span",{onClick:function(e){return t.isDir&&I(K)(t)},class:"flex items-center gap-2 cursor-pointer file-row files-list"},[z("i",{class:R(I(k)(t))},null,2),S(" "+T(t.name),1)],8,ke),I(b)(t)?(E(),H(r,{key:0,"model-value":I(_)(t),onChange:function(e){return I(j)(t)}},null,8,["model-value","onChange"])):N("",!0)])]})),_:1})]})),_:1},8,["data","row-key"])),[[i,I(h)]]),I(d).length?(E(),A("div",Ce,[t[1]||(t[1]=z("div",{class:"mb-3"},"已选择的文件:",-1)),(E(!0),A(F,null,G(I(d),(function(e){return E(),H(o,{key:e.name,closable:"",onClose:function(t){return I(L)(e)},class:"mr-2 mb-2"},{default:V((function(){return[S(T(e.name),1)]})),_:2},1032,["onClose"])})),128))])):N("",!0),I(m).length?(E(),H(me,{key:1,list:I(m),modelValue:I(y),"onUpdate:modelValue":t[0]||(t[0]=function(e){return M(y)?y.value=e:null})},null,8,["list","modelValue"])):N("",!0)])}}}),Oe=m(Le,[["__scopeId","data-v-c8c3a72e"]]),Pe={class:"docker-app-import-files-container"},Se=m(k({__name:"index",setup:function(e,t){var r=t.expose,n=Q().usingHelpLink,a=C("upload"),o=C(),i=C(),u=[{content:function(){return O("span",null,[S("使用帮助:如果您在导入应用的过程中遇到问题,请点击 "),O("a",{class:"bt-link text-blue-500",href:n.value,target:"_blank"},[S("使用教程")])])}},{content:function(){return O("span",{class:"text-red-500"},[S("安全提醒:请甄别导入应用的安全性,否则将存在安全风险!")])}}];return r({onConfirm:function(){var e,t,r,n,u,l;return"upload"===a.value?null!==(e=null===(t=o.value)||void 0===t||null===(r=t.onConfirm)||void 0===r?void 0:r.call(t))&&void 0!==e?e:Promise.reject(!1):null!==(n=null===(u=i.value)||void 0===u||null===(l=u.onConfirm)||void 0===l?void 0:l.call(u))&&void 0!==n?n:Promise.reject(!1)}}),function(e,t){var r=J,n=K,l=_;return E(),A("div",Pe,[O(n,{modelValue:I(a),"onUpdate:modelValue":t[0]||(t[0]=function(e){return M(a)?a.value=e:null}),class:"mb-4"},{default:V((function(){return[O(r,{label:"上传文件",name:"upload"},{default:V((function(){return[O(we,{ref_key:"localUploadRef",ref:o},null,512)]})),_:1}),O(r,{lazy:"",label:"服务器目录",name:"server"},{default:V((function(){return[O(Oe,{ref_key:"serverUploadRef",ref:i},null,512)]})),_:1})]})),_:1},8,["modelValue"]),O(l,{options:u,class:"text-[12px] text-gray-500"})])}}}),[["__scopeId","data-v-1ee657da"]]),Ee={class:"p-2rem app-import-container"};r("default",k({__name:"index",setup:function(e,t){var r=t.expose,n=Q(),a=n.activeTabs,o=n.isSaveGitConfig,i=C(),u=C();return r({onConfirm:function(){var e,t,r,n;return"git"===a.value?null===(e=i.value)||void 0===e||null===(t=e.onConfirm)||void 0===t?void 0:t.call(e):"files"===a.value?null===(r=u.value)||void 0===r||null===(n=r.onConfirm)||void 0===n?void 0:n.call(r):void 0}}),X((function(){o.value=!1})),function(e,t){var r=J,n=j;return E(),A("div",Ee,[O(n,{modelValue:I(a),"onUpdate:modelValue":t[0]||(t[0]=function(e){return M(a)?a.value=e:null})},{default:V((function(){return[O(r,{label:"从GIT导入",name:"git"},{default:V((function(){return[O(ce,{ref_key:"gitImportRef",ref:i},null,512)]})),_:1}),O(r,{lazy:"",label:"从文件导入",name:"files"},{default:V((function(){return[O(Se,{ref_key:"filesImportRef",ref:u},null,512)]})),_:1})]})),_:1},8,["modelValue"])])}}}))}}}))}();
Save File
Cancel