import{_ as e}from"./index107.js?v=1764233927359";import{_ as a}from"./index104.js?v=1764233927359";import{_ as l}from"./index.vue_vue_type_script_setup_true_lang.js?v=1764233927359";import{k as s,P as o,e as n,r as c,c as d,R as t,V as m,W as r,S as u,a3 as i,U as p,aj as _,j as g,a4 as v,ak as x}from"./vue.js?v=1764233927359";import{bU as f,h as k,m as b,c5 as D,x as y,gm as I}from"./page_layout.js?v=1764233927359";import{C as L}from"./public.js?v=1764233927359";import{dR as h,dV as j,av as w,au as C,aC as $}from"./naive.js?v=1764233927359";import"./__commonjsHelpers__.js?v=1764233927359";import"./common.js?v=1764233927359";const U={class:"pt-4px"},R={class:"w-440px"},E={class:"w-440px"},M={class:"px-2px py-4px"},V={class:"h-420px"},H=s({__name:"index",setup(e){const{t:s}=o(),x=f(),I=n({name:null,image:""}),H={name:{trigger:"change",validator:()=>null!==I.name||new Error(s("Docker.LocalImage.pull.index_8"))},image:{trigger:["input","blur"],validator:()=>""!==I.image||new Error(s("Docker.LocalImage.pull.index_9"))}},K=c(null),P=c(s("Docker.LocalImage.pull.index_10")),S=c(!1),W=c([]),q=async()=>{var e;await(null==(e=K.value)?void 0:e.validate()),P.value="",z.value=!0,B(),J()},z=c(!1),A=d(()=>z.value),{open:B,send:F,close:G}=L("/ws_model",{immediate:!1,onMessage:(e,a)=>{const{data:l}=a;if(k(l)&&(P.value+=a.data,l.includes("successful")||l.includes("failed"))){z.value=!1;const e={status:l.includes("successful"),msg:l.includes("successful")?s("Docker.Container.create.command_7"):s("Docker.Container.create.command_6")};e.status?(b.success(e.msg),x.setRefresh(!0)):b.error(e.msg),G()}}}),J=()=>{F({model_index:"btdocker",mod_name:"image",def_name:"pull_from_some_registry",ws_callback:111,name:I.name,image:I.image})};return(async()=>{try{S.value=!0;const{message:e}=await D();y(e)&&e.length>0&&(W.value=e.map(e=>({label:e.name,value:e.name})),I.name=e[0].name)}finally{S.value=!1}})(),(e,s)=>{const o=j,n=h,c=C,d=$,x=w,f=l,k=a;return m(),t("div",U,[r(f,{ref_key:"formRef",ref:K,model:p(I),rules:H},{default:i(()=>[r(n,{label:e.$t("Docker.LocalImage.pull.index_3"),path:"name"},{default:i(()=>[u("div",R,[r(o,{value:p(I).name,"onUpdate:value":s[0]||(s[0]=e=>p(I).name=e),loading:p(S),disabled:p(A),options:p(W)},null,8,["value","loading","disabled","options"])])]),_:1},8,["label"]),r(n,{label:e.$t("Docker.LocalImage.pull.index_4"),path:"image"},{default:i(()=>[u("div",E,[r(x,null,{default:i(()=>[r(c,{value:p(I).image,"onUpdate:value":s[1]||(s[1]=e=>p(I).image=e),disabled:p(A),placeholder:e.$t("Docker.LocalImage.pull.index_5"),onKeyup:_(q,["enter"])},null,8,["value","disabled","placeholder"]),r(d,{type:"primary",disabled:p(A),onClick:q},{default:i(()=>[g(v(e.$t("Docker.LocalImage.pull.index_6")),1)]),_:1},8,["disabled"])]),_:1})])]),_:1},8,["label"])]),_:1},8,["model"]),u("div",M,v(e.$t("Docker.LocalImage.pull.index_7")),1),u("div",V,[r(k,{log:p(P)},null,8,["log"])])])}}}),K={class:"pt-4px"},P={class:"px-2px py-4px"},S={class:"h-456px"},W=s({__name:"index",setup(e){const{t:l}=o(),s=f(),_=n({cmd:""}),x=c(l("Docker.LocalImage.pull.index_10")),D=c(!1),y=d(()=>D.value),h=async()=>{if(""!==_.cmd.trim())try{D.value=!0,x.value=l("Docker.Container.create.command_8"),await I({cmd:_.cmd}),j(),E()}catch(e){D.value=!1,console.error(e)}else b.error(l("Docker.LocalImage.pull.index_13"))},{open:j,send:U,close:R}=L("/ws_model",{immediate:!1,onMessage:(e,a)=>{const{data:o}=a;if(k(o)&&(x.value+=a.data,o.includes("bt_successful")||o.includes("bt_failed"))){D.value=!1;const e={status:o.includes("bt_successful"),msg:o.includes("bt_successful")?l("Docker.Container.create.command_7"):l("Docker.Container.create.command_6")};e.status?(b.success(e.msg),s.setRefresh(!0)):b.error(e.msg),R()}}}),E=()=>{U({model_index:"btdocker",mod_name:"image",def_name:"get_cmd_log",ws_callback:111,name:"",image:""})};return(e,l)=>{const s=C,o=$,n=w,c=a;return m(),t("div",K,[r(n,{class:"mb-16px"},{default:i(()=>[r(s,{value:p(_).cmd,"onUpdate:value":l[0]||(l[0]=e=>p(_).cmd=e),disabled:p(y),placeholder:e.$t("Docker.LocalImage.pull.index_11")},null,8,["value","disabled","placeholder"]),r(o,{type:"primary",disabled:p(y),onClick:h},{default:i(()=>[g(v(e.$t("Docker.LocalImage.pull.index_12")),1)]),_:1},8,["disabled"])]),_:1}),u("div",P,v(e.$t("Docker.LocalImage.pull.index_7")),1),u("div",S,[r(c,{log:p(x)},null,8,["log"])])])}}}),q={class:"p-16px"},z=s({__name:"index",setup(a){const{t:l}=o(),s=c("normal"),n=[{key:"normal",label:l("Docker.LocalImage.pull.index_1"),component:H},{key:"command",label:l("Docker.LocalImage.pull.index_2"),component:W}];return(a,l)=>{const o=e;return m(),t("div",q,[r(o,{value:p(s),"onUpdate:value":l[0]||(l[0]=e=>x(s)?s.value=e:null),options:n},null,8,["value"])])}}});export{z as default};
