import{_ as e}from"./index107.js?v=1763625242172";import{_ as a}from"./index104.js?v=1763625242172";import{_ as l}from"./index.vue_vue_type_script_setup_true_lang.js?v=1763625242172";import{k as s,P as o,e as n,r as c,c as d,R as t,S as m,X as r,a3 as u,U as i,V as p,ak as _,j as g,a4 as v,aj as x}from"./vue.js?v=1763625242172";import{bU as f,h as k,m as b,c7 as D,x as y,gl as I}from"./page_layout.js?v=1763625242172";import{C as L}from"./public.js?v=1763625242172";import{dV as h,dP as j,au as w,aC as C,az as $}from"./naive.js?v=1763625242172";import"./__commonjsHelpers__.js?v=1763625242172";import"./common.js?v=1763625242172";const U={class:"pt-4px"},R={class:"w-440px"},E={class:"w-440px"},M={class:"px-2px py-4px"},P={class:"h-420px"},V=s({__name:"index",setup(e){const{t:s}=o(),x=f(),I=n({name:null,image:""}),V={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"))}},z=c(null),H=c(s("Docker.LocalImage.pull.index_10")),K=c(!1),S=c([]),X=async()=>{var e;await(null==(e=z.value)?void 0:e.validate()),H.value="",q.value=!0,B(),J()},q=c(!1),A=d((()=>q.value)),{open:B,send:F,close:G}=L("/ws_model",{immediate:!1,onMessage:(e,a)=>{const{data:l}=a;if(k(l)&&(H.value+=a.data,l.includes("successful")||l.includes("failed"))){q.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{K.value=!0;const{message:e}=await D();y(e)&&e.length>0&&(S.value=e.map((e=>({label:e.name,value:e.name}))),I.name=e[0].name)}finally{K.value=!1}})(),(e,s)=>{const o=h,n=j,c=w,d=C,x=$,f=l,k=a;return t(),m("div",U,[r(f,{ref_key:"formRef",ref:z,model:p(I),rules:V},{default:u((()=>[r(n,{label:e.$t("Docker.LocalImage.pull.index_3"),path:"name"},{default:u((()=>[i("div",R,[r(o,{value:p(I).name,"onUpdate:value":s[0]||(s[0]=e=>p(I).name=e),loading:p(K),disabled:p(A),options:p(S)},null,8,["value","loading","disabled","options"])])])),_:1},8,["label"]),r(n,{label:e.$t("Docker.LocalImage.pull.index_4"),path:"image"},{default:u((()=>[i("div",E,[r(x,null,{default:u((()=>[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:_(X,["enter"])},null,8,["value","disabled","placeholder"]),r(d,{type:"primary",disabled:p(A),onClick:X},{default:u((()=>[g(v(e.$t("Docker.LocalImage.pull.index_6")),1)])),_:1},8,["disabled"])])),_:1})])])),_:1},8,["label"])])),_:1},8,["model"]),i("div",M,v(e.$t("Docker.LocalImage.pull.index_7")),1),i("div",P,[r(k,{log:p(H)},null,8,["log"])])])}}}),z={class:"pt-4px"},H={class:"px-2px py-4px"},K={class:"h-456px"},S=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=w,o=C,n=$,c=a;return t(),m("div",z,[r(n,{class:"mb-16px"},{default:u((()=>[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:u((()=>[g(v(e.$t("Docker.LocalImage.pull.index_12")),1)])),_:1},8,["disabled"])])),_:1}),i("div",H,v(e.$t("Docker.LocalImage.pull.index_7")),1),i("div",K,[r(c,{log:p(x)},null,8,["log"])])])}}}),X={class:"p-16px"},q=s({__name:"index",setup(a){const{t:l}=o(),s=c("normal"),n=[{key:"normal",label:l("Docker.LocalImage.pull.index_1"),component:V},{key:"command",label:l("Docker.LocalImage.pull.index_2"),component:S}];return(a,l)=>{const o=e;return t(),m("div",X,[r(o,{value:p(s),"onUpdate:value":l[0]||(l[0]=e=>x(s)?s.value=e:null),options:n},null,8,["value"])])}}});export{q as default};
