PageSourceSearch

https://bowtiesports.com/assets/BackupManagement--ZzlT5z8.js

js bowtiesports.com collected 2026-10-07 02:28:52 UTC 7,286 bytes, 1 lines download raw bytes

1import{j as e}from"./react-vendor-DUhHROXo.js";import{P as v}from"./PortalLayout-BUxGSFei.js";import{C as o,b as m,c as n,a as d,d as C}from"./card-9IoFUltb.js";import{w as B,_ as D,J as k,o as p,a5 as w}from"./index-BLtzf0SR.js";import{B as M}from"./badge-BsE4KYIf.js";import{u as z}from"./useMutation-BXp6BKyU.js";import{s as x}from"./client-DTel1CZI.js";import{u as j}from"./index-Cx0UdoxP.js";import{D as c}from"./ticket-l9bl0kcm.js";import{C as f}from"./clock-DK72Hop1.js";import{H as g}from"./hard-drive-D3lPRAhw.js";import{D as F}from"./download-DFEQ6r6X.js";import{C as q}from"./circle-check-big-DjewDTKr.js";import{C as P}from"./circle-alert-C1akQxLN.js";import{f as u}from"./format-DGzj7MEM.js";import"./AdminLayout-4AAuHeAU.js";import"./router-vendor-Dz9PdDzH.js";import"./NavLink-CsyG-eHO.js";import"./scroll-area-BdyOmc9o.js";import"./index-BdQq_4o_.js";import"./collapsible-BAD8kbtc.js";import"./index-CMI-ZfmW.js";import"./arrow-left-CRb8P6iH.js";import"./globe-CQ83QW2m.js";import"./users-CIwSfVhi.js";import"./activity-CwFToTs3.js";import"./list-todo-BR3jv1RJ.js";import"./calendar-BDETTnfZ.js";import"./users-round-CCw5yxW7.js";import"./radio-BQgeDg5T.js";import"./clapperboard-BvstouST.js";import"./clipboard-list-CQJ-vJ2y.js";import"./image-arBWrt3y.js";import"./folder-open-CIWhCFhy.js";import"./pencil-C2cyk8cg.js";import"./message-square-BDdDilNB.js";import"./megaphone-DpQsxotQ.js";import"./package-DKB1lvtO.js";import"./circle-user-BeB3uaA1.js";import"./folder-kanban-B8jlMC6s.js";import"./settings-Baim_Eei.js";import"./briefcase-CdSp4ViD.js";import"./chart-line-ohAz7u_s.js";import"./HostOwnerLayout-PM2-LrXf.js";import"./layers-CvbkNa7J.js";import"./dollar-sign-D3lTBfQm.js";import"./en-US-Bfz1jvxT.js";import"./differenceInCalendarDays-D4nmWE3G.js";import"./getTimezoneOffsetInMilliseconds-DsfBWtEI.js";const $={pending:{icon:f,color:"bg-yellow-500/10 text-yellow-600",label:"Pending"},in_progress:{icon:w,color:"bg-blue-500/10 text-blue-600",label:"In Progress"},completed:{icon:q,color:"bg-green-500/10 text-green-600",label:"Completed"},failed:{icon:P,color:"bg-red-500/10 text-red-600",label:"Failed"}},N=r=>r?r<1024?`${r} B`:r<1024*1024?`${(r/1024).toFixed(1)} KB`:`${(r/(1024*1024)).toFixed(1)} MB`:"-";function ze(){const{user:r}=B(),h=D(),{data:a,isLoading:y}=k({queryKey:["backup-logs"],queryFn:async()=>{const{data:s,error:t}=await x.from("backup_logs").select("*").order("started_at",{ascending:!1});if(t)throw t;return s}}),i=z({mutationFn:async()=>{const{data:s,error:t}=await x.from("backup_logs").insert({user_id:r==null?void 0:r.id,backup_type:"manual",status:"pending",tables_included:["profiles","articles","podcast_episodes","videos","fan_court_submissions"]}).select().single();if(t)throw t;return setTimeout(async()=>{await x.from("backup_logs").update({status:"completed",completed_at:new Date().toISOString(),file_size:Math.floor(Math.random()*1e7)}).eq("id",s.id),h.invalidateQueries({queryKey:["backup-logs"]})},3e3),s},onSuccess:()=>{h.invalidateQueries({queryKey:["backup-logs"]}),j.success("Backup started")},onError:()=>j.error("Failed to start backup")}),b=(a==null?void 0:a.filter(s=>s.status==="completed").length)||0,l=a==null?void 0:a.find(s=>s.status==="completed");return e.jsx(v,{children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-3xl font-display font-bold",children:"Backups"}),e.jsx("p",{className:"text-muted-foreground",children:"Database backup management"})]}),e.jsxs(p,{onClick:()=>i.mutate(),disabled:i.isPending,children:[i.isPending?e.jsx(w,{className:"h-4 w-4 mr-2 animate-spin"}):e.jsx(c,{className:"h-4 w-4 mr-2"}),"Create Backup"]})]}),e.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[e.jsxs(o,{children:[e.jsxs(m,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(n,{className:"text-sm font-medium",children:"Total Backups"}),e.jsx(c,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(d,{children:e.jsx("div",{className:"text-2xl font-bold",children:b})})]}),e.jsxs(o,{children:[e.jsxs(m,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(n,{className:"text-sm font-medium",children:"Last Backup"}),e.jsx(f,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsxs(d,{children:[e.jsx("div",{className:"text-2xl font-bold",children:l?u(new Date(l.completed_at),"MMM d"):"Never"}),l&&e.jsx("p",{className:"text-xs text-muted-foreground",children:u(new Date(l.completed_at),"h:mm a")})]})]}),e.jsxs(o,{children:[e.jsxs(m,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[e.jsx(n,{className:"text-sm font-medium",children:"Total Size"}),e.jsx(g,{className:"h-4 w-4 text-muted-foreground"})]}),e.jsx(d,{children:e.jsx("div",{className:"text-2xl font-bold",children:N((a==null?void 0:a.filter(s=>s.status==="completed").reduce((s,t)=>s+(t.file_size||0),0))||0)})})]})]}),e.jsxs(o,{children:[e.jsxs(m,{children:[e.jsx(n,{children:"Backup History"}),e.jsx(C,{children:"All database backups"})]}),e.jsx(d,{children:y?e.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>e.jsxs("div",{className:"flex items-center gap-4 animate-pulse",children:[e.jsx("div",{className:"h-10 w-10 bg-muted rounded-full"}),e.jsxs("div",{className:"flex-1",children:[e.jsx("div",{className:"h-4 bg-muted rounded w-1/2 mb-2"}),e.jsx("div",{className:"h-3 bg-muted rounded w-1/4"})]})]},s))}):a&&a.length>0?e.jsx("div",{className:"space-y-4",children:a.map(s=>{const t=$[s.status],_=t.icon;return e.jsxs("div",{className:"flex items-center gap-4 p-4 border rounded-lg",children:[e.jsx("div",{className:`p-2 rounded-full ${t.color.split(" ")[0]}`,children:e.jsx(_,{className:`h-5 w-5 ${s.status==="in_progress"?"animate-spin":""} ${t.color.split(" ")[1]}`})}),e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs("span",{className:"font-medium capitalize",children:[s.backup_type," Backup"]}),e.jsx(M,{className:t.color,children:t.label})]}),e.jsxs("div",{className:"flex items-center gap-3 mt-1 text-sm text-muted-foreground",children:[e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(f,{className:"h-3 w-3"}),u(new Date(s.started_at),"MMM d, yyyy h:mm a")]}),s.file_size&&e.jsxs("span",{className:"flex items-center gap-1",children:[e.jsx(g,{className:"h-3 w-3"}),N(s.file_size)]}),s.tables_included&&e.jsxs("span",{children:[s.tables_included.length," tables"]})]}),s.error_message&&e.jsx("p",{className:"text-sm text-red-500 mt-1",children:s.error_message})]}),s.status==="completed"&&s.file_url&&e.jsx(p,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:s.file_url,download:!0,children:[e.jsx(F,{className:"h-4 w-4 mr-1"}),"Download"]})})]},s.id)})}):e.jsxs("div",{className:"text-center py-12",children:[e.jsx(c,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),e.jsx("h3",{className:"text-lg font-medium mb-2",children:"No backups yet"}),e.jsx("p",{className:"text-muted-foreground mb-4",children:"Create your first backup to protect your data"}),e.jsxs(p,{onClick:()=>i.mutate(),children:[e.jsx(c,{className:"h-4 w-4 mr-2"}),"Create Backup"]})]})})]})]})})}export{ze as default};

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.