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