import{_ as A}from"./index-BDlR_GtR.js?v=1773287522785";import{_ as L}from"./index-BRQskX9P.js?v=1773287522785";import{i as f}from"./index-BTglIPU2.js?v=1773287522785";import{u as C}from"./useLoading-CZ2gSAW7.js?v=1773287522785";import{g as $,a as z}from"./index-BzDEH7a1.js?v=1773287522785";import{u as B}from"./useSocket-DTHwGZgK.js?v=1773287522785";import{k as D,t as M,R as O,c as S,r as _,$ as U,Z as V,a0 as d,X as j,S as p}from"./vue-core-DJjvd5ZC.js?v=1773287522785";import"./prismjs-BZPoR7_J.js?v=1773287522785";import"./naive-ui--dJnpVcV.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-D8O2mMsP.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-D2Bk83Ev.js?v=1773287522785";import"./check-CNel7fTH.js?v=1773287522785";import"./index.vue_vue_type_script_setup_true_lang-DG86e1NA.js?v=1773287522785";import"./index-K4YGya6V.js?v=1773287522785";import"./index-CZps0rIN.js?v=1773287522785";import"./data-BVsViUMm.js?v=1773287522785";const E={class:"p-20px"},se=D({__name:"index",props:{app:{}},setup(v){const s=M(v,"app"),{t:c}=O(),i=S(()=>s.value.status==="initializing"),a=_(i.value?"install":"run"),g=[{key:"run",show:!i.value,label:c("Docker.App.index_5")},{key:"install",label:c("Docker.App.index_6")}],t=_(""),{loading:k,setLoading:o}=C(),b=async()=>{try{o(!0),t.value="";const{message:e}=await $({service_name:s.value.service_name,app_name:s.value.appname});f(e)&&(t.value=e.result)}finally{o(!1)}},y=async()=>{try{o(!0),t.value="";const{message:e}=await z({service_name:s.value.service_name});f(e)&&(t.value=e.result)}finally{o(!1)}},r=()=>{u(a.value)},u=e=>{switch(e){case"run":b();break;case"install":i.value?h():y();break}},{open:x,send:I,close:m}=B("/sock_shell",{immediate:!1,onMessage:(e,n)=>{const{data:l}=n;t.value+=n.data,(l.includes("bt_successful")||l.includes("bt_failed"))&&m()}}),h=()=>{const e=s.value.appinfo.filter(n=>n.fieldKey==="installed_log");e.length>0&&(t.value="",m(),x(),I("tail -f ".concat(e[0].fieldValue)))};return r(),(e,n)=>{const l=L,w=A;return U(),V("div",E,[d(l,{value:p(a),"onUpdate:value":[n[0]||(n[0]=R=>j(a)?a.value=R:null),u],options:g,onClick:r},null,8,["value"]),d(w,{class:"h-468px",lang:"log","font-size":12,loading:p(k),content:p(t)},null,8,["loading","content"])])}}});export{se as default};
