(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["app/backup/restore"],{1101:(e,t,o)=>{"use strict";o.r(t);var n=o(143),s=o(1096);t.default=e=>(({type:e,disableRestore:t,...o})=>{const c=o=>{let s=!1;if("local"===e){const e=document.getElementById("restoreModifiedDump-restoreModifiedDumpCheckbox");s=s||e&&!e.checked}const r=document.getElementById("contentSelectSection-restoreType-full"),l=!r||r.checked,a=document.getElementById("contentSelectSection-restoreType-granular"),d=a&&a.checked,i=document.getElementById("restoreComponents");if(i&&(i.style.display=l?"":"none",l)){let e=!1;i.querySelectorAll("input").forEach((t=>{t.checked&&(e=!0)})),s=s||!e}const u=document.getElementById("contentSelectSection-restoreObjectType");u&&(u.closest(".form-row").style.display=d?"":"none",u.querySelectorAll("option").forEach((e=>{const t=document.getElementById(`contentSelectSection-restoreObjects_${e.value}`);let r=d&&e.selected;if(t){const l=document.getElementById(`contentSelectSection-subscriptionLookup_${e.value}`),a=(0,n.getComponent)(t.id);if(l){l.closest(".form-row").style.display=r?"":"none";const e=(0,n.getComponent)(l.id);!0===o&&e.addEventObserver("dataavailable",(()=>{if(e.isEmpty())return void c();const t=document.getElementById("contentSelectSection-restoreObjectType").value,o=document.getElementById(`contentSelectSection-restoreObjects_${t}`),s=(0,n.getComponent)(o.id),r=JSON.parse(e.getValue()),l={"subscription-name":r.name,"subscription-guid":r.guid};s instanceof n.DoubleListSelector&&s.reload(l),s instanceof n.DynamicSubForm&&s.setDataUrlParams(l),c()})),r&&(s=s||e.isEmpty(),r=r&&!e.isEmpty())}a instanceof n.DoubleListSelector&&(t.closest(".form-row").style.display=r?"":"none",a.onChange=c,r?s=s||a.isEmpty():a.reset()),a instanceof n.DynamicSubForm&&(t.style.display=r?"":"none",a.onChange=c,r?s=s||a.isEmpty():a.reset())}})));const m=document.getElementById("restorationOptions-contentRestoreType-form-row");if(m){m.style.display=d?"":"none";const e=document.getElementById("restorationOptions");1===e.querySelectorAll(".form-row").length&&(e.style.display=d?"":"none")}const p=(0,n.getComponent)("btn-send");p&&(t||s?p.disable():p.enable())};[document.getElementById("restoreModifiedDump-restoreModifiedDumpCheckbox"),document.getElementById("contentSelectSection-restoreType-full"),document.getElementById("contentSelectSection-restoreType-granular"),document.getElementById("contentSelectSection-restoreObjectType")].concat(Array.prototype.slice.call(document.querySelectorAll("#restoreComponents input"))).forEach((e=>{e&&("SELECT"===e.tagName?e.addEventListener("change",c):e.addEventListener("click",c))}));const r=document.getElementById("contentSelectSection-restoreType-granularNotSupported");r&&(r.disabled=!0);const l=document.getElementById("contentSelectSection-restoreType-fullNotSupportedInResellerPowerUser");l&&(l.disabled=!0),Jsw.onReady((function(){c(!0)})),(0,s.default)(o)})(e)},1096:(e,t,o)=>{"use strict";o.r(t);var n=o(143);t.default=({urls:e,taskStatuses:t})=>{const o=n.Locale.getSection("controllers.backup.restore-status"),s=({id:t,status:s,message:c,downloadLog:r,viewLog:l,close:a,stop:d})=>{const i=[c];r&&i.push("&nbsp;",r),l&&i.push("&nbsp;",l),a&&i.push("&nbsp;",(0,n.createElement)("a",{onclick:()=>(async t=>{const{status:o}=await n.api.post((0,n.addUrlParams)(e.closeStatus,{taskId:t}));if("success"===o){const e=document.getElementById("task-status-".concat(t));null==e||e.parentNode.removeChild(e)}})(t)},o.lmsg("closeMessage"))),d&&i.push("&nbsp;",(0,n.createElement)("a",{onclick:()=>{return o=t,void n.api.post((0,n.addUrlParams)(e.stopTask,{taskId:o}));var o}},o.lmsg("stop"))),(0,n.addStatusMessage)(s,i,{id:"task-status-".concat(t)})},c=[];t.forEach((e=>{"backup"===e.type&&"progress"===e.status||("progress"===e.status?c.push(e):s(e))})),document.querySelectorAll(".msg-progress").forEach((e=>{c.some((t=>e.id==="task-status-".concat(t.id)))||e.parentNode.removeChild(e)})),c.forEach((t=>{const{id:o}=t,c="task-status-".concat(o);if(document.getElementById(c))return;s(t);const r=()=>{n.api.get((0,n.addUrlParams)(e.restoreStatus,{taskId:o})).then((e=>{const t=document.getElementById(c);t&&("progress"===e.status?(setTimeout(r,1e4),e.stop||(t.parentNode.removeChild(t),s(e))):(t.parentNode.removeChild(t),s(e),(0,n.getComponent)("backup-list").reload()))})).catch((()=>setTimeout(r,1e4)))};setTimeout(r,1e4)}))}}}]);
//# sourceMappingURL=restore.js.map?1a4e40b0fbc8ec30afcb