import{l as a,t as e,x as t,cj as s,K as l,aM as o,v as r}from"./utils-lib.js?v=20260328163632";import{c7 as i,bp as c,c8 as m}from"./site.js?v=20260328163632";import{g as n,j as p,a as u}from"./index34.js?v=20260328163632";import{t as v}from"./index166.js?v=20260328163632";import{k as d,r as b,c as j,o as y,V as _,W as x,O as k,Y as D,_ as f,a1 as h}from"./base-lib.js?v=20260328163632";import"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./index91.js?v=20260328163632";import"./index92.js?v=20260328163632";import"./useMethod4.js?v=20260328163632";import"./store4.js?v=20260328163632";import"./index85.js?v=20260328163632";const g={class:"p-20px"},w=d({__name:"install-tomcat",props:{compData:{default:void 0}},emits:["close"],setup(d,{expose:w,emit:K}){const T=d,J=K,M=b("global"),W=b([]),q=j((()=>p.value.map((a=>({label:a.title+(a.setup?" [".concat(a.path,"]"):""),value:a.name,disabled:!a.setup}))))),C=[{content:a("【全局安装】所有指定使用该版本的项目将共用Tomcat")},{content:a("【独立安装】可根据项目编排需要为某一个项目独立使用")}],E=b({label:" ",children:[{type:"radio-group",key:"install_type",attrs:{class:"flex gap-20px",options:[{label:a("全局安装"),value:"global"},{label:a("独立安装"),value:"custom"}],"onUpdate:value":a=>{M.value=a}}}]}),I=j((()=>({label:a("Tomcat版本"),ruleKey:"version",rules:[l({message:a("请选择Tomcat版本")})],children:[{type:"select",key:"version",attrs:{class:"!w-300px",placeholder:a("请选择Tomcat版本"),options:W.value,clearable:!0}}]}))),O=b({label:a("名称"),ruleKey:"alias",rules:[{validator:(e,t,s)=>""===t?new Error(a("名称不能为空")):!/[^\x00-\x7F]/.test(t)||new Error(a("名称不能为中文")),trigger:["blur","input"]}],children:[{type:"input",key:"alias",attrs:{class:"!w-300px",placeholder:a("请输入Tomcat名称，不能为中文"),clearable:!0}}]}),A=j((()=>({label:a("端口"),ruleKey:"tomcat_port",rules:[o()],children:[{type:"input",key:"tomcat_port",attrs:{class:"!w-300px",placeholder:a("请输入端口"),clearable:!0}}]}))),F=j((()=>({label:a("JDK版本"),ruleKey:"jdk_version",rules:[l({message:a("请选择JDK版本")})],children:[{type:"select",key:"jdk_version",attrs:{class:"!w-300px",placeholder:a("请选择JDK版本"),options:q.value,consistentMenuWidth:!1,clearable:!0}},{type:"custom",key:"jdk-tips",render:()=>k("div",{class:"bt-link flex items-center ml-10px",onClick:()=>{v.value="jdk",J("close")}},[a("添加JDK")])}]}))),H=b({formAttrs:{labelWidth:"100px"},formItems:[]}),N=j((()=>(H.value.formItems=[...T.compData?[]:[E.value,I.value,..."custom"===M.value?[O.value]:[]],A.value,F.value],H.value))),[R,U,V]=e(N);return y((async()=>{var a;if(T.compData){const{port:a,global:e}=T.compData;Object.assign(U.value,{tomcat_port:a,install_type:e?"global":"custom"})}else U.value.install_type="global";M.value=U.value.install_type,t({request:m(),success:a=>{W.value=a.data.map((a=>({...a,label:a.name,value:a.name})))}}),await n(),T.compData&&(U.value.jdk_version=(null==(a=p.value.find((a=>T.compData.jdk_version===a.version||T.compData.jdk_home.includes(a.name))))?void 0:a.name)||"")})),w({onConfirm:async e=>{try{await V.value.validate();let l={tomcat_port:Number(U.value.tomcat_port),jdk_version:U.value.jdk_version};T.compData?l.tomcat_name=T.compData.name:(l.version=U.value.version,"custom"===M.value&&(l.alias=U.value.alias));return(await t({loading:a("正在{0}Tomcat，请稍后...",[T.compData?a("修改"):a("安装")]),request:T.compData?i(l):c(l),message:!0,success:async t=>{T.compData||s(a("Tomcat安装日志"),{name:"install_tomcat",onRefresh:u}),t.status&&(u(),e())}})).status}catch(l){return!1}}}),(a,e)=>(_(),x("div",g,[k(D(R)),a.compData?h("",!0):(_(),f(D(r),{key:0,options:C}))]))}});export{w as default};
