(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1654],{7508:(e,a,s)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/admin/[user_id]/su/backups",function(){return s(2235)}])},5501:(e,a,s)=>{"use strict";s.d(a,{A:()=>t});let t=(0,s(5737).A)("FolderSync",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5",key:"1dkoa9"}],["path",{d:"M12 10v4h4",key:"1czhmt"}],["path",{d:"m12 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"lvuxfi"}],["path",{d:"M22 22v-4h-4",key:"1ewp4q"}],["path",{d:"m22 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"14ync0"}]])},2235:(e,a,s)=>{"use strict";s.r(a),s.d(a,{__N_SSP:()=>p,default:()=>h});var t=s(4848),n=s(6540),c=s(4725),r=s(9020),i=s(1710),u=s(5501),l=s(3430);function d(){let e=n.useContext(l.AppContext).user,[a,s]=n.useState(!1),[c,d]=n.useState([]),[p,h]=n.useState(0);return n.useEffect(()=>{(0,r.A)("/api/admin/grabBackups").then(e=>{d(e.backups)})},[p]),(0,t.jsxs)(n.Fragment,{children:[a&&(0,t.jsx)(i.A,{}),(0,t.jsxs)("div",{className:"w-full justify-between",children:[(0,t.jsx)("h2",{className:"text-xl m-0",children:"Backups"}),(0,t.jsx)("div",{children:(0,t.jsx)("button",{onClick:e=>{window.confirm("Create new backup?")&&(s(!0),(0,r.A)("/api/admin/createNewBackup").then(e=>{h(e=>e+1),setTimeout(()=>{s(!1)},2e3)}))},className:"relative",children:"Create New Backup"})})]}),(0,t.jsxs)("section",{className:c&&c[0]?"p-0 gap-4":"paper",children:[!c&&(0,t.jsx)(i.A,{}),c&&c[0]&&c.sort((e,a)=>parseInt(e)>parseInt(a)?-1:1).map((a,s)=>{let n=new Date(parseInt(a));return(0,t.jsxs)("a",{href:"/admin/".concat(null==e?void 0:e.id,"/backups/").concat(a),className:"card w-full items-center",children:[(0,t.jsx)(u.A,{}),(0,t.jsx)("b",{children:"Backup:"}),(0,t.jsx)("span",{children:n.toString()})]},a)}),c&&!c[0]&&(0,t.jsx)("span",{children:"No Backups Yet"})]})]})}var p=!0;function h(e){let{user:a,data:s}=e,n=(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("title",{children:"Backups | Datasquirel"}),(0,t.jsx)("meta",{name:"description",content:"Databases backups"})]});return(0,t.jsx)(c.A,{head:n,children:(0,t.jsx)(d,{})})}}},e=>{var a=a=>e(e.s=a);e.O(0,[1335,3348,4725,636,6593,8792],()=>a(7508)),_N_E=e.O()}]);