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