"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["app/backup/restore"],{1968:(e,t,o)=>{o.r(t),o.d(t,{default:()=>c});var n=o(90),s=o(1964);const c=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)},1964:(e,t,o)=>{o.r(t),o.d(t,{default:()=>s});var n=o(90);const s=({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,additionalContent:i})=>{const u=[c];r&&u.push("&nbsp;",r),l&&u.push("&nbsp;",l),a&&u.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-${t}`);e?.parentNode.removeChild(e)}})(t)},o.lmsg("closeMessage"))),d&&u.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"))),i&&u.push(i),(0,n.addStatusMessage)(s,u,{id:`task-status-${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-${t.id}`))||e.parentNode.removeChild(e)})),c.forEach((t=>{const{id:o}=t,c=`task-status-${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?42b7ca03941994309068