import{_ as v}from"./ButtonDefault-CghIUDY0.js";import{c as w,o as P,a as o,n as t,t as D,I as d,at as l,b as T,r as m,x as k,O as C,H as I,s as O}from"./index-CipWZKo_.js";import{u as R}from"./server-DA2BhLHe.js";import{_ as V}from"./_plugin-vue_export-helper-DlAUqK2U.js";const M={props:{data:{type:Object,default:()=>{}}},emits:["modalClose"],setup(a,{emit:e}){const u=R(),s=m(""),f=k("emitter"),p=C(),i=m(a.data?.isReloading||""),n=m(a.data?.DSOrderID||""),y=m(a.data?.OrderID||""),S=m(a.data?.SystemPower);function b(){i.value=!0,a.data.onReloadStatusChange(!0),u.ServerReset(n.value,s.value).then(()=>{f.emit("open-modal",{component:"Suspense"}),setTimeout(()=>{c(),i.value=!1,a.data.onReloadStatusChange(!1),p.fetchDSOrders().then(()=>{p.fetchDSOrderIPMI(y.value).then(r=>{}).catch(r=>{console.error("fetchDSOrderIPMI error:",r)})}).catch(r=>{console.error("fetchDSOrders error:",r)})},1e4)})}function c(){e("modalClose")}const _=r=>{r.key==="Enter"&&b()};return I(()=>{document.addEventListener("keyup",_)}),O(()=>{document.removeEventListener("keyup",_)}),{acceptReload:b,closeModal:c,commandType:s,SystemPower:S}}},U={class:"modal__body"},g={class:"list-item__status"},x={class:"form"},B=["disabled"],E=["disabled"],j=["disabled"],L=["disabled"],N=["disabled"],z={class:"form-input_border"},H={class:"modal__buttons-wrap"};function K(a,e,u,s,f,p){const i=v;return P(),w("div",U,[e[14]||(e[14]=o("div",{class:"list-item__title"},"Питание сервера",-1)),o("div",g,[e[7]||(e[7]=o("div",{class:"list-item__status-text"},"Текущий статус",-1)),o("div",{class:t(["server-status",{"server-status-on":s.SystemPower==="on","server-status-off":s.SystemPower!=="on"}])},D(s.SystemPower==="on"?"Включен":"Выключен"),3)]),e[15]||(e[15]=o("div",{class:"list-item__subtitle"},"Выбор команды",-1)),o("form",x,[o("label",{class:t(["form-input_border",{"disabled-label":s.SystemPower==="on"}])},[d(o("input",{type:"radio",name:"Command",value:"on","onUpdate:modelValue":e[0]||(e[0]=n=>s.commandType=n),disabled:s.SystemPower==="on"},null,8,B),[[l,s.commandType]]),e[8]||(e[8]=o("span",{class:"form-input_border-content"},[o("span",{class:"form-input_border-mark"}),o("span",{class:"form-input_border-info"},[o("span",{class:"form-input_border-address"},"Включить")])],-1))],2),o("label",{class:t(["form-input_border",{"disabled-label":s.SystemPower!=="on"}])},[d(o("input",{type:"radio",name:"Command",value:"off","onUpdate:modelValue":e[1]||(e[1]=n=>s.commandType=n),disabled:s.SystemPower!=="on"},null,8,E),[[l,s.commandType]]),e[9]||(e[9]=o("span",{class:"form-input_border-content"},[o("span",{class:"form-input_border-mark"}),o("span",{class:"form-input_border-info"},[o("span",{class:"form-input_border-address"},"Выключить")])],-1))],2),o("label",{class:t(["form-input_border",{"disabled-label":s.SystemPower!=="on"}])},[d(o("input",{type:"radio",name:"Command",value:"soft","onUpdate:modelValue":e[2]||(e[2]=n=>s.commandType=n),disabled:s.SystemPower!=="on"},null,8,j),[[l,s.commandType]]),e[10]||(e[10]=o("span",{class:"form-input_border-content"},[o("span",{class:"form-input_border-mark"}),o("span",{class:"form-input_border-info"},[o("span",{class:"form-input_border-address"},"Корректно выключить")])],-1))],2),o("label",{class:t(["form-input_border",{"disabled-label":s.SystemPower!=="on"}])},[d(o("input",{type:"radio",name:"Command",value:"cycle","onUpdate:modelValue":e[3]||(e[3]=n=>s.commandType=n),disabled:s.SystemPower!=="on"},null,8,L),[[l,s.commandType]]),e[11]||(e[11]=o("span",{class:"form-input_border-content"},[o("span",{class:"form-input_border-mark"}),o("span",{class:"form-input_border-info"},[o("span",{class:"form-input_border-address"},"Выключить/включить")])],-1))],2),o("label",{class:t(["form-input_border",{"disabled-label":s.SystemPower!=="on"}])},[d(o("input",{type:"radio",name:"Command",value:"reset","onUpdate:modelValue":e[4]||(e[4]=n=>s.commandType=n),disabled:s.SystemPower!=="on"},null,8,N),[[l,s.commandType]]),e[12]||(e[12]=o("span",{class:"form-input_border-content"},[o("span",{class:"form-input_border-mark"}),o("span",{class:"form-input_border-info"},[o("span",{class:"form-input_border-address"},"Reset")])],-1))],2),o("label",z,[d(o("input",{type:"radio",name:"Command",value:"mc","onUpdate:modelValue":e[5]||(e[5]=n=>s.commandType=n)},null,512),[[l,s.commandType]]),e[13]||(e[13]=o("span",{class:"form-input_border-content"},[o("span",{class:"form-input_border-mark"}),o("span",{class:"form-input_border-info"},[o("span",{class:"form-input_border-address"},"Перезагрузить IPMI")])],-1))])]),o("div",H,[T(i,{class:"modal__button yes",label:"Выполнить",onClick:e[6]||(e[6]=n=>s.acceptReload())})])])}const G=V(M,[["render",K],["__scopeId","data-v-d8fed8d8"]]);export{G as default};
