mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
working on restore form.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import {PageParams} from "@/types/next";
|
||||
import {Page, PageContent, PageDescription, PageHeader, PageTitle} from "@/features/layout/page";
|
||||
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
||||
import {AgentForm} from "@/components/wrappers/Agent/AgentForm/AgentForm";
|
||||
import {requiredCurrentUser} from "@/auth/current-user";
|
||||
import {prisma} from "@/prisma";
|
||||
@@ -9,14 +9,17 @@ import {notFound} from "next/navigation";
|
||||
export default async function RoutePage(props: PageParams<{
|
||||
agentId: string;
|
||||
}>) {
|
||||
|
||||
const {agentId} = await props.params
|
||||
|
||||
const user = await requiredCurrentUser()
|
||||
const agent = await prisma.agent.findUnique({
|
||||
where: {
|
||||
id: props.params.agentId,
|
||||
id: agentId,
|
||||
}
|
||||
});
|
||||
|
||||
if (!agent){
|
||||
if (!agent) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
|
||||
@@ -13,9 +13,11 @@ import Link from "next/link";
|
||||
|
||||
export default async function RoutePage(props: PageParams<{ agentId: string }>) {
|
||||
|
||||
const {agentId} = await props.params
|
||||
|
||||
const agent = await prisma.agent.findUnique({
|
||||
where: {
|
||||
id: props.params.agentId,
|
||||
id: agentId,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -112,7 +114,7 @@ export default async function RoutePage(props: PageParams<{ agentId: string }>)
|
||||
Last contact
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{agent.lastContact?.toDateString() ?? "Never connected"}
|
||||
{agent.lastContact?.toDateString() ?? "Never connected."}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
@@ -4,6 +4,7 @@ import {AgentForm} from "@/components/wrappers/Agent/AgentForm/AgentForm";
|
||||
|
||||
|
||||
export default async function RoutePage(props: PageParams<{}>) {
|
||||
|
||||
return (
|
||||
<Page>
|
||||
<PageHeader>
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
import {PageParams} from "@/types/next";
|
||||
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
||||
import {requiredCurrentUser} from "@/auth/current-user";
|
||||
import {prisma} from "@/prisma";
|
||||
import {notFound} from "next/navigation";
|
||||
import {RestoreForm} from "@/components/wrappers/Database/RestoreForm";
|
||||
|
||||
|
||||
export default async function RoutePage(props: PageParams<{
|
||||
databaseId: string;
|
||||
}>) {
|
||||
|
||||
const {databaseId} = await props.params
|
||||
|
||||
|
||||
const user = await requiredCurrentUser()
|
||||
|
||||
const database = await prisma.database.findUnique({
|
||||
where: {
|
||||
id: databaseId,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
const databases = await prisma.database.findMany({
|
||||
where: {
|
||||
dbms: database.dbms,
|
||||
}
|
||||
})
|
||||
|
||||
const backups = await prisma.backup.findMany({
|
||||
where: {
|
||||
status: "success",
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
if (!database) {
|
||||
notFound();
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<Page>
|
||||
<PageHeader>
|
||||
<PageTitle>
|
||||
Restore {database.name}
|
||||
</PageTitle>
|
||||
</PageHeader>
|
||||
<PageContent>
|
||||
<RestoreForm databaseToRestore={database} databases={databases} backups={backups}/>
|
||||
</PageContent>
|
||||
</Page>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user