import{a9 as e}from"./wsl.js?v=20260328163632";import{u as a,l,dj as t,t as s,x as r}from"./utils-lib.js?v=20260328163632";import{u as i}from"./index50.js?v=20260328163632";import{g as o}from"./index229.js?v=20260328163632";import{B as d}from"./index158.js?v=20260328163632";import{B as p}from"./index85.js?v=20260328163632";import{k as u,a9 as m,r as n,c,O as f,o as v,V as h,_ as y,Y as _}from"./base-lib.js?v=20260328163632";import"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";import"./index97.js?v=20260328163632";import"./index91.js?v=20260328163632";import"./useMethod9.js?v=20260328163632";import"./ace.js?v=20260328163632";const k=u({__name:"build-image",setup(u,{expose:k}){const{panel:b}=a(),{sitePath:x}=m(b.value),{sid:j}=i(),g=n("path"),w={labelStyle:"min-width: 100px"},V=n({formAttrs:{labelWidth:"auto"},formItems:[]}),I=n({label:l("镜像名称"),attrs:w,ruleKey:"image_name",rules:[{required:!0,message:l("请输入镜像名称"),trigger:["blur","change"]}],children:[{key:"image_name",type:"input",attrs:{class:"!w-[350px]",placeholder:l("请输入镜像名称")}}]}),U=c((()=>({label:"Dockerfile",attrs:w,children:[{key:"type",type:"select",style:"min-width: 110px;",attrs:{class:"!w-[100px]",options:[{label:l("路径"),value:"path"},{label:l("内容"),value:"content"}],onUpdateValue:e=>{g.value=e}}},..."path"===g.value?[{type:"custom",key:"dockerfile_dir",render:()=>f(p,{modelValue:D.value.dockerfile_dir,"onUpdate:modelValue":e=>D.value.dockerfile_dir=e,onIconClick:()=>t({type:"file",path:x.value,callback:e=>D.value.dockerfile_dir=e}),placeholder:l("请输入或选择Dockerfile文件"),width:"200px",icon:"el-folder-opened"},null)}]:[]]}))),q=n({label:" ",attrs:w,children:[{type:"custom",key:"dockerfile_body",render:()=>f(d,{class:"!w-350px !h-[300px]",modelValue:D.value.dockerfile_body,"onUpdate:modelValue":e=>D.value.dockerfile_body=e},null)}]}),B=c((()=>(V.value.formItems=[I.value,U.value,..."path"===g.value?[]:[q.value]],V.value))),[C,D,A]=s(B);return v((()=>{D.value.type="path"})),k({onConfirm:async()=>{var a;try{await(null==(a=A.value)?void 0:a.validate());const{dockerfile_body:t,dockerfile_dir:s,type:i,image_name:d}=D.value;return(await r({loading:l("正在构建镜像，请稍后..."),request:e({image_name:d,["path"===i?"dockerfile_dir":"dockerfile_body"]:"path"===i?s:t,sid:j.value}),message:!0,success:e=>{o()}})).status}catch(t){}}}),(e,a)=>(h(),y(_(C),{class:"p-20px"}))}});export{k as default};
