diff --git a/app/panel/backups/[name]/page.tsx b/app/panel/backups/[name]/page.tsx new file mode 100644 index 0000000..af1e72d --- /dev/null +++ b/app/panel/backups/[name]/page.tsx @@ -0,0 +1,18 @@ +import { JsonCard } from "@/components/cards/JsonCard"; +import { Card, CardHeader, CardTitle } from "@/components/ui/card"; +import { fetchBackup } from "@/lib/actions" + +export default async function Report({ params }: { params: { name: string } }) { + const name = decodeURIComponent(params.name); + const backup = await fetchBackup(name); + + return <> + + + {name} + + +
+ + +} \ No newline at end of file diff --git a/app/panel/backups/page.tsx b/app/panel/backups/page.tsx new file mode 100644 index 0000000..556026a --- /dev/null +++ b/app/panel/backups/page.tsx @@ -0,0 +1,37 @@ +import { Button } from "@/components/ui/button"; +import { Card } from "@/components/ui/card"; +import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table"; +import { fetchBackups } from "@/lib/actions"; +import Link from "next/link"; + +export default async function Backups() { + const backups = await fetchBackups(); + + return ( + + + + + Name + Type + + + + {backups.map((backup) => ( + + {backup.name} + {backup.type} + + + + + + + ))} + +
+
+ ); +} diff --git a/components/common/NavigationLinks.tsx b/components/common/NavigationLinks.tsx index 3391961..20f21c8 100644 --- a/components/common/NavigationLinks.tsx +++ b/components/common/NavigationLinks.tsx @@ -1,6 +1,7 @@ import Link from "next/link"; import { buttonVariants } from "../ui/button"; import { + Bomb, Eye, Globe2, Home, @@ -38,6 +39,12 @@ export function NavigationLinks() { > + + + {/* file.isFile() && file.name.endsWith(".json")) + .map(async (file) => { + let type: string | null = null; + try { + type = JSON.parse((await readFile(`./exports/${file.name}`)).toString("utf-8"))._event; + } catch(e) {} + + return { name: file.name, type: type } + }) + ); +} + +export async function fetchBackup(name: string) { + await checkPermission("backup/fetch/by-name", null); + + return JSON.parse((await readFile(`./exports/${name}`)).toString("utf-8")); +}