import{Q as V}from"./QChip-DB1RdPou.js";import{w as E,O as n,L as u,J as i,G as t,P as z,V as _,W as w,R as g,F as c,S as b,N as F,r as d,T as L,I as a,U as M,K as k,M as x,$ as R,Q as h,b as W,e as j}from"./index-iCRehgtD.js";import{u as D,Q as C}from"./useSetupWs-P74ozpSr.js";import{u as G}from"./setup-B2WhYkmc.js";const H={class:"row justify-between"},J={class:"row q-gutter-sm"},X={__name:"InstallPage",setup(K){const y=L(),s=G(),{send:I,messages:Q,clearMessages:B}=D(),o=d(!1),p=d(!1),f=d(0),m=d([]),v=d(null),S=W(()=>["bareos-filedaemon","bareos-director","bareos-storage","bareos-storage-tape","bareos-storage-dedupable","bareos-database-tools","bareos-tools","bareos-webui-vue"]);E(Q,l=>{const e=l[l.length-1];!e||!o.value||(e.type==="output"?(m.value.push({text:e.line,cls:e.stream==="stderr"?"output-line-err":"output-line-out"}),j(()=>{v.value&&(v.value.scrollTop=v.value.scrollHeight)})):e.type==="done"&&(o.value=!1,p.value=!0,f.value=e.exit_code,e.exit_code===0&&(s.packagesInstalled=!0)))},{deep:!0});function q(){var l;B(),m.value=[],p.value=!1,o.value=!0,s.packagesInstalled=!1,I({action:"run_step",id:"install_packages",sudo:!0,pkg_mgr:(l=s.osInfo)==null?void 0:l.pkg_mgr})}function N(){s.prevStep(),y.push("/repo")}function P(){s.nextStep(),y.push("/targets")}return(l,e)=>(a(),n("div",null,[e[2]||(e[2]=u("div",{class:"step-header"},"Install Packages",-1)),e[3]||(e[3]=u("p",{class:"text-body2 q-mb-md"}," The following Bareos packages are always installed by the setup wizard. ",-1)),i(z,{flat:"",bordered:"",class:"q-mb-md"},{default:t(()=>[i(M,null,{default:t(()=>[e[0]||(e[0]=u("div",{class:"text-caption text-grey q-mb-xs"},"Packages",-1)),(a(!0),n(_,null,w(S.value,r=>(a(),c(V,{key:r,color:"primary","text-color":"white",dense:""},{default:t(()=>[k(x(r),1)]),_:2},1024))),128))]),_:1})]),_:1}),m.value.length?(a(),n("div",{key:0,class:"output-console q-mb-md",ref_key:"consoleEl",ref:v},[(a(!0),n(_,null,w(m.value,(r,T)=>(a(),n("div",{key:T,class:R(r.cls)},x(r.text),3))),128))],512)):g("",!0),p.value&&f.value!==0?(a(),c(C,{key:1,class:"bg-negative text-white q-mb-md",rounded:""},{avatar:t(()=>[i(h,{name:"error"})]),default:t(()=>[k(" Installation failed (exit code "+x(f.value)+"). ",1)]),_:1})):g("",!0),p.value&&f.value===0?(a(),c(C,{key:2,class:"bg-positive text-white q-mb-md",rounded:""},{avatar:t(()=>[i(h,{name:"check_circle"})]),default:t(()=>[e[1]||(e[1]=k(" Packages installed successfully. ",-1))]),_:1})):g("",!0),u("div",H,[i(b,{flat:"",label:"Back",icon:"arrow_back",disable:o.value,onClick:N},null,8,["disable"]),u("div",J,[F(s).packagesInstalled?(a(),c(b,{key:1,label:"Continue",color:"primary","icon-right":"arrow_forward",onClick:P})):(a(),c(b,{key:0,label:"Install",color:"secondary",icon:"download",loading:o.value,onClick:q},null,8,["loading"]))])])]))}};export{X as default};
