import{u as e,z as s,l as a,x as l,d3 as t,b2 as n,b9 as r,d4 as i,bm as c,d5 as o,M as p,L as u,_ as v}from"./utils-lib.js?v=20260328163632";import{r as d,e as g,k as f,V as y,W as m,O as b,a3 as w,j as x,Z as S,Y as k,X as _,a1 as j,N as h}from"./base-lib.js?v=20260328163632";import{B as q}from"./naive-ui.js?v=20260328163632";import"./__commonjsHelpers__.js?v=20260328163632";import"./env-lib.js?v=20260328163632";const{plugin:C}=e(),I=d(!1),R=d(),V=d(!0),L=d([]);let M;const W=g({webServe:!1,mysqlServe:!1,restartServe:!1,serveStart:!1}),F=async()=>{await s({icon:"warning-filled",title:a("重启面板"),content:a("即将重启面板服务，继续吗？")}),l({loading:a("正在重启面板，请稍候..."),request:t(),message:!0,data:{code:Number},success:e=>{200===e.code&&setTimeout((()=>{localStorage.clear(),sessionStorage.clear(),window.location.reload()}),1e3)}})},N=async()=>{var e;try{const{panelInfo:s}=n();s.value.isRestart=!0,L.value.splice(0,L.value.length),V.value=!1,R&&(null==(e=R.value)||e.showFooterFun(!1)),W.webServe=!0,await r({name:C.value.webserver,type:"stop"}),W.mysqlServe=!0,await r({name:"mysql",type:"stop"}),W.restartServe=!0,await i(),W.serveStart=!0,O()}catch(s){c(s)}},O=()=>{M=setInterval((async()=>{try{const e=await o();e&&(e.hasOwnProperty("status")||void 0!==e.code)&&(p.success("服务器重启成功!"),setTimeout((()=>{localStorage.clear(),sessionStorage.clear(),window.location.reload()}),2e3),clearInterval(M))}catch(e){c(e)}}),3e3)},Q={class:"flex justify-between items-center h-full px-[30px] py-20px reset"},T={class:"relative h-full"},z={class:"p-[15px]"},B={class:"flex items-center tips"},H={class:"text-[12px] leading-[26px]"},P={class:"mt-[10px] mb-[10px]"},U={id:"SafeRestart",class:"flex justify-between"},X={key:0,class:"info"},Y={key:1,class:"info"},Z={class:"green-font"},A={key:2,class:"info"},D={key:3,class:"info"},E={class:"green-font"},G={key:4,class:"info"},J={key:5,class:"info"},K={class:"green-font"},$={key:6,class:"info"},ee={key:7,class:"info"},se={class:"green-font"},ae={key:0,class:"flex items-center tips mb-[12px]"},le={class:"bt-modal-footer"},te=v(f({__name:"index",setup:e=>(e,s)=>{const l=q;return y(),m("div",Q,[b(l,{onClick:s[0]||(s[0]=e=>I.value=!0)},{default:w((()=>[x(S(k(a)("重启服务器")),1)])),_:1}),b(l,{onClick:k(F)},{default:w((()=>[x(S(k(a)("重启面板")),1)])),_:1},8,["onClick"]),b(k(u),{title:k(a)("安全重启服务器"),modelValue:k(I),"onUpdate:modelValue":s[3]||(s[3]=e=>h(I)?I.value=e:null),area:466,ref_key:"serverRestartRef",ref:R},{default:w((()=>[_("div",T,[_("div",z,[_("div",B,[s[4]||(s[4]=_("i",{class:"svgtofont-el-warning text-[16px] mr-[7px]"},null,-1)),_("p",null,S(k(a)("注意事项：如果当前服务器是容器，重启服务器可能存在风险，请取消操作！")),1)]),_("div",H,[_("p",P,S(k(a)("为了您的服务器数据安全，面板重启服务器将执行以下操作：")),1),_("div",U,[k(W).webServe?(y(),m("div",Y,[s[6]||(s[6]=_("span",{class:"green-bg"},null,-1)),_("p",Z,S(k(a)("正在停止Web服务...")),1)])):(y(),m("div",X,[s[5]||(s[5]=_("span",{class:"gray-bg"},null,-1)),_("p",null,S(k(a)("1. 停止Web服务")),1)])),k(W).mysqlServe?(y(),m("div",D,[s[8]||(s[8]=_("span",{class:"green-bg circle-green"},null,-1)),_("p",E,S(k(a)("正在停止MySQL服务...")),1)])):(y(),m("div",A,[s[7]||(s[7]=_("span",{class:"gray-bg circle-gray"},null,-1)),_("p",null,S(k(a)("2. 停止MySQL服务")),1)])),k(W).restartServe?(y(),m("div",J,[s[10]||(s[10]=_("span",{class:"green-bg circle-green"},null,-1)),_("p",K,S(k(a)("正在重启服务器...")),1)])):(y(),m("div",G,[s[9]||(s[9]=_("span",{class:"gray-bg circle-gray"},null,-1)),_("p",null,S(k(a)("3. 开始重启服务器")),1)])),k(W).serveStart?(y(),m("div",ee,[s[12]||(s[12]=_("span",{class:"green-bg circle-green"},null,-1)),_("p",se,S(k(a)("4. 等待服务器启动")),1),s[13]||(s[13]=_("i",{class:"svgtofont-el-loading animate-spin"},null,-1))])):(y(),m("div",$,[s[11]||(s[11]=_("span",{class:"gray-bg circle-gray"},null,-1)),_("p",null,S(k(a)("4. 等待服务器启动")),1)]))]),k(W).serveStart?(y(),m("div",ae,[_("p",null,S(k(a)("重启进行中时，请勿随意进行刷新，若长时间未响应，可以进行刷新尝试。")),1)])):j("",!0)])]),_("div",le,[b(l,{type:"warning",onClick:s[1]||(s[1]=e=>I.value=!1)},{default:w((()=>[x(S(k(a)("取消")),1)])),_:1}),b(l,{type:"primary",onClick:s[2]||(s[2]=e=>k(N)())},{default:w((()=>[x(S(k(a)("确认")),1)])),_:1})])])])),_:1},8,["title","modelValue"])])}}),[["__scopeId","data-v-f89d7fb8"]]);export{te as default};
