import{c as e,r as a,h as r,o as s,k as l,l as m,e as o,x as t,p as d,q as u,N as p,a7 as n,a4 as i}from"./base-lib.js?v=1761009159";import{I as c,j as g,e as w}from"./utils-lib.js?v=1761009159";import{g as f,bq as b,br as h}from"./useStore4.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const V={class:"flex flex-col p-[1.6rem] lib-box"},_={class:"flex items-center",id:"netInfo"},y=w(e({__name:"add-stash-dialog",props:{compData:{default:()=>({})}},emits:["close"],setup(e,{expose:w,emit:y}){const k=e,v=y,{refs:{isRefreshWarehouseList:D}}=f(),q=a("add"),x=r({registry:"",name:"",username:"",password:"",namespace:"",remark:"",id:""}),j=a(),U={registry:[{required:!0,message:"请输入仓库地址",trigger:["blur"]}],name:[{required:!0,message:"请输入仓库名",trigger:["blur"]}],username:[{required:!0,message:"请输入用户",trigger:["blur"]}],password:[{required:!0,message:"请输入密码",trigger:["blur"]}],namespace:[{required:!0,message:"请输入命名空间",trigger:["blur"]}]};return s((()=>{k.compData.row?(x.registry=k.compData.row.url,x.name=k.compData.row.name,x.username=k.compData.row.username,x.password=k.compData.row.password,x.namespace=k.compData.row.namespace,x.remark=k.compData.row.remark,x.id=k.compData.row.id,q.value="edit"):q.value="add"})),w({onConfirm:async()=>{try{await j.value.validate(),await c({request:"add"==q.value?b({data:JSON.stringify({registry:x.registry,name:x.name,username:x.username,password:x.password,namespace:x.namespace,remark:x.remark})}):h({data:JSON.stringify(x)}),message:!0,success:e=>{e.status&&(D.value=!0,v("close"))}})}catch(e){console.log(e)}}}),(e,a)=>{const r=g,s=n,c=i;return l(),m("div",V,[o(c,{ref_key:"cmdFormRef",ref:j,model:d(x),rules:U,"label-width":"90px",onSubmit:a[6]||(a[6]=p((()=>{}),["prevent"]))},{default:t((()=>[o(s,{prop:"registry",label:"仓库地址"},{default:t((()=>[o(r,{modelValue:d(x).registry,"onUpdate:modelValue":a[0]||(a[0]=e=>d(x).registry=e),width:"35rem",placeholder:"例：ccr.ccs.tencentyun.com"},null,8,["modelValue"])])),_:1}),o(s,{prop:"name",label:"仓库名"},{default:t((()=>[o(r,{modelValue:d(x).name,"onUpdate:modelValue":a[1]||(a[1]=e=>d(x).name=e),width:"35rem",placeholder:"例：testtest"},null,8,["modelValue"])])),_:1}),u("div",_,[o(s,{prop:"username",label:"用户",class:"!mb-0"},{default:t((()=>[o(r,{modelValue:d(x).username,"onUpdate:modelValue":a[2]||(a[2]=e=>d(x).username=e),width:"15rem",placeholder:"请输入仓库用户"},null,8,["modelValue"])])),_:1}),o(s,{prop:"password",label:"密码","label-width":"3.4rem",id:"two"},{default:t((()=>[o(r,{modelValue:d(x).password,"onUpdate:modelValue":a[3]||(a[3]=e=>d(x).password=e),width:"14.8rem",placeholder:"请输入仓库密码"},null,8,["modelValue"])])),_:1})]),o(s,{prop:"namespace",label:"命名空间",class:"mt-[1.5rem]"},{default:t((()=>[o(r,{modelValue:d(x).namespace,"onUpdate:modelValue":a[4]||(a[4]=e=>d(x).namespace=e),width:"35rem",placeholder:"例：testname"},null,8,["modelValue"])])),_:1}),o(s,{prop:"remark",label:"备注"},{default:t((()=>[o(r,{modelValue:d(x).remark,"onUpdate:modelValue":a[5]||(a[5]=e=>d(x).remark=e),width:"35rem",placeholder:"备注"},null,8,["modelValue"])])),_:1})])),_:1},8,["model"])])}}}),[["__scopeId","data-v-f3667780"]]);export{y as default};
