import{aP as e,P as a,h6 as s,b as l,ay as o,_ as t,aC as r}from"./utils-lib.js?v=1761009159";import{c as n,o as d,r as u,v as c,x as m,e as i,B as p,y as f,P as _,C as v,z as b,R as y,G as j,T as g,ab as x,a9 as C,aA as h,Q as k,aC as V}from"./base-lib.js?v=1761009159";import T from"./container-edit.js?v=1761009159";import{_ as w}from"./index119.js?v=1761009159";import{A as z}from"./add-compose.js?v=1761009159";import"./__commonjsHelpers__.js?v=1761009159";import"./index103.js?v=1761009159";import"./useMethods.js?v=1761009159";import"./column.js?v=1761009159";import"./index106.js?v=1761009159";import"./validator.js?v=1761009159";import"./form-item.js?v=1761009159";const D={class:"container-dialog !p-0"},P={class:"result"},R={class:"p-[.6rem] rounded-default bg-[#222] h-[46.2rem]"},q=t(n({__name:"create-con-cmd",setup(t){const r=l(),{refs:{isRefreshTableList:n}}=e();let h=null;const k=d({order:"",result:""}),V=u(!1),T=u(""),z=u(!1),q=d({model_index:"btdocker",mod_name:"container",def_name:"get_cmd_log",ws_callback:111}),A=(e,a)=>{try{const e=a.data;if(T.value+="".concat(e),e.includes("bt_successful")||e.includes("bt_failed")){const a={status:e.includes("bt_successful"),msg:e.includes("bt_successful")?"创建成功":"创建失败"};r.request(a),a.status&&(n.value=!0),null==h||h.close(),V.value=!1}}catch(s){}},I=async()=>{""!==k.order&&(z.value=!0,V.value=!0,a({request:s({cmd:k.order}),success:e=>{e.status?(null==h||h.close(),T.value="",h=o({route:"/ws_model",onMessage:A}),null==h||h.send(q)):(r.error(e.msg),V.value=!1)}}))};return(e,a)=>{const s=j,l=g,o=x,t=w,r=C;return c(),m("div",D,[i(r,{size:"large",model:f(k),class:"relative w-full","label-position":"top",onSubmit:a[1]||(a[1]=y(()=>{},["prevent"]))},{default:p(()=>[i(o,{prop:"name"},{default:p(()=>[i(l,{autofocus:"",modelValue:f(k).order,"onUpdate:modelValue":a[0]||(a[0]=e=>f(k).order=e),disabled:f(V),onKeyup:_(I,["enter","native"]),placeholder:"请输入需要执行的命令，例如 docker run -d nginx:latest，按回车执行"},{append:p(()=>[i(s,{type:"default",onClick:I},{default:p(()=>a[2]||(a[2]=[v("执行命令",-1)])),_:1,__:[2]})]),_:1},8,["modelValue","disabled"])]),_:1}),a[3]||(a[3]=b("div",{class:"text-right"},null,-1)),a[4]||(a[4]=b("div",{class:"resultTitle px-[.2rem] py-[.4rem]"},"命令执行结果：",-1)),b("div",P,[b("div",R,[i(t,{class:"h-[45rem] !rounded-none",content:f(T)},null,8,["content"])])])]),_:1,__:[3,4]},8,["model"])])}}}),[["__scopeId","data-v-2bdcfd86"]]),A={class:"container-dialog"},I=t(n({__name:"index",props:{compData:{default:()=>({})}},emits:["close"],setup(a,{expose:s,emit:l}){const o=h("popupSetFooter"),t=l,{refs:{isRefreshTableList:n}}=e(),d=u(),_=u(),v=u(),b=u("manual"),y=()=>{t("close"),n.value=!0},j=e=>{b.value=null==e?void 0:e.props.name,"cmd"===b.value?o(!1):o(!0)};return s({onConfirm:()=>{"manual"===b.value?d.value.onConfirm():"cmd"===b.value?y():v.value.onConfirm()}}),(e,a)=>{const s=V,l=r;return c(),m("div",A,[i(l,{type:"card",modelValue:f(b),"onUpdate:modelValue":a[0]||(a[0]=e=>k(b)?b.value=e:null),onTabClick:j},{default:p(()=>[i(s,{label:"手动创建",name:"manual",class:"overflow-y-auto"},{default:p(()=>[i(T,{ref_key:"manual",ref:d,type:"add",compData:e.compData,onClose:y},null,8,["compData"])]),_:1}),i(s,{label:"命令创建",name:"cmd",lazy:!0},{default:p(()=>[i(q,{ref_key:"cmd",ref:_},null,512)]),_:1}),i(s,{label:"容器编排",name:"compose",class:"mt-[.4rem]",lazy:!0},{default:p(()=>[i(z,{ref_key:"compose",ref:v,onClose:y},null,512)]),_:1})]),_:1},8,["modelValue"])])}}}),[["__scopeId","data-v-126b5ad7"]]);export{I as default};
