PageSourceSearch

https://admin.servebolt.com/assets/BackupRestore-DUNpaKzA.js

js servebolt.com collected 2026-09-24 19:46:19 UTC 30,530 bytes, 2 lines download raw bytes

1import{u as L}from"./vendor-i18n-BAJQGTf1.js";import{p as c,G as e,m as a,d as Z,r as R,q as H,C as l,u as s,x as $,A as V,F as P,L as U,c as h,E as N,y as j,k as S,a as de,P as oe,h as pe,f as ne,I as me,aH as fe,ar as be}from"./vendor-D7HY6vXs.js";import{_ as xe}from"./BreadcrumbWrapper.vue_vue_type_script_setup_true_lang-C_IMLSFP.js";import{e as ie,g as le}from"./formatDate-CXV7pXnY.js";import{I as W,C as J}from"./Info-D9Ows-kz.js";import{R as re}from"./Radio-8Pk-uQmu.js";import{_ as q}from"./Button.vue_vue_type_style_index_0_lang-iFao3Sp0.js";import{_ as Q}from"./Tooltip.vue_vue_type_script_setup_true_lang-xmcxltpU.js";import{_ as ve}from"./Dialog.vue_vue_type_style_index_0_lang-C6MNDysF.js";import{_ as he}from"./Toggle.vue_vue_type_style_index_0_lang-w9qiNKpD.js";import{W as ce}from"./Warning-Cd3YMqnz.js";import{$ as ge,E as X,e as ee,B as _e,F as ke}from"./index-DAxIWTJb.js";import{_ as ye}from"./Table.vue_vue_type_style_index_0_lang-BOZ8abQF.js";import{_ as we}from"./Pagination.vue_vue_type_style_index_0_lang-BWltZzV2.js";import{u as ue}from"./useApiErrorHandler-BPESgDW7.js";import"./vendor-servebolt-BwnDPTSW.js";import"./vendor-antdv-base-QySV-hqZ.js";import"./vendor-lodash-BvL3EwUt.js";import"./vendor-auth0-B88dyU-W.js";import"./vendor-toast-BA6wVAZy.js";import"./vendor-antdv-table-DFhwV24V.js";const De={xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24"};function Re(u,m){return a(),c("svg",De,[...m[0]||(m[0]=[e("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"m8 19.684 8-8-8-8"},null,-1)])])}const te={render:Re},$e={class:"text-[20px] font-normal text-primary mb-0"},Ce={class:"border border-border rounded-base p-6 flex flex-col gap-3 flex-1 bg-background"},Te={class:"flex justify-between items-center"},Me={class:"text-[14px] text-primary"},Se=["disabled"],Be={class:"flex gap-1"},Ie=["onClick"],Fe={class:"text-[14px]"},Ve=Z({__name:"BackupCalendar",props:{selectedDate:{},disabled:{type:Boolean},backups:{}},emits:["select"],setup(u,{emit:m}){const{t}=L({useScope:"global"}),r=u,B=m,d=new Date,f=R(d.getMonth()),g=R(d.getFullYear()),T=["January","February","March","April","May","June","July","August","September","October","November","December"],v=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],D=h(()=>`${T[f.value]} ${g.value}`),x=h(()=>{const n=new Date(g.value,f.value,1),y=new Date(g.value,f.value+1,0),b=[],C=n.getDay();for(let p=0;p<C;p++){const F=new Date(g.value,f.value,-(C-1-p));b.push({date:F,day:F.getDate(),isCurrentMonth:!1})}for(let p=1;p<=y.getDate();p++)b.push({date:new Date(g.value,f.value,p),day:p,isCurrentMonth:!0});const i=7-b.length%7;if(i<7)for(let p=1;p<=i;p++){const F=new Date(g.value,f.value+1,p);b.push({date:F,day:F.getDate(),isCurrentMonth:!1})}return b}),M=h(()=>{const n=[];for(let y=0;y<x.value.length;y+=7)n.push(x.value.slice(y,y+7));return n});function I(){f.value===0?(f.value=11,g.value--):f.value--}function O(){f.value===11?(f.value=0,g.value++):f.value++}function Y(n){B("select",n.date)}function A(n){return r.selectedDate?n.date.getFullYear()===r.selectedDate.getFullYear()&&n.date.getMonth()===r.selectedDate.getMonth()&&n.date.getDate()===r.selectedDate.getDate():!1}function _(n){return n.date.getFullYear()===d.getFullYear()&&n.date.getMonth()===d.getMonth()&&n.date.getDate()===d.getDate()}function w(n){return`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`}const k=h(()=>r.backups?new Set(Object.keys(r.backups).map(n=>n.split("T")[0])):new Set);function z(n){return k.value.has(w(n.date))}const E=h(()=>g.value>d.getFullYear()||g.value===d.getFullYear()&&f.value>=d.getMonth());function o(n){const y=n.date;return y.getFullYear()>d.getFullYear()||y.getFullYear()===d.getFullYear()&&y.getMonth()>d.getMonth()||y.getFullYear()===d.getFullYear()&&y.getMonth()===d.getMonth()&&y.getDate()>d.getDate()}return(n,y)=>(a(),c("div",{class:H(["flex flex-col gap-4 flex-1",{"pointer-events-none opacity-50":u.disabled}])},[e("h3",$e,l(s(t)("backupRestore.selectBackup.calendar.title")),1),e("div",Ce,[e("div",Te,[e("button",{type:"button",class:"flex items-center justify-center hover:bg-neutral-light rounded transition-colors",onClick:I,"aria-label":"Previous month"},[(a(),$(V(s(te)),{width:"24",height:"24",class:"shrink-0 rotate-180"}))]),e("span",Me,l(D.value),1),e("button",{type:"button",class:H(["flex items-center justify-center rounded transition-colors",E.value?"opacity-30 curs
1or-not-allowed":"hover:bg-neutral-light"]),disabled:E.value,onClick:y[0]||(y[0]=b=>!E.value&&O()),"aria-label":"Next month"},[(a(),$(V(s(te)),{width:"24",height:"24",class:"shrink-0"}))],10,Se)]),e("div",Be,[(a(),c(P,null,U(v,b=>e("div",{key:b,class:"flex-1 flex items-center justify-center py-2 text-[14px] text-neutral"},l(b),1)),64))]),(a(!0),c(P,null,U(M.value,(b,C)=>(a(),c("div",{key:C,class:"flex gap-1"},[(a(!0),c(P,null,U(b,(i,p)=>(a(),c("div",{key:p,class:H(["flex-1 flex items-center justify-center h-9 border border-border transition-colors",{"bg-primary text-background !border-primary":A(i),"bg-neutral-light":!A(i)&&z(i),"text-secondary":_(i)&&z(i)&&!A(i),"text-text-disabled":!i.isCurrentMonth||o(i),"hover:bg-neutral-light":!A(i)&&!o(i),"cursor-pointer":!o(i),"cursor-not-allowed":o(i)}]),onClick:F=>!o(i)&&Y(i)},[e("span",Fe,l(i.day),1)],10,Ie))),128))]))),128))])],2))}}),Oe={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none"};function Ee(u,m){return a(),c("svg",Oe,[...m[0]||(m[0]=[e("circle",{cx:"8",cy:"8",r:"7.25",stroke:"currentColor","stroke-width":"1.5"},null,-1),e("path",{stroke:"currentColor","stroke-linecap":"round","stroke-width":"1.5",d:"M8 4.5v4l2.5 2.5"},null,-1)])])}const Ae={render:Ee},Ne={class:"flex flex-col sm:flex-row items-center justify-between"},Pe={class:"text-[20px] font-normal text-primary mb-0"},ze={key:0,class:"text-14 text-neutral"},je={key:0,class:"border border-border rounded-base p-6 flex justify-center items-center flex-1 bg-background min-h-[300px]"},Ye={class:"text-14 text-neutral"},He={class:"flex items-center gap-2 px-4 py-4 bg-neutral-light rounded-base"},Ue={class:"text-[14px] text-primary"},Le={class:"border border-border rounded-base px-6 py-1 flex-1 bg-background"},Ze={key:0,class:"flex justify-center items-center h-full min-h-[120px]"},Ge={class:"text-14 text-neutral"},We={key:1,class:"flex flex-col gap-2 overflow-y-auto max-h-[270px] pr-2.5"},qe=["onClick"],Je={class:"flex flex-col gap-[2px] flex-1"},Ke={class:"text-14 text-text-disabled"},Qe=Z({__name:"BackupAvailableTimes",props:{selectedDate:{},selectedTime:{},disabled:{type:Boolean},backups:{}},emits:["select-time"],setup(u,{emit:m}){const{t}=L({useScope:"global"}),r=u,B=m,d=h(()=>{if(!r.selectedDate||!r.backups)return[];const v=r.selectedDate.getFullYear(),D=r.selectedDate.getMonth(),x=r.selectedDate.getDate();return Object.keys(r.backups).filter(M=>{const I=new Date(M);return I.getFullYear()===v&&I.getMonth()===D&&I.getDate()===x}).sort().map(M=>({time:M,label:ie(M)}))}),f=h(()=>r.selectedDate?r.selectedDate.toLocaleDateString("en-GB",{month:"short",day:"numeric",year:"numeric"}):""),g=h(()=>r.selectedDate?t("backupRestore.selectBackup.availableTimes.titleWithDate",{date:f.value}):t("backupRestore.selectBackup.availableTimes.title")),T=h(()=>{const v=Intl.DateTimeFormat().resolvedOptions().timeZone,D=new Intl.DateTimeFormat("en",{timeZoneName:"shortOffset",timeZone:v}).formatToParts().find(x=>x.type==="timeZoneName")?.value??"";return`${v} (${D})`});return(v,D)=>(a(),c("div",{class:H(["flex flex-col gap-4 flex-1",{"pointer-events-none opacity-50":u.disabled}])},[e("div",Ne,[e("h3",Pe,l(g.value),1),u.selectedDate?(a(),c("span",ze,l(s(t)("backupRestore.selectBackup.availableTimes.backupsCount",{count:d.value.length})),1)):N("",!0)]),u.selectedDate?(a(),c(P,{key:1},[e("div",He,[(a(),$(V(s(Ae)),{class:"flex-shrink-0 text-primary"})),e("span",Ue,l(s(t)("backupRestore.selectBackup.availableTimes.timezone",{timezone:T.value})),1)]),e("div",Le,[d.value.length?(a(),c("div",We,[(a(!0),c(P,null,U(d.value,x=>(a(),c("button",{key:x.time,type:"button",class:H(["flex items-center px-3 py-2 rounded-base border text-left transition-colors w-full",u.selectedTime===x.time?"bg-primary border-primary":"bg-background border-border hover:bg-neutral-light"]),onClick:M=>B("select-time",x.time)},[e("div",Je,[e("span",{class:H(["text-[16px]",u.selectedTime===x.time?"text-background":"text-primary"])},l(x.label),3),e("span",Ke,l(s(t)("backupRestore.selectBackup.availableTimes.automaticBackup")),1)])],10,qe))),128))])):(a(),c("div",Ze,[e("p",Ge,l(s(t)("backupRestore.selectBackup.availableTimes.noBackups")),1)]))])],64)):(a(),c("div",je,[e("p",Ye,l(s(t)("backupRestore.selectBackup.availableTimes.chooseDate")),1)]))],2))}}),Xe={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none"};function et(u,m){return a(),c("svg",Xe,[...m[0]||(m[0]=[e("path",{fill:"currentColor",d:"M15.167 5.087a1.833 1.833 0 0 0-1.834-1.833H7.277a1.83 1.83 0 0 0-1.6-.951h-3.01A1.835 1.835 0 0 0 .832 4.134v7.733A1.836 1.836 0 0 0 2.667 13.7h10.666a1.835 1.835 0 0 0 1.834-1.834V5.087m-1.834-.833a.833.833 0 0 1 .834.833v.31H8.804a.83.83 0 0 1-.758-.487l-.3-.656zm.835 7.613a.833.833 0 0 1-.835.832H2.667a.834.834 0 0 1-.834-.834v-7.73a.833.833 0 0 1 .834-.832h3.008a.83.83 0 0 1 .758.486l.704 1.537a1.84 1.84 0 0 0 1.667 1.07h5.364z"},null,-1)])])}const se={render:et},tt={xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",fill:"none"};function st(u,m){return a(),c("svg",tt,[...m[0]||(m[0]=[e("g",{"clip-path":"url(#clip0_7944_4705)"},[e("path",{fill:"currentColor",d:"M12.625.86C11.373.304 9.731 0 8 0S4.628.305 3.376.858c-1.392.616-2.158 1.484-2.158 2.445v9.566c0 .922.765 1.748 2.155 2.327C4.617 15.714 6.26 16 8 16s3.383-.286 4.627-.804c1.39-.58 2.152-1.405 2.152-2.326V3.304q.001-.002.003-.005c-.003-.959-.769-1.825-2.158-2.44m-8.827.953c1.122-.496 2.614-.77 4.202-.77s3.08.274 4.203.77c.962.426 1.537.984 1.537 1.491s-.575 1.065-1.537 1.491c-1.122.497-2.615.77-4.203.77-3.284 0-
15.739-1.194-5.739-2.262 0-.508.575-1.065 1.537-1.49M13.74 12.87c0 .458-.566.968-1.513 1.363-1.12.466-2.621.723-4.226.723-1.606 0-3.107-.257-4.227-.723-.947-.395-1.516-.905-1.516-1.363v-1.412c.307.223.682.427 1.115.607 1.244.519 2.888.805 4.627.805 1.74 0 3.384-.286 4.628-.805a5.5 5.5 0 0 0 1.112-.607zm-1.513-1.768c-1.12.467-2.621.724-4.226.724-1.606 0-3.107-.257-4.227-.724-.947-.395-1.513-.904-1.513-1.363h-.003V8.326c.307.224.682.428 1.115.608 1.244.518 2.888.804 4.628.804s3.383-.285 4.627-.804a5.5 5.5 0 0 0 1.112-.608V9.74c0 .459-.566.968-1.513 1.363m0-3.13c-1.12.467-2.621.724-4.226.724-1.606 0-3.107-.257-4.227-.724-.947-.395-1.516-.905-1.516-1.363V5.104a5.5 5.5 0 0 0 1.118.644c1.252.555 2.894.86 4.624.86s3.373-.304 4.625-.859a5.5 5.5 0 0 0 1.115-.644v1.504c0 .458-.566.968-1.513 1.363"})],-1)])])}const ae={render:st},at={xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",fill:"none"};function ot(u,m){return a(),c("svg",at,[...m[0]||(m[0]=[e("path",{stroke:"currentColor","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"1.5",d:"m6 6.314 11.314 11.313M6 17.314 17.314 6"},null,-1)])])}const lt={render:ot},rt={class:"flex flex-col gap-8"},nt={class:"flex flex-col gap-3"},it={class:"flex items-center justify-between"},ct={class:"m-0 font-normal text-primary text-[34px]"},ut={class:"m-0 text-primary text-[16px]"},dt={class:"flex flex-col gap-4"},pt={class:"flex flex-col gap-4 p-6 border border-border rounded-[5px]"},mt={class:"text-primary text-[20px]"},ft={class:"flex flex-col gap-1"},bt={class:"text-neutral text-[14px] leading-[120%]"},xt={class:"text-primary text-[16px]"},vt={class:"text-neutral text-[14px]"},ht={class:"flex flex-col pt-1 gap-2"},gt={class:"text-neutral text-[14px]"},_t={class:"flex flex-col gap-1"},kt={class:"text-primary text-[16px]"},yt={class:"text-primary text-[16px]"},wt={class:"flex flex-col pt-1 gap-1"},Dt={class:"text-neutral text-[14px]"},Rt={class:"text-primary text-[16px]"},$t={class:"flex flex-col pt-1 gap-1"},Ct={class:"flex items-center gap-1.5"},Tt={class:"text-neutral text-[14px]"},Mt={class:"text-primary text-[16px]"},St={class:"flex flex-col pt-1 gap-4"},Bt={class:"text-primary text-[20px]"},It={class:"flex flex-col gap-1"},Ft={class:"flex items-center gap-2"},Vt={class:"text-primary text-[16px]"},Ot={class:"pl-[46px] text-neutral text-[16px]"},Et={key:0,class:"flex items-start p-6 rounded-xl gap-2 bg-beige rounded-[12px]"},At={class:"flex items-center justify-center flex-shrink-0 w-6 h-6"},Nt={class:"flex flex-col gap-2"},Pt={class:"text-[20px] text-checkout"},zt={class:"m-0 text-neutral text-[16px]"},jt={class:"m-0 text-neutral text-[16px]"},Yt={key:0,class:"flex flex-col gap-4"},Ht={class:"flex flex-col gap-4"},Ut={class:"flex items-center justify-between pt-1"},Lt={class:"text-primary text-[14px]"},Zt={class:"flex items-center justify-between"},Gt=Z({__name:"BackupRestoreConfirmDialog",props:{open:{type:Boolean},selectedDate:{},selectedTime:{},selectedVhosts:{},selectedDatabases:{},restoreMode:{}},emits:["update:open","confirm","cancel"],setup(u,{emit:m}){const{t}=L({useScope:"global"}),r=de("hubspot"),B=u,d=m,f=R(!1),g=R(!1),T=R(!0),v=h(()=>B.restoreMode==="export"),D=h(()=>v.value?t("backupRestore.confirmDialog.titleExport"):t("backupRestore.confirmDialog.title")),x=h(()=>v.value?t("backupRestore.confirmDialog.descriptionExport"):t("backupRestore.confirmDialog.description")),M=h(()=>v.value?t("backupRestore.confirmDialog.needHelpExport"):t("backupRestore.confirmDialog.needHelp")),I=h(()=>v.value?t("backupRestore.confirmDialog.startExport"):t("backupRestore.confirmDialog.startRestore")),O=h(()=>v.value||f.value&&g.value),Y=h(()=>`${B.selectedDate.toLocaleDateString("en-GB",{month:"short",day:"numeric",year:"numeric"})} — ${ie(B.selectedTime)}`),A=h(()=>{const E=Intl.DateTimeFormat().resolvedOptions().timeZone,o=new Intl.DateTimeFormat("en",{timeZoneName:"shortOffset",timeZone:E}).formatToParts().find(n=>n.type==="timeZoneName")?.value??"";return`${E} (${o})`});function _(){f.value=!1,g.value=!1,T.value=!0,d("update:open",!1)}function w(){_(),d("cancel")}function k(){const E=v.value?T.value:!1;_(),d("confirm",E)}function z(){r?.open()}return(E,o)=>(a(),$(ve,{open:u.open,width:600,"onUpdate:open":_},{default:j(()=>
1[e("div",rt,[e("div",nt,[e("div",it,[e("h2",ct,l(D.value),1),S(q,{variant:"ghost",size:"2xl",onClick:_},{default:j(()=>[(a(),$(V(s(lt))))]),_:1})]),e("p",ut,l(x.value),1)]),e("div",dt,[e("div",pt,[e("span",mt,l(s(t)("backupRestore.confirmDialog.summary.title")),1),e("div",ft,[e("span",bt,l(s(t)("backupRestore.confirmDialog.summary.backupSelected")),1),e("span",xt,l(Y.value),1),e("span",vt,l(s(t)("backupRestore.selectBackup.availableTimes.timezone",{timezone:A.value})),1)]),o[5]||(o[5]=e("div",{class:"border-t border-border"},null,-1)),e("div",ht,[e("span",gt,l(s(t)("backupRestore.confirmDialog.summary.includes")),1),e("div",_t,[(a(!0),c(P,null,U(u.selectedVhosts,n=>(a(),c("div",{key:n.attributes.vhost_id,class:"flex items-center gap-1"},[(a(),$(V(s(se)),{class:"text-primary flex-shrink-0 w-4 h-4"})),e("span",kt,l(n.attributes.vhost_name),1)]))),128)),(a(!0),c(P,null,U(u.selectedDatabases,n=>(a(),c("div",{key:n.attributes.database_id,class:"flex items-center gap-1"},[(a(),$(V(s(ae)),{class:"text-primary flex-shrink-0 w-4 h-4"})),e("span",yt,l(n.attributes.database_name),1)]))),128))])]),o[6]||(o[6]=e("div",{class:"border-t border-border"},null,-1)),e("div",wt,[e("span",Dt,l(s(t)("backupRestore.confirmDialog.summary.mode")),1),e("span",Rt,l(u.restoreMode==="overwrite"?s(t)("backupRestore.confirmDialog.summary.overwrite"):s(t)("backupRestore.confirmDialog.summary.copy")),1)]),v.value?(a(),c(P,{key:0},[o[3]||(o[3]=e("div",{class:"border-t border-border"},null,-1)),e("div",$t,[e("div",Ct,[e("span",Tt,l(s(t)("backupRestore.confirmDialog.summary.locationExport")),1),S(Q,{content:s(t)("backupRestore.confirmDialog.summary.locationExportTooltip")},{default:j(()=>[(a(),$(V(s(W)),{class:"text-neutral flex-shrink-0 cursor-pointer w-4 h-4"}))]),_:1},8,["content"])]),e("span",Mt,l(s(t)("backupRestore.confirmDialog.summary.locationExportValue")),1)]),o[4]||(o[4]=e("div",{class:"border-t border-border"},null,-1)),e("div",St,[e("span",Bt,l(s(t)("backupRestore.confirmDialog.summary.exportFormat")),1),e("div",It,[e("div",Ft,[S(he,{modelValue:T.value,"onUpdate:modelValue":o[0]||(o[0]=n=>T.value=n),variant:"slim"},null,8,["modelValue"]),e("span",Vt,l(s(t)("backupRestore.confirmDialog.summary.archiveLabel")),1)]),e("span",Ot,l(s(t)("backupRestore.confirmDialog.summary.archiveDescription")),1)])])],64)):N("",!0)]),u.restoreMode==="overwrite"?(a(),c("div",Et,[e("div",At,[(a(),$(V(s(ce)),{class:"w-4 h-4"}))]),e("div",Nt,[e("span",Pt,l(s(t)("backupRestore.confirmDialog.warning.title")),1),e("p",zt,l(s(t)("backupRestore.confirmDialog.warning.body")),1),e("p",jt,l(s(t)("backupRestore.confirmDialog.warning.unavailable")),1)])])):N("",!0)]),v.value?N("",!0):(a(),c("div",Yt,[u.restoreMode==="overwrite"?(a(),$(J,{key:0,modelValue:f.value,"onUpdate:modelValue":o[1]||(o[1]=n=>f.value=n),label:s(t)("backupRestore.confirmDialog.confirm1")},null,8,["modelValue","label"])):N("",!0),S(J,{modelValue:g.value,"onUpdate:modelValue":o[2]||(o[2]=n=>g.value=n),label:s(t)("backupRestore.confirmDialog.confirm2")},null,8,["modelValue","label"])])),e("div",Ht,[e("div",Ut,[e("span",Lt,l(M.value),1),e("button",{class:"bg-transparent border-0 p-0 cursor-pointer underline text-[16px] text-secondary",onClick:z},l(s(t)("backupRestore.confirmDialog.contactSupport")),1)]),o[7]||(o[7]=e("div",{class:"border-t border-border"},null,-1)),e("div",Zt,[S(q,{variant:"outline",size:"2xl",text:s(t)("backupRestore.confirmDialog.cancel"),onClick:w},null,8,["text"]),S(q,{variant:"primary",size:"2xl",disabled:!O.value,text:I.value,onClick:k},null,8,["disabled","text"])])])])]),_:1},8,["open"]))}}),Wt={class:"flex flex-col gap-6"},qt={class:"flex flex-col gap-6"},Jt={class:"text-[24px] font-normal text-primary mb-0"},Kt={key:0,class:"flex flex-col gap-2"},Qt={class:"text-[20px] font-normal text-primary mb-0"},Xt={class:"flex flex-col md:flex-row gap-2"},es={key:1,class:"flex flex-col gap-2"},ts={class:"text-[20px] font-normal text-primary mb-0"},ss={class:"flex flex-col md:flex-row gap-2"},as={class:"text-[16px] text-neutral flex-shrink-0"},os={class:"flex items-center justify-center gap-3 px-4 py-4 bg-neutral-light rounded-base"},ls={class:"text-[14px] text-primary"},rs={class:"flex flex-col gap-6"},ns={class:"text-[24px] font-normal text-primary mb-0"},is={class:"flex flex-col md:flex-row gap-2"},cs={class:"flex flex-col gap-3"},us={key:0,class:"text-[16px] text-neutral m-0"},ds=Z({__name:"BackupRestoreOptions",props:{selectedDate:{},selectedTime:{},isRestoring:{type:Boolean},backupEntries:{}},emits:["start-restore"],setup(u,{emit:m}){const{t}=L({useScope:"global"}),r=u,B=m,d=h(()=>(r.backupEntries??[]).filter(_=>_.type==="vhost_backup")),f=h(()=>(r.backupEntries??[]).filter(_=>_.type==="database_backup")),g=oe(Object.fromEntries(d.value.map(_=>[_.attributes.vhost_id,!0]))),T=oe(Object.fromEntries(f.value.map(_=>[_.attributes.database_id,!0]))),v=h(()=>d.value.filter(_=>g[_.attributes.vhost_id])),D=h(()=>f.value.filter(_=>T[_.attributes.database_id])),x=R("overwrite"),M=R(!1),I=h(()=>x.value==="export"),O=h(()=>r.isRestoring?I.value?t("backupRestore.restoreOptions.exportInProgress"):t("backupRestore.restoreOptions.restoreInProgress"):I.value?t("backupRestore.restoreOptions.startExport"):t("backupRestore.restoreOptions.startRestore"));function Y(_){return`${ge(_)} GB`}function A(_){B("start-restore",{vhostIds:v.value.map(w=>w.attributes.vhost_id),databaseIds:D.value.map(w=>w.attributes.database_id),mode:x.value,compress:_})}return(_,w)=>(a(),c("div",Wt,[w[4]||(w[4]=e("div",{class:"w-full h-px bg-border"},null,-1)),e("div",qt,[e("h2",Jt,l(s(t)("backupRestore.restoreOptions.selectContent.title")),1),d.value.length>
10?(a(),c("div",Kt,[e("h3",Qt,l(s(t)("backupRestore.restoreOptions.selectContent.siteFiles.title")),1),e("div",Xt,[(a(!0),c(P,null,U(d.value,k=>(a(),$(J,{key:k.attributes.vhost_id,"model-value":g[k.attributes.vhost_id]??!1,disabled:u.isRestoring,label:`${k.attributes.vhost_name}'s files`,class:"border border-border","onUpdate:modelValue":z=>g[k.attributes.vhost_id]=z},{icon:j(()=>[(a(),$(V(s(se)),{class:"text-primary flex-shrink-0"}))]),_:1},8,["model-value","disabled","label","onUpdate:modelValue"]))),128))])])):N("",!0),f.value.length>0?(a(),c("div",es,[e("h3",ts,l(s(t)("backupRestore.restoreOptions.selectContent.databases.title")),1),e("div",ss,[(a(!0),c(P,null,U(f.value,k=>(a(),$(J,{key:k.attributes.database_id,"model-value":T[k.attributes.database_id]??!1,disabled:u.isRestoring,label:k.attributes.database_name,class:"flex-1 border border-border","onUpdate:modelValue":z=>T[k.attributes.database_id]=z},{icon:j(()=>[(a(),$(V(s(ae)),{class:"text-primary flex-shrink-0"}))]),chip:j(()=>[e("span",as,l(Y(k.attributes.size)),1)]),_:2},1032,["model-value","disabled","label","onUpdate:modelValue"]))),128))])])):N("",!0),e("div",os,[(a(),$(V(s(W)),{class:"text-secondary shrink-0 w-4 h-4"})),e("span",ls,l(s(t)("backupRestore.restoreOptions.selectContent.warning")),1)])]),w[5]||(w[5]=e("div",{class:"w-full h-px bg-border"},null,-1)),e("div",rs,[e("h2",ns,l(s(t)("backupRestore.restoreOptions.restoreMode.title")),1),e("div",is,[S(re,{modelValue:x.value,"onUpdate:modelValue":w[0]||(w[0]=k=>x.value=k),value:"overwrite",disabled:u.isRestoring,label:s(t)("backupRestore.restoreOptions.restoreMode.overwrite"),class:"border border-border"},{info:j(()=>[S(Q,{content:s(t)("backupRestore.restoreOptions.restoreMode.overwriteTooltip")},{default:j(()=>[(a(),$(V(s(W)),{class:"text-neutral flex-shrink-0 w-4 h-4"}))]),_:1},8,["content"])]),_:1},8,["modelValue","disabled","label"]),S(re,{modelValue:x.value,"onUpdate:modelValue":w[1]||(w[1]=k=>x.value=k),value:"export",disabled:u.isRestoring,label:s(t)("backupRestore.restoreOptions.restoreMode.copy"),class:"border border-border"},{info:j(()=>[S(Q,{content:s(t)("backupRestore.restoreOptions.restoreMode.copyTooltip")},{default:j(()=>[(a(),$(V(s(W)),{class:"text-neutral flex-shrink-0 w-4 h-4"}))]),_:1},8,["content"])]),_:1},8,["modelValue","disabled","label"])])]),e("div",cs,[e("div",null,[S(q,{variant:"primary",size:"xl",loading:u.isRestoring,disabled:!v.value.length&&!D.value.length,text:O.value,onClick:w[2]||(w[2]=k=>M.value=!0)},null,8,["loading","disabled","text"])]),u.isRestoring?(a(),c("p",us,l(s(t)("backupRestore.restoreOptions.restoreRunning")),1)):N("",!0)]),S(Gt,{open:M.value,"onUpdate:open":w[3]||(w[3]=k=>M.value=k),"selected-date":u.selectedDate,"selected-time":u.selectedTime,"selected-vhosts":v.value,"selected-databases":D.value,"restore-mode":x.value,onConfirm:A},null,8,["open","selected-date","selected-time","selected-vhosts","selected-databases","restore-mode"])]))}});function ps(){const u=R(1),m=R(0),t=R(15),r=R(1);function B(d){u.value=d.current_page,m.value=d.total,t.value=d.per_page,r.value=d.last_page}return{currentPage:u,totalRecords:m,perPage:t,lastPage:r,setPaginationMeta:B}}function ms(u,m,t={}){let r=null;async function B(){await u(),t.while&&!t.while()&&f()}function d(){r||(r=setInterval(B,m))}function f(){r&&(clearInterval(r),r=null)}return pe(f),{start:d,stop:f}}const fs=["onClick"],bs={key:0,class:"flex items-center gap-2 pl-2"},xs={class:"text-16 text-primary"},vs={key:1,class:"text-16 text-primary"},hs={key:0,class:"text-primary"},gs=15e3,_s=Z({__name:"BackupRestoreTable",props:{envId:{}},setup(u,{expose:m}){const t=u,{t:r}=L({useScope:"global"});ue();const B={completed:"text-enable-bright",failed:"text-danger",in_progress:"text-primary",pending:"text-primary",queued:"text-primary"},d={failed:5,in_progress:4,pending:3,queued:2,completed:1};function f(b){return b.reduce((C,i)=>{const p=i.attributes.status;return d[p]>d[C]?p:C},b[0].attributes.status)}const g=[{key:"restorePoint",title:r("backupRestore.overview.table.dateAndTime"),dataIndex:"completedAt",className:"whitespace-nowrap"},{key:"restoredFrom",title:r("backupRestore.overview.table.restoredFrom"),dataIndex:"restoredFrom",className:"whitespace-nowrap"},{key:"initiatedBy",title:r("backupRestore.overview.table.user"),dataIndex:"initiatedBy",className:"whitespace-nowrap"},{key:"type",title:r("backupRestore.overview.table.type"),dataIndex:"mode"},{key:"status",title:r("backupRestore.overview.table.status"),dataIndex:"status"}],T={showExpandColumn:!1},v={};function D(b,C){v[b]=C}const x=b=>b.isChild?{}:{onClick:C=>v[b.id]?.(b,C),style:"cursor: pointer"};function M(b){return b.attributes.type==="site"?b.attributes.vhost_name:b.attributes.database_name}function I(b){const C=new Map;for(const i of b){const{batch:p}=i.attributes;
1C.has(p)||C.set(p,[]),C.get(p).push(i)}return[...C.entries()].sort(([i],[p])=>p-i).map(([i,p])=>{const F=p[0],K=p.map(G=>({id:`batch-${i}-child-${G.id}`,isChild:!0,mainType:G.attributes.type==="site"?"file":"db",mainName:M(G),initiatedBy:"",status:G.attributes.status,completedAt:"",restoredFrom:"",mode:null}));return{id:`batch-${i}`,isChild:!1,mainType:"db",mainName:"",initiatedBy:F.attributes.initiator_name,status:f(p),completedAt:F.attributes.created_at?le(F.attributes.created_at):"—",restoredFrom:F.attributes.backup_name?le(F.attributes.backup_name):"—",mode:F.attributes.mode,children:K}})}const O=R([]),Y=R(!1),{currentPage:A,totalRecords:_,perPage:w,lastPage:k,setPaginationMeta:z}=ps(),E=h(()=>I(O.value)),o=h(()=>O.value.some(b=>b.attributes.status==="pending"||b.attributes.status==="in_progress")),n=ms(()=>y(A.value,{silent:!0}),gs,{while:()=>o.value});async function y(b=1,C={}){if(t.envId){C.silent||(Y.value=!0);try{const i=await new X().getBackupHistory(t.envId,b);O.value=i?.data??[],i?.meta&&z(i.meta)}catch(i){ee(i.response)}finally{C.silent||(Y.value=!1)}}}return ne(async()=>{await y(),o.value&&n.start()}),m({fetchHistory:y,hasActiveRestore:o,startActiveRestorePolling:n.start}),(b,C)=>(a(),c(P,null,[S(ye,{columns:g,data:E.value,expandable:T,loading:Y.value,striped:!1,"custom-row":x},{expandIcon:j(({onExpand:i,expanded:p,record:F})=>[e("span",{ref:()=>D(F.id,i),class:"shrink-0 inline-flex pr-3",onClick:me(K=>i(F,K),["stop"])},[F.children?.length?(a(),$(V(s(te)),{key:0,width:"16",height:"16",class:H(["block text-primary transition-transform duration-200",p?"rotate-90":"rotate-0"])},null,8,["class"])):N("",!0)],8,fs)]),bodyCell:j(({column:i,record:p})=>[i.key==="restorePoint"?(a(),c(P,{key:0},[p.isChild?(a(),c("span",bs,[(a(),$(V(p.mainType==="file"?s(se):s(ae)),{class:"text-primary flex-shrink-0"})),e("span",xs,l(p.mainName),1)])):(a(),c("span",vs,l(p.completedAt),1))],64)):i.key==="type"?(a(),c(P,{key:1},[!p.isChild&&p.mode?(a(),c("span",hs,l(s(r)(`backupRestore.overview.mode.${p.mode}`)),1)):N("",!0)],64)):i.key==="status"?(a(),c("span",{key:2,class:H(["capitalize",B[p.status]])},l(s(r)(`backupRestore.overview.status.${p.status}`)),3)):N("",!0)]),_:1},8,["data","loading"]),S(we,{current:s(A),total:s(_),"page-size":s(w),"last-page":s(k),onChange:y},null,8,["current","total","page-size","last-page"])],64))}}),ks={class:"flex flex-col gap-9"},ys={key:0,class:"flex items-center bg-beige gap-3 px-4 py-4 rounded-[5px]"},ws={class:"text-[20px] font-normal text-primary"},Ds={class:"flex flex-col"},Rs={class:"text-[32px] font-normal text-primary"},$s={class:"text-14 text-neutral"},Cs={class:"border border-border rounded-base p-6 flex flex-col gap-9 bg-background"},Ts={class:"flex flex-col gap-6"},Ms={class:"flex flex-col"},Ss={class:"text-[24px] font-normal text-primary"},Bs={class:"text-14 text-neutral"},Is={class:"flex flex-col lg:flex-row gap-6"},Fs={class:"border border-border rounded-base p-6 flex flex-col gap-6 bg-background"},Vs={class:"text-[24px] font-normal text-primary"},sa=Z({__name:"BackupRestore",setup(u){const{t:m}=L({useScope:"global"}),t=be();ue();const r=h(()=>Number(t.params.envId)),B=h(()=>t.params.boltId),d=R([]),f=R(!1),g=R({}),T=R(!0),v=R(null),D=R(null),x=R(null),M=R(!1),I=fe("backupRestoreTable"),O=h(()=>M.value||(I.value?.hasActiveRestore??!1)),Y=h(()=>!!v.value&&!!D.value),A=h(()=>x.value?g.value[x.value]??[]:[]);async function _(){f.value=!0;try{const o=await new _e().get(B.value,ke()),y=(o.getData().relationships.environments??[]).find(b=>Number(b.id)===r.value);d.value=[{name:m("bolts"),route:{name:"bolts"}},{name:o.name(),route:{name:"specific-bolt",params:{boltId:o.id()}}},{name:y?.attributes.title??"",route:{name:"environments.specific-wrapper",params:{envId:r.value}}}]}catch{}finally{f.value=!1}}async function w(){if(r.value){T.value=!0;try{const o=await new X().getBackupBulks(r.value);g.value=o??{}}catch(o){ee(o.response)}finally{T.value=!1}}}function k(o){(!v.value||v.value.toDateString()!==o.toDateString())&&
1(D.value=null,x.value=null),v.value=o}function z(o){D.value=o,x.value=o}async function E(o){M.value=!0;const n={data:{attributes:{mode:o.mode,onlyDatabase:!o.vhostIds.length,databaseIds:o.databaseIds,compress:o.compress}}};try{await new X().restoreBackup(r.value,x.value,n),D.value=null,x.value=null,await I.value?.fetchHistory(),I.value?.startActiveRestorePolling()}catch(y){ee(y.response)}finally{M.value=!1}}return ne(()=>{_(),w()}),(o,n)=>(a(),c("div",ks,[S(xe,{items:d.value,loading:f.value,count:3},null,8,["items","loading"]),O.value?(a(),c("div",ys,[(a(),$(V(s(ce)),{class:"text-secondary flex-shrink-0"})),e("span",ws,l(s(m)("backupRestore.correlationStatus")),1)])):N("",!0),e("div",Ds,[e("h1",Rs,l(s(m)("backupRestore.pageTitle")),1),e("p",$s,l(s(m)("backupRestore.pageDescription")),1)]),e("div",Cs,[e("div",Ts,[e("div",Ms,[e("h2",Ss,l(s(m)("backupRestore.selectBackup.title")),1),e("p",Bs,l(s(m)("backupRestore.selectBackup.description")),1)]),e("div",Is,[S(Ve,{"selected-date":v.value,disabled:O.value||T.value,backups:g.value,onSelect:k},null,8,["selected-date","disabled","backups"]),S(Qe,{"selected-date":v.value,"selected-time":D.value,disabled:O.value||T.value,backups:g.value,onSelectTime:z},null,8,["selected-date","selected-time","disabled","backups"])])]),Y.value?(a(),$(ds,{key:x.value,"selected-date":v.value,"selected-time":D.value,"is-restoring":O.value,"backup-entries":A.value,onStartRestore:E},null,8,["selected-date","selected-time","is-restoring","backup-entries"])):N("",!0)]),e("div",Fs,[e("h2",Vs,l(s(m)("backupRestore.overview.title")),1),S(_s,{ref_key:"backupRestoreTable",ref:I,"env-id":r.value},null,8,["env-id"])])]))}});export{sa as default};
2//# sourceMappingURL=BackupRestore-DUNpaKzA.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.