import{_ as a}from"./index.vue_vue_type_script_setup_true_lang.js?v=1764830988434";import{aL as e,o as s,es as r,m as t}from"./page_layout.js?v=1764830988434";import{_ as l}from"./index.vue_vue_type_script_setup_true_lang2.js?v=1764830988434";import{k as o,P as n,a0 as i,r as d,e as u,c as p,a2 as m,V as _,a3 as c,W as v,S as b,U as f,j as x,a4 as g,N as h}from"./vue.js?v=1764830988434";import"./public.js?v=1764830988434";import{g as w}from"./index132.js?v=1764830988434";import{dR as j,au as D,dV as y}from"./naive.js?v=1764830988434";import"./common.js?v=1764830988434";import"./__commonjsHelpers__.js?v=1764830988434";import"./index96.js?v=1764830988434";import"./index133.js?v=1764830988434";import"./soft.js?v=1764830988434";import"./site.js?v=1764830988434";const $={class:"w-240px"},U={class:"w-240px"},k={class:"w-240px"},q={class:"w-240px"},R={class:"ml-8px"},C=o({__name:"index",setup(o,{expose:C}){const{t:E}=n(),L=e(),{remoteList:V}=i(L),H=d(null),N=u({sid:V.value.length>0?V.value[0].id:null,name:"",db_user:"",password:"",active:!1,ssl:""}),P=p(()=>V.value.map(a=>({label:"".concat(a.ps," (").concat(a.db_host,")"),value:a.id}))),S={name:{required:!0,message:E("Database.form.index_15"),trigger:["blur","change"]},db_user:{required:!0,message:E("Database.form.index_16"),trigger:["blur","change"]},password:{required:!0,message:E("Database.form.index_17"),trigger:["blur","change"]},sid:{trigger:"change",validator:(a,e)=>null!==e||new Error(E("Database.form.index_18"))}},W=a=>{N.db_user=a},z=()=>{w()};return C({onConfirm:async()=>{var a;try{await(null==(a=H.value)?void 0:a.validate());const e=(()=>{const a=h(N),{sid:e}=a;if(null===e)throw t.error(E("Database.form.index_18")),new Error(E("Database.form.index_18"));return{...a,sid:e,ps:a.name}})();await r(L.type,e),L.setRefresh(!0)}catch(e){console.warn(e)}}}),(e,r)=>{const t=D,o=j,n=l,i=y,d=s,u=a;return _(),m(u,{ref_key:"formRef",ref:H,model:f(N),rules:S,class:"p-20px"},{default:c(()=>[v(o,{label:e.$t("Database.index_12"),path:"name"},{default:c(()=>[b("div",$,[v(t,{value:f(N).name,"onUpdate:value":[r[0]||(r[0]=a=>f(N).name=a),W],placeholder:e.$t("Database.form.index_2"),"input-props":{name:"name"}},null,8,["value","placeholder"])])]),_:1},8,["label"]),v(o,{label:e.$t("Database.index_13"),path:"db_user"},{default:c(()=>[b("div",U,[v(t,{value:f(N).db_user,"onUpdate:value":r[1]||(r[1]=a=>f(N).db_user=a),placeholder:"Database user","input-props":{name:"user"}},null,8,["value"])])]),_:1},8,["label"]),v(o,{label:e.$t("Database.index_14"),path:"password"},{default:c(()=>[b("div",k,[v(n,{value:f(N).password,"onUpdate:value":r[2]||(r[2]=a=>f(N).password=a),"input-props":{name:"password"}},null,8,["value"])])]),_:1},8,["label"]),v(o,{label:e.$t("Database.form.index_9"),path:"sid"},{default:c(()=>[b("div",q,[v(i,{value:f(N).sid,"onUpdate:value":r[3]||(r[3]=a=>f(N).sid=a),class:"server-select",options:f(P)},null,8,["value","options"])]),b("div",R,[v(d,{onClick:z},{default:c(()=>[x(g(e.$t("Database.form.index_10")),1)]),_:1})])]),_:1},8,["label"])]),_:1},8,["model"])}}});export{C as default};
