← Back
Editing: index71.js
import{l as e,L as t,ai as a,K as s,b as n,u as o,aM as l,a6 as i,p as r,v as c,a8 as u}from"./utils-lib.js?v=1765440387";import{_ as m}from"./index93.js?v=1765440387";import{c as p,s as d,e as _,B as v,w as f,p as b,n as y,q as g,M as j,A as h,x,y as C}from"./base-lib.js?v=1765440387";import{c as k,a as O,d as w,g as S,u as B}from"./column.js?v=1765440387";import{b as L,g as T,d as E,f as I,h as P,s as R,i as D,k as M,u as A,a as J,j as N}from"./useController6.js?v=1765440387";import{u as U,S as V}from"./useStore3.js?v=1765440387";import{u as q}from"./index131.js?v=1765440387";import{i as G,o as K,h as F}from"./validator.js?v=1765440387";import"./index.vue_vue_type_style_index_0_scoped_b3c4124c_lang.js?v=1765440387";import{o as z,n as H,J as Q,K as W}from"./site.js?v=1765440387";const X=n(),{siteInfo:Y,isRefreshList:Z,activeType:$}=U(),{setSiteInfo:ee}=V(),te=()=>{Y.value=null,e({title:"添加Go项目",area:62,component:()=>t(()=>import("./index355.js?v=1765440387"),__vite__mapDeps([]),import.meta.url),showFooter:!0})},ae=(a,s="")=>{ee(a,s),e({title:"Go项目管理["+a.name+"] -- 添加时间["+a.addtime+"]",area:[84,72],component:()=>t(()=>import("./index356.js?v=1765440387"),__vite__mapDeps([]),import.meta.url)})},se=async(e,t,n)=>{let o=Object.assign({},e.value);""!==o.domains?(o.bind_extranet=1,o.domains=a(o.domains)?o.domains.split("\n"):o.domains):(o.bind_extranet=0,delete o.domains);let l=e.value.env;1===n&&(l=(e=>{let t=e.split("\n").filter(e=>""!==e),a=[];return t.forEach(e=>{let t=e.split("=");a.push({k:t[0],v:t[1]})}),a})(l)),o.env_file=2===n?e.value.envPath:"",o.env_list=JSON.stringify(1===n?l:[]),await t();const i={data:JSON.stringify(o)},r=Y.value?z:H,c=await s({request:r(i,"go")});let u=c.data;return X.msg({dangerouslyUseHTMLString:!0,message:u.status?u.data:u.error_msg,type:u.status?"success":"error",duration:u.status?2e3:0,showClose:!u.status,customClass:"!max-w-[66rem]"}),c.status&&(Z.value=!0),c.status},ne=async(e,t,a,s,n,o)=>{const{label:l,value:i}=s,{enable:r,exclude:c}=o,u=new Map([["start","批量启动选中项目后,项目将正常访问"],["stop","批量停用选中的项目后,项目将会停止运行"],["restart","批量重启选中的项目后,项目将会重新启动"],["delete","批量删除选中的项目后,项目将无法恢复"]]);await e({title:"批量".concat(l),content:"".concat(u.get(i),",是否继续操作?"),column:[{label:"项目名称",prop:"name"},k()],onConfirm:async()=>{const e=await(async()=>{const e=new Map([["start",Q],["stop",Q],["restart",Q],["delete",W]]).get(i);switch(i){case"start":case"stop":case"restart":if(e){const t=a.value.map(e=>({project_name:e.name})),s=F(!1,c,r,{params:{site_list:JSON.stringify(t),status:i,project_type:$.value.toUpperCase()}});return await e(s,$.value)}break;case"delete":if(e){const t=F(a.value,c,r,{params:{project_type:$.value.toUpperCase()}});return await e(t)}}})();Z.value=!0,n&&n();let{data:t}=G(e.data);t=t.map(e=>({...e,name:e.name||e.project_name})),K(t,{title:"".concat(l,"网站")})}})},oe=p({__name:"index",setup(e){o();const{getSiteList:a,setSiteInfo:s}=V(),{activeType:n,isRefreshList:p,siteInfo:k}=d(V()),{BtOperation:U}=l({options:[{type:"button",label:"添加项目",active:!0,onClick:te},{type:"button",label:"SDK版本管理",onClick:()=>{M("go")}}]}),G=q({key:"type_id",name:"Go分类",options:()=>[{label:"全部分类",value:"all"}],event:P,ignore:["0"],field:"type_name"}),K=u([{label:"启用项目",value:"start",event:ne},{label:"停用项目",value:"stop",event:ne},{label:"重启项目",value:"restart",event:ne},A(),J({classList:N}),{label:"删除项目",value:"delete",event:ne}]),{BtTable:F,BtPage:z,BtRefresh:H,BtSearch:Q,BtColumn:W,BtBatch:X,BtTableCategory:Y,refresh:Z,config:$}=i({request:e=>{const{type_id:t,...s}=e;return a({data:JSON.stringify({...s,type_id:r(t)||"all"===t?"":t})})},columns:[O({type:"page",key:"id"}),L({onClick:e=>{ae(e)}}),T({onClick:(e,t)=>{if("setting"===t)return void ae(e,"state");const a=e.run?"stop":"start";R(e,"restart"===t?t:a)}}),{label:"PID",isCustom:!1,render:e=>{var t;return r(e.load_info)||0===(null==(t=Object.keys(e.load_info))?void 0:t.length)?"--":Object.entries(e.load_info).map(([e,t])=>"".concat(e)).join(", ")}},{label:"监听端口",isCustom:!1,render:e=>{var t,a;return r(e.listen)||0===(null==(t=e.listen)?void 0:t.length)?"--":(null==(a=e.listen)?void 0:a.join(","))||"--"}},{label:"CPU",isCustom:!1,render:e=>{var t;return r(e.load_info)||0===(null==(t=Object.keys(e.load_info))?void 0:t.length)?"--":Object.entries(e.load_info).map(([e,t])=>"".concat(t.cpu_percent.toFixed(2),"%")).join(", ")}},{label:"内存",isCustom:!1,render:e=>{var t;return r(e.load_info)||0===(null==(t=Object.keys(e.load_info))?void 0:t.length)?"--":Object.entries(e.load_info).map(([e,t])=>"".concat(c(t.memory_used))).join(", ")}},w(),S({table:"sites",width:200}),E({onClick:e=>{ae(e,"ssl")}}),B([{title:"设置",onClick:e=>{ae(e)}},{title:"删除",onClick:e=>{D(e)}}])],extension:[G,K],empty:()=>_("span",null,[v("您的列表为空,您可以"),_("span",{class:"bt-link",onClick:te},[v("添加一个项目")])])});return f(p,async e=>{var t;if(e){if(await Z(),null==(t=k.value)?void 0:t.name){const e=$.data.find(e=>e.name===k.value.name);e&&s(e)}p.value=!1}}),b(()=>{y(()=>{t(()=>import("./index355.js?v=1765440387"),__vite__mapDeps([]),import.meta.url),t(()=>import("./index356.js?v=1765440387"),__vite__mapDeps([]),import.meta.url)})}),(e,t)=>{const a=m;return g(),j(a,null,{"header-left":h(()=>[_(x(U)),C("div",{class:"flex items-center ml-1rem",onClick:t[0]||(t[0]=(...e)=>x(I)&&x(I)(...e))},[...t[1]||(t[1]=[C("i",{class:"svgtofont-desired text-[1.6rem]"},null,-1),C("span",{class:"bt-link"},"需求反馈",-1)])])]),"header-right":h(()=>[_(x(Y),{class:"!w-[200px] mr-[10px]"}),_(x(Q),{class:"mr-[10px]",placeholder:"请输入项目名称或备注"}),_(x(H),{class:"mr-[10px]"}),_(x(W))]),content:h(()=>[_(x(F))]),"footer-left":h(()=>[_(x(X))]),"footer-right":h(()=>[_(x(z))]),_:1})}}}),le=Object.freeze(Object.defineProperty({__proto__:null,default:oe},Symbol.toStringTag,{value:"Module"}));export{se as a,le as i}; function __vite__mapDeps(indexes) { if (!__vite__mapDeps.viteFileDeps) { __vite__mapDeps.viteFileDeps = [] } return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) }
Save File
Cancel