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