import{_ as e}from"./index.vue_vue_type_script_setup_true_lang.js?v=1763625242172";import{f as a,h as l}from"./term.js?v=1763625242172";import{dE as r,c as t}from"./page_layout.js?v=1763625242172";import"./public.js?v=1763625242172";import{k as s,P as o,r as p,e as u,w as d,R as n,S as i,V as c,a2 as m,a3 as _,j as y,an as f,X as v}from"./vue.js?v=1763625242172";import{dk as k,au as w,dP as x,df as h,d9 as b,dZ as g,dT as $}from"./naive.js?v=1763625242172";import"./common.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";const T={class:"p-20px"},j={key:1},U=s({__name:"form",props:{data:{}},setup(s,{expose:U}){const P=r(),{t:C}=o(),S=s,{isEdit:q,row:I,tips:R,localhost:D,onRefresh:E}=S.data,H=p(null),V=u({ip:"",port:22,account:"root",type:1,password:"",key:"",keyPassword:"",remark:""});d((()=>V.ip),(e=>{q||(V.remark=e)}));const X={ip:{required:!0,message:C("Security.Conf.Index_28"),trigger:["blur","input"]},port:{required:!0,type:"number",message:C("Security.Conf.Index_28"),trigger:["blur","input"]},account:{required:!0,message:C("Security.Conf.Index_28"),trigger:["blur","input"]},password:{required:!0,message:C("Security.Conf.Index_28"),trigger:["blur","input"]},key:{required:!0,message:C("Security.Conf.Index_28"),trigger:["blur","input"]}};return(async()=>{if(D)return V.ip="127.0.0.1",V.port=22,V.account="root",V.type=1,V.password="",V.key="",V.keyPassword="",void(V.remark="127.0.0.1");if(q&&I){const{message:e}=await l({host:I.host});t(e)&&(V.ip=e.host,V.port=e.port,V.account=e.username,V.type=e.password?1:2,V.password=e.password,V.key=e.pkey,V.keyPassword=e.pkey_passwd,V.remark=e.ps)}})(),U({onConfirm:async({hide:e})=>{var l;await(null==(l=H.value)?void 0:l.validate()),await a({host:V.ip,port:V.port,username:V.account,password:1===V.type?V.password:"",pkey:2===V.type?V.key:"",pkey_passwd:2===V.type?V.keyPassword:"",ps:V.remark}),P.setRefresh(!0),e(),null==E||E()}}),(a,l)=>{const r=k,t=w,s=x,o=h,p=b,u=g,d=$,U=e;return n(),i("div",T,[c(R)?(n(),m(r,{key:0,class:"mb-16px",type:"warning"},{default:_((()=>l[8]||(l[8]=[y(" Unable to authenticate automatically, please fill in the login information of the local server! ")]))),_:1,__:[8]})):f("",!0),v(U,{ref_key:"formRef",ref:H,model:c(V),rules:X},{default:_((()=>[v(p,null,{default:_((()=>[v(s,{label:a.$t("Term.index_8"),path:"ip"},{default:_((()=>[v(t,{class:"w-190px!",value:c(V).ip,"onUpdate:value":l[0]||(l[0]=e=>c(V).ip=e),placeholder:a.$t("Term.index_9")},null,8,["value","placeholder"])])),_:1},8,["label"]),v(s,{path:"port"},{default:_((()=>[v(o,{"show-button":!1,class:"w-80px!",value:c(V).port,"onUpdate:value":l[1]||(l[1]=e=>c(V).port=e),placeholder:a.$t("Docker.Container.create.index_7")},null,8,["value","placeholder"])])),_:1})])),_:1}),v(s,{label:a.$t("Term.index_10"),path:"account"},{default:_((()=>[v(t,{class:"w-280px!",value:c(V).account,"onUpdate:value":l[2]||(l[2]=e=>c(V).account=e),placeholder:a.$t("Term.index_11")},null,8,["value","placeholder"])])),_:1},8,["label"]),v(s,{label:a.$t("Term.index_12")},{default:_((()=>[v(d,{value:c(V).type,"onUpdate:value":l[3]||(l[3]=e=>c(V).type=e)},{default:_((()=>[v(u,{label:a.$t("Database.index_14"),value:1},null,8,["label"]),v(u,{label:a.$t("Term.index_13"),value:2},null,8,["label"])])),_:1},8,["value"])])),_:1},8,["label"]),1===c(V).type?(n(),m(s,{key:0,label:a.$t("Database.index_14"),path:"password"},{default:_((()=>[v(t,{class:"w-280px!",value:c(V).password,"onUpdate:value":l[4]||(l[4]=e=>c(V).password=e),placeholder:a.$t("Term.index_14")},null,8,["value","placeholder"])])),_:1},8,["label"])):(n(),i("div",j,[v(s,{label:a.$t("Term.index_13"),path:"key"},{default:_((()=>[v(t,{class:"w-280px!",type:"textarea",value:c(V).key,"onUpdate:value":l[5]||(l[5]=e=>c(V).key=e),placeholder:a.$t("Term.index_15")},null,8,["value","placeholder"])])),_:1},8,["label"]),v(s,{label:a.$t("Term.index_16")},{default:_((()=>[v(t,{class:"w-280px!",value:c(V).keyPassword,"onUpdate:value":l[6]||(l[6]=e=>c(V).keyPassword=e),placeholder:a.$t("Term.index_17")},null,8,["value","placeholder"])])),_:1},8,["label"])])),v(s,{label:"Remarks"},{default:_((()=>[v(t,{class:"w-280px!",value:c(V).remark,"onUpdate:value":l[7]||(l[7]=e=>c(V).remark=e),placeholder:a.$t("Term.index_18")},null,8,["value","placeholder"])])),_:1})])),_:1},8,["model"])])}}});export{U as default};
