import{c as e,h as a,r as l,o as s,k as r,l as o,e as t,x as u,p as n,N as m,a7 as c,a4 as i}from"./base-lib.js?v=1761009159";import{I as d,b as p,a6 as f,j as b,e as v}from"./utils-lib.js?v=1761009159";import{g,P as _,bk as h}from"./useStore4.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";const k={class:"flex flex-col p-[1.6rem] lib-box"},w=v(e({__name:"push-mirror-dialog",props:{compData:{default:()=>({})}},emits:["close"],setup(e,{expose:v,emit:w}){const y=p(),{refs:{isRefreshTableList:j}}=g(),x=e,V=w,E=a({tag:"",name:"",id:""}),S=l(),q={tag:[{validator:(e,a,l)=>{""===a?l(new Error("请输入版本，如：btphp_1.1")):l()},trigger:["blur"]}],name:[{validator:(e,a,l)=>{""===a?l(new Error("请选择仓库名")):l()},trigger:["blur"]}]},D=l([]);s((async()=>{E.id=x.compData.row.id,d({request:_(),data:Array,success:e=>{var a;if(1===e.length){const a=e[0];"docker.io"==a.url&&"docker官方库"==a.name&&""==a.username&&(y.error("docker官方库不支持推送镜像"),V("close"))}e.forEach((e=>{"docker.io"==e.url&&"docker官方库"==e.name&&""==e.username||D.value.push({value:e.url,label:"".concat(e.name).concat("docker.io"===e.url?"":"(".concat(e.url,")")),url:e.url,name:e.name})})),E.name=null==(a=D.value[0])?void 0:a.value}})}));return v({onConfirm:async()=>{try{await S.value.validate((async e=>{if(e){let e={...E,name:D.value.find((e=>e.url==E.name)).name,url:D.value.find((e=>e.url==E.name)).url};d({request:h({data:JSON.stringify(e)}),message:!0,success:({status:e})=>{e&&(j.value=!0,V("close"))}})}}))}catch(e){console.log(e)}}}),(e,a)=>{const l=f,s=c,d=b,p=i;return r(),o("div",k,[t(p,{ref_key:"cmdFormRef",ref:S,size:"small",model:n(E),rules:q,class:"relative w-full","label-position":"right",onSubmit:a[2]||(a[2]=m((()=>{}),["prevent"]))},{default:u((()=>[t(s,{prop:"name",label:"仓库名"},{default:u((()=>[t(l,{modelValue:n(E).name,"onUpdate:modelValue":a[0]||(a[0]=e=>n(E).name=e),options:n(D),class:"!w-[24rem]"},null,8,["modelValue","options"])])),_:1}),t(s,{prop:"tag",label:"标签"},{default:u((()=>[t(d,{modelValue:n(E).tag,"onUpdate:modelValue":a[1]||(a[1]=e=>n(E).tag=e),class:"w-[24rem]",placeholder:"请输入版本，如：btphp_1.1"},null,8,["modelValue"])])),_:1})])),_:1},8,["model"])])}}}),[["__scopeId","data-v-fe3fccee"]]);export{w as default};
