mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
adding organization feature.
This commit is contained in:
@@ -13,6 +13,7 @@ import {AgentModalKey} from "@/components/wrappers/Agent/AgentModalKey/AgentModa
|
||||
import {KeyRound} from "lucide-react";
|
||||
import {BackupButton} from "@/components/wrappers/BackupButton/BackupButton";
|
||||
import {backups, restaurations} from "@/utils/mock-data";
|
||||
import {formatDateLastContact} from "@/utils/date-formatting";
|
||||
|
||||
|
||||
export default async function RoutePage(props: PageParams<{ agentId: string }>) {
|
||||
@@ -85,7 +86,7 @@ export default async function RoutePage(props: PageParams<{ agentId: string }>)
|
||||
Last contact
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
{agent.lastContact?.toDateString() ?? "Never connected."}
|
||||
{formatDateLastContact(agent.lastContact)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
|
||||
@@ -6,9 +6,11 @@ import {Button} from "@/components/ui/button";
|
||||
import Link from 'next/link'
|
||||
import {Page, PageActions, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
||||
|
||||
|
||||
export default async function RoutePage(props: PageParams<{}>) {
|
||||
|
||||
const agents = await prisma.agent.findMany({})
|
||||
|
||||
return (
|
||||
<Page>
|
||||
<PageHeader>
|
||||
|
||||
@@ -6,6 +6,7 @@ import {AppSidebar} from "@/components/wrappers/Dashboard/SideBar/app-sidebar";
|
||||
import {currentUser} from "@/auth/current-user";
|
||||
import {Header} from "@/features/layout/Header";
|
||||
import {prisma} from "@/prisma";
|
||||
import {GlobalStoreProvider} from "@/state-management/provider";
|
||||
|
||||
|
||||
export default async function Layout({children}: { children: React.ReactNode }) {
|
||||
@@ -22,16 +23,20 @@ export default async function Layout({children}: { children: React.ReactNode })
|
||||
if (!user) redirect('/login')
|
||||
|
||||
return (
|
||||
<SidebarProvider>
|
||||
<div className="flex flex-col lg:flex-row w-full">
|
||||
<AppSidebar/>
|
||||
<SidebarInset>
|
||||
<Header/>
|
||||
<main className="h-full">
|
||||
{children}
|
||||
</main>
|
||||
</SidebarInset>
|
||||
</div>
|
||||
</SidebarProvider>
|
||||
// <HydrationZustand>
|
||||
<GlobalStoreProvider>
|
||||
<SidebarProvider>
|
||||
<div className="flex flex-col lg:flex-row w-full">
|
||||
<AppSidebar/>
|
||||
<SidebarInset>
|
||||
<Header/>
|
||||
<main className="h-full">
|
||||
{children}
|
||||
</main>
|
||||
</SidebarInset>
|
||||
</div>
|
||||
</SidebarProvider>
|
||||
</GlobalStoreProvider>
|
||||
// </HydrationZustand>
|
||||
)
|
||||
}
|
||||
@@ -32,10 +32,13 @@ export default async function RoutePage(props: PageParams<{
|
||||
const availableDatabases = await prisma.database.findMany({
|
||||
where: {
|
||||
OR: [
|
||||
{ projectId: null },
|
||||
{ projectId: project.id },
|
||||
{projectId: null},
|
||||
{projectId: project.id},
|
||||
],
|
||||
},
|
||||
include: {
|
||||
agent: {}
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'desc',
|
||||
},
|
||||
@@ -50,7 +53,8 @@ export default async function RoutePage(props: PageParams<{
|
||||
</PageTitle>
|
||||
</PageHeader>
|
||||
<PageContent>
|
||||
<ProjectForm organization={organization} databases={availableDatabases} defaultValues={project} projectId={project.id}/>
|
||||
<ProjectForm organization={organization} databases={availableDatabases} defaultValues={project}
|
||||
projectId={project.id}/>
|
||||
</PageContent>
|
||||
</Page>
|
||||
)
|
||||
|
||||
@@ -10,6 +10,9 @@ export default async function RoutePage(props: PageParams<{}>) {
|
||||
where: {
|
||||
projectId: null
|
||||
},
|
||||
include: {
|
||||
agent: {}
|
||||
},
|
||||
orderBy: {
|
||||
createdAt: 'desc',
|
||||
},
|
||||
|
||||
@@ -5,17 +5,28 @@ import {Button} from "@/components/ui/button";
|
||||
import Link from 'next/link'
|
||||
import {Page, PageActions, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
|
||||
import {ProjectCard} from "@/components/wrappers/Dashboard/Projects/ProjectCard/ProjectCard";
|
||||
import {requiredCurrentUser} from "@/auth/current-user";
|
||||
|
||||
export default async function RoutePage(props: PageParams<{}>) {
|
||||
|
||||
// const {searchParams} = props
|
||||
// const organizationId = searchParams?.organizationId || "default";
|
||||
|
||||
const user = await requiredCurrentUser()
|
||||
|
||||
const projects = await prisma.project.findMany({
|
||||
where: {
|
||||
organization: {
|
||||
slug: "default",
|
||||
// id: organizationId,
|
||||
users: {
|
||||
some: {
|
||||
userId: user.id
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
include:{
|
||||
include: {
|
||||
databases: {}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
// import {NextResponse} from "next/server";
|
||||
// import {useStore} from "@/state-management/store";
|
||||
//
|
||||
// export function middleware(req) {
|
||||
// // const organizationId = req.cookies.get("organizationId") || "default"; // Retrieve from cookies
|
||||
// const url = req.nextUrl.clone();
|
||||
// const {organizationId, moveToAnotherOrganization} = useStore((state) => state);
|
||||
// console.log("middlewaressss", organizationId);
|
||||
// // url.searchParams.set("organizationId", organizationId); // Append to query string
|
||||
// return NextResponse.rewrite(url);
|
||||
// }
|
||||
Reference in New Issue
Block a user