"use strict";(self.webpackChunkPlesk=self.webpackChunkPlesk||[]).push([["app/backup/restore"],{2104:(e,t,o)=>{o.r(t),o.d(t,{default:()=>c});var s=o(90),n=o(2100);const c=e=>(({type:e,disableRestore:t,...o})=>{const c=o=>{let n=!1;if("local"===e){const e=document.getElementById("restoreModifiedDump-restoreModifiedDumpCheckbox");n=n||e&&!e.checked}const r=document.getElementById("contentSelectSection-restoreType-full"),a=!r||r.checked,l=document.getElementById("contentSelectSection-restoreType-granular"),d=l&&l.checked,i=document.getElementById("restoreComponents");if(i&&(i.style.display=a?"":"none",a)){let e=!1;i.querySelectorAll("input").forEach((t=>{t.checked&&(e=!0)})),n=n||!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 a=document.getElementById(`contentSelectSection-subscriptionLookup_${e.value}`),l=(0,s.getComponent)(t.id);if(a){a.closest(".form-row").style.display=r?"":"none";const e=(0,s.getComponent)(a.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}`),n=(0,s.getComponent)(o.id),r=JSON.parse(e.getValue()),a={"subscription-name":r.name,"subscription-guid":r.guid};n instanceof s.DoubleListSelector&&n.reload(a),n instanceof s.DynamicSubForm&&n.setDataUrlParams(a),c()})),r&&(n=n||e.isEmpty(),r=r&&!e.isEmpty())}l instanceof s.DoubleListSelector&&(t.closest(".form-row").style.display=r?"":"none",l.onChange=c,r?n=n||l.isEmpty():l.reset()),l instanceof s.DynamicSubForm&&(t.style.display=r?"":"none",l.onChange=c,r?n=n||l.isEmpty():l.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,s.getComponent)("btn-send");p&&(t||n?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 a=document.getElementById("contentSelectSection-restoreType-fullNotSupportedInResellerPowerUser");a&&(a.disabled=!0),Jsw.onReady((function(){c(!0)})),(0,n.default)(o)})(e)},2100:(e,t,o)=>{o.r(t),o.d(t,{default:()=>c});var s=o(90),n=o(679);const c=({urls:e,taskStatuses:t})=>{const o=s.Locale.getSection("controllers.backup.restore-status"),c=({id:t,status:c,message:r,downloadLog:a,viewLog:l,close:d,stop:i,additionalContent:u})=>{const m=[r];a&&m.push("&nbsp;",a),l&&m.push("&nbsp;",l),d&&m.push("&nbsp;",(0,s.createElement)("a",{onclick:()=>(async t=>{try{const{status:o}=await s.api.post((0,s.addUrlParams)(e.closeStatus,{taskId:t}));if("success"===o){const e=document.getElementById(`task-status-${t}`);e?.parentNode.removeChild(e)}}catch({message:e}){(0,n.addToast)({intent:"danger",message:e})}})(t)},o.lmsg("closeMessage"))),i&&m.push("&nbsp;",(0,s.createElement)("a",{onclick:()=>{return o=t,void s.api.post((0,s.addUrlParams)(e.stopTask,{taskId:o}));var o}},o.lmsg("stop"))),u&&m.push(u),(0,s.addStatusMessage)(c,m,{id:`task-status-${t}`})},r=[];t.forEach((e=>{"backup"===e.type&&"progress"===e.status||("progress"===e.status?r.push(e):c(e))})),document.querySelectorAll(".msg-progress").forEach((e=>{r.some((t=>e.id===`task-status-${t.id}`))||e.parentNode.removeChild(e)})),r.forEach((t=>{const{id:o}=t,n=`task-status-${o}`;if(document.getElementById(n))return;c(t);const r=()=>{s.api.get((0,s.addUrlParams)(e.restoreStatus,{taskId:o})).then((e=>{const t=document.getElementById(n);t&&("progress"===e.status?(setTimeout(r,1e4),e.stop||(t.parentNode.removeChild(t),c(e))):(t.parentNode.removeChild(t),c(e),(0,s.getComponent)("backup-list").reload()))})).catch((()=>setTimeout(r,1e4)))};setTimeout(r,1e4)}))}}}]);
//# sourceMappingURL=restore.js.map?5a0188950c0572eb5385