1import{d as W,f as X,p as u,G as t,k as a,y,u as l,af as Y,I as Z,F as N,L as F,E as T,av as ee,r as n,P as se,c as D,B as S,C as v,m as c}from"./vendor-D7HY6vXs.js";/* empty css */import{u as te,c as O}from"./index-DBE2nJWm.js";import{A as z}from"./Autocompletes-ymBfTEty.js";import{S as w}from"./Servers-C2v2reAP.js";import{E as ie,g,e as le,k as B}from"./index-DAxIWTJb.js";import{u as ne}from"./vendor-i18n-BAJQGTf1.js";import{s as oe,l as _,f as H,j as re,b as V}from"./vendor-servebolt-BwnDPTSW.js";import"./vendor-auth0-B88dyU-W.js";import"./vendor-toast-BA6wVAZy.js";const ae={class:"max-w-[100%] md:min-w-[550px]"},de={class:"mb-[50px] md:mb-[86px] flex flex-col"},ue={class:"base-border px-[1rem] md:px-[1.5rem] py-[1.5rem] md:py-[2rem] mb-[40px]"},ce={class:"flex flex-col"},me={class:"mb-[48px]"},ve={class:"flex flex-col md:flex-row items-center pb-4 mb-4"},fe={class:"flex-1 w-full flex flex-col"},pe={class:"flex-1"},be={key:0},xe={class:"error-msg"},he={class:"flex-1 mt-1"},ye={key:1},Se={class:"error-msg"},ge={class:"flex-1 mt-1"},$e={class:"flex-1 flex items-center mr-[24px] flex-row"},Ie={class:"base-border px-[1rem] md:px-[1.5rem] py-[1.5rem] md:py-[2rem] mb-[40px]"},we={class:"flex flex-col"},_e={class:"mb-[48px]"},Ve={class:"flex-1 flex items-center mr-[24px] flex-row"},Ce={class:"base-border px-[1rem] md:px-[1.5rem] py-[1.5rem] md:py-[2rem] mb-[40px]"},Ee={class:"flex flex-col"},Pe={class:"mb-[48px]"},ke={class:"flex-1 flex items-center mr-[24px] flex-row"},Me=W({__name:"RebuildSitesConfig",setup(Ae){const{t:d}=ne({useScope:"global"}),C=ee(),$=n(),K=n(),E=n([]),I=n(),L=n(),P=n([]),p=n(!1),b=n(!1),x=n(!1),f=n(!1),h=C.state.accessTokenObject?.isServeboltAdmin||C.state.accessTokenObject?.isServeboltStaff,o=se({serverId:n(),environmentId:n(),syncCronsSsh:n(!1)}),M=D(()=>({serverId:{serverIsValid:O.withMessage("Selected server is invalid",q)},environmentId:{environmentIsValid:O.withMessage("Selected site is invalid",U)}})),r=te(M,o,{$lazy:!0}),R=D(()=>o.serverId||o.environmentId);X(()=>{j(),k("")});async function j(){const s="ngl=1";try{const e=await new z().getServers(s,h);$.value=e.getData(),K.value=$.value.map(i=>i.hostname+" ("+i.ip+")"),E.value=e.getData().map(i=>({label:`${i.hostname}`,value:i.id}))}catch(e){console.error("Error loading servers:",e)}}async function k(s){f.value=!0;try{const e="q="+s,i=await new z().getEnvironments(e,h);I.value=i.getData(),L.value=I.value.map(m=>m.friendlyName+" ("+m.name+")"),P.value=i.getData().map(m=>({label:`${m.friendlyName} (${m.name})`,value:m.id}))}catch(e){console.error("Error loading environments:",e)}finally{f.value=!1}}function q(s){return s?$.value.map(i=>i.id).includes(s):o.environmentId}function U(s){return s?I.value.map(i=>i.id).includes(s):o.serverId}function G(s){k(s.target.value)}async function A(s){if(s.preventDefault(),!!await l(r).$validate()){p.value=!0;try{const e=o.environmentId,i=o.serverId;e?(await new ie().rebuildSitesConfig(e,o.syncCronsSsh,h),g(d("rebuildSitesConfigSuccess"))):i&&(await new w().rebuildSitesConfig(i,o.syncCronsSsh,h),g(d("rebuildSitesConfigSuccess")))}catch(e){le(e.response,d("rebuildSitesConfigFailed"))}finally{p.value=!1}}}async function J(){b.value=!0,await new w().reloadPhpExtensions()?g(d("reloadPhpExtensionsSuccess")):B(d("reloadPhpExtensionsError")),b.value=!1}async function Q(){x.value=!0,await new w().reloadPhpVersions()?g(d("reloadPhpVersionsSuccess")):B(d("reloadPhpVersionsError")),x.value=!1}return(s,e)=>(c(),u("div",ae,[t("div",de,[a(l(oe),{class:"md:mt-0"},{default:y(()=>[S(v(s.$t("rebuildSitesConfig")),1)]),_:1})]),t("div",ue,[t("div",ce,[t("div",me,[a(l(_),null,{default:y(()=>[S(v(s.$t("rebuildSitesConfig")),1)]),_:1})]),e[5]||(e[5]=t("p",{class:"text-14 font-bold"},"Rebuild all sites on a server",-1)),e[6]||(e[6]=t("p",{class:"text-14 mb-[1.5rem]"},"On SL8 servers, you can force a configuration rebuild of all sites.",-1)),t("form",{onSubmit:Z(A,["prevent"]),onKeyup:Y(A,["enter"])},[t("div",ve,[t("div",fe,[t("div",pe,[a(l(H),{modelValue:l(r).serverId.$model,"onUpdate:modelValue":e[0]||(e[0]=i=>l(r).serverId.$model=i),invalid:l(r).serverId.$invalid,label:s.$t("server"),sid:"server",dataKey:"label",inputValue:"value",placeholder:s.$t("server"),searchable:"",options:E.value}
1,null,8,["modelValue","invalid","label","placeholder","options"])]),f.value?T("",!0):(c(),u("div",be,[(c(!0),u(N,null,F(l(r).serverId.$errors,i=>(c(),u("div",{class:"text-invalid",key:i.$uid},[t("div",xe,v(i.$message),1)]))),128))])),e[3]||(e[3]=t("div",{class:"flex-1 mt-4"},[t("p",{class:"text-14 font-bold"},"Rebuild by site"),t("p",{class:""}," Alternatively, you can select a specific site. This takes precedence over the selected server above, and will only process the selected site. ")],-1)),t("div",he,[a(l(H),{modelValue:l(r).environmentId.$model,"onUpdate:modelValue":e[1]||(e[1]=i=>l(r).environmentId.$model=i),invalid:l(r).environmentId.$invalid,label:s.$t("environment"),sid:"environment",dataKey:"label",inputValue:"value",placeholder:s.$t("environment"),searchable:"",loading:f.value,options:P.value,onInput:G},null,8,["modelValue","invalid","label","placeholder","loading","options"])]),f.value?T("",!0):(c(),u("div",ye,[(c(!0),u(N,null,F(l(r).environmentId.$errors,i=>(c(),u("div",{class:"text-invalid",key:i.$uid},[t("div",Se,v(i.$message),1)]))),128))])),e[4]||(e[4]=t("div",{class:"flex-1 mt-4"},[t("p",{class:"text-14 font-bold"},"Options")],-1)),t("div",ge,[a(l(re),{checked:o.syncCronsSsh,"onUpdate:checked":e[2]||(e[2]=i=>o.syncCronsSsh=i),label:s.$t("syncCronsSsh")},null,8,["checked","label"])])])]),t("div",$e,[a(l(V),{size:"lg",type:"outline",btnType:"submit",disabled:!R.value||l(r).$invalid||p.value,text:p.value?s.$t("submitting"):s.$t("submit")},null,8,["disabled","text"])])],32)])]),t("div",Ie,[t("div",we,[t("div",_e,[a(l(_),null,{default:y(()=>[S(v(s.$t("rebuildPhpVersions")),1)]),_:1})]),e[7]||(e[7]=t("p",{class:"text-14 mb-[1.5rem]"}," Sometimes, it is needed to rebuild the PHP versions list inside the Servebolt API database, so it can be reflected in the Admin Panel. Click the button below to refresh the PHP versions for all servers. ",-1)),t("div",Ve,[a(l(V),{size:"lg",type:"outline",btnType:"submit",disabled:x.value,iconAnimated:"",onClick:Q,text:x.value?s.$t("rebuilding"):s.$t("rebuild")},null,8,["disabled","text"])])])]),t("div",Ce,[t("div",Ee,[t("div",Pe,[a(l(_),null,{default:y(()=>[S(v(s.$t("rebuildExtensions")),1)]),_:1})]),e[8]||(e[8]=t("p",{class:"text-14 mb-[1.5rem]"}," Sometimes, it is needed to rebuild the PHP modules list inside the Servebolt API database, so it can be reflected in the Admin Panel. Click the button below to rebuild the PHP extensions for all servers. ",-1)),t("div",ke,[a(l(V),{size:"lg",type:"outline",btnType:"submit",disabled:b.value,iconAnimated:"",onClick:J,text:b.value?s.$t("rebuilding"):s.$t("rebuild")},null,8,["disabled","text"])])])])]))}});export{Me as default}; 2//# sourceMappingURL=RebuildSitesConfig-BNSSxQQc.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.