Ready for release soon.

This commit is contained in:
charlesgauthereau
2025-07-17 09:28:57 +02:00
parent 7abdcd57f9
commit 4d52419247
18 changed files with 1779 additions and 3335 deletions
-934
View File
File diff suppressed because one or more lines are too long
-1
View File
@@ -1,3 +1,2 @@
nodeLinker: node-modules nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-4.6.0.cjs
+9
View File
@@ -6,6 +6,7 @@ import * as drizzleDb from "@/db";
import {db} from "@/db"; import {db} from "@/db";
import {EDbmsSchema} from "@/db/schema/types"; import {EDbmsSchema} from "@/db/schema/types";
import {eq} from "drizzle-orm"; import {eq} from "drizzle-orm";
import {isUuidv4} from "@/utils/verify-uuid";
export type databaseAgent = { export type databaseAgent = {
name: string, name: string,
@@ -34,6 +35,14 @@ export async function POST(
const body: Body = await request.json(); const body: Body = await request.json();
const lastContact = new Date(); const lastContact = new Date();
if (!isUuidv4(agentId)) {
return NextResponse.json(
{error: "agentId is not a valid uuid"},
{status: 500}
);
}
const agent = await db.query.agent.findFirst({ const agent = await db.query.agent.findFirst({
where: eq(drizzleDb.schemas.agent.id, agentId), where: eq(drizzleDb.schemas.agent.id, agentId),
+1 -1
View File
@@ -31,7 +31,7 @@ export async function GET(
{status: 403} {status: 403}
); );
} }
//@ts-ignore
const expiresAt = parseInt(expires, 10); const expiresAt = parseInt(expires, 10);
if (Date.now() > expiresAt) { if (Date.now() > expiresAt) {
return NextResponse.json( return NextResponse.json(
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Regular → Executable
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Executable
+3
View File
File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 90 KiB

Executable
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

+5 -2
View File
@@ -9,8 +9,8 @@ import { cn } from "@/lib/utils";
const inter = Inter({subsets: ["latin"]}); const inter = Inter({subsets: ["latin"]});
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Portabase", title: process.env.NEXT_PUBLIC_PROJECT_NAME ?? "App Title",
description: "Manage all your database instances from one place !", description: process.env.NEXT_PUBLIC_PROJECT_DESCRIPTION ?? undefined,
}; };
export default function RootLayout({ export default function RootLayout({
@@ -20,6 +20,9 @@ export default function RootLayout({
}>) { }>) {
return ( return (
<html lang="en" suppressHydrationWarning> <html lang="en" suppressHydrationWarning>
<head>
<meta name="apple-mobile-web-app-title" content="Portabase"/>
</head>
<body className={cn(inter.className, "h-full")}> <body className={cn(inter.className, "h-full")}>
<Providers>{children}</Providers> <Providers>{children}</Providers>
</body> </body>
+21
View File
@@ -0,0 +1,21 @@
{
"name": "Portabase",
"short_name": "Portabase",
"icons": [
{
"src": "/web-app-manifest-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/web-app-manifest-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
+1 -1
View File
@@ -1,6 +1,6 @@
FROM node:23.5.0-alpine AS base FROM node:23.5.0-alpine AS base
ENV YARN_VERSION=4.6.0 ENV YARN_VERSION=4.9.1
RUN apk add --no-cache libc6-compat RUN apk add --no-cache libc6-compat
RUN apk add --no-cache openssl RUN apk add --no-cache openssl
+2 -2
View File
@@ -3,7 +3,7 @@
"version": "1.1.0", "version": "1.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev -p 80", "dev": "next dev --turbopack -p 80",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"lint": "next lint", "lint": "next lint",
@@ -110,5 +110,5 @@
"typescript": "^5.8.3", "typescript": "^5.8.3",
"zenstack": "2.14.2" "zenstack": "2.14.2"
}, },
"packageManager": "yarn@4.8.1+sha512.bc946f2a022d7a1a38adfc15b36a66a3807a67629789496c3714dd1703d2e6c6b1c69ff9ec3b43141ac7a1dd853b7685638eb0074300386a59c18df351ef8ff6" "packageManager": "yarn@4.9.1"
} }
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

+33 -8
View File
@@ -19,10 +19,18 @@ export type comboBoxProps = {
onValueChange?: any; onValueChange?: any;
searchField?: boolean; searchField?: boolean;
sideBar?: boolean; sideBar?: boolean;
reload?: () => void;
}; };
export function ComboBox(props: comboBoxProps) { export function ComboBox(props: comboBoxProps) {
const { values: choices, defaultValue: defaultChoice = "", onValueChange, searchField = false, sideBar = false } = props; const {
values: choices,
defaultValue: defaultChoice = "",
onValueChange,
searchField = false,
sideBar = false
} = props;
const [value, setValue] = useState<string>(); const [value, setValue] = useState<string>();
@@ -31,8 +39,18 @@ export function ComboBox(props: comboBoxProps) {
}, [defaultChoice]); }, [defaultChoice]);
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const [openModal, setOpenModal] = useState(false);
return ( return (
<div>
<CreateOrganizationModal
open={openModal}
onSuccess={() => {
props.reload?.();
}}
onOpenChange={setOpenModal}
/>
<Popover open={open} onOpenChange={setOpen}> <Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild> <PopoverTrigger asChild>
{sideBar ? ( {sideBar ? (
@@ -41,7 +59,8 @@ export function ComboBox(props: comboBoxProps) {
<ChevronDown className="ml-auto"/> <ChevronDown className="ml-auto"/>
</SidebarMenuButton> </SidebarMenuButton>
) : ( ) : (
<Button variant="outline" role="combobox" aria-expanded={open} className="w-full justify-between"> <Button variant="outline" role="combobox" aria-expanded={open}
className="w-full justify-between">
{value ? choices.find((choice) => choice.value === value)?.label : "Select choice..."} {value ? choices.find((choice) => choice.value === value)?.label : "Select choice..."}
<ChevronDown className="opacity-50"/> <ChevronDown className="opacity-50"/>
</Button> </Button>
@@ -64,7 +83,8 @@ export function ComboBox(props: comboBoxProps) {
}} }}
> >
{choice.label} {choice.label}
<Check className={cn("ml-auto", value === choice.value ? "opacity-100" : "opacity-0")} /> <Check
className={cn("ml-auto", value === choice.value ? "opacity-100" : "opacity-0")}/>
</CommandItem> </CommandItem>
))} ))}
</CommandGroup> </CommandGroup>
@@ -72,12 +92,15 @@ export function ComboBox(props: comboBoxProps) {
</Command> </Command>
<Separator/> <Separator/>
{sideBar ? ( {sideBar ? (
<CreateOrganizationModal> <SidebarMenuButton onClick={() => {
<SidebarMenuButton>+ Create new organization</SidebarMenuButton> setOpen(false)
</CreateOrganizationModal> setOpenModal(true)
}
}>+ Create new organization</SidebarMenuButton>
) : null} ) : null}
</PopoverContent> </PopoverContent>
</Popover> </Popover>
</div>
); );
} }
@@ -97,7 +120,8 @@ export function ComboBoxFormItem(props: comboBoxFormItemProps) {
<Popover open={open} onOpenChange={setOpen}> <Popover open={open} onOpenChange={setOpen}>
<PopoverTrigger asChild> <PopoverTrigger asChild>
<FormControl> <FormControl>
<Button variant="outline" role="combobox" aria-expanded={open} className={cn("w-full justify-between", !value && "text-muted-foreground")}> <Button variant="outline" role="combobox" aria-expanded={open}
className={cn("w-full justify-between", !value && "text-muted-foreground")}>
{value ? choices.find((choice) => choice.value === value)?.label : `Select ${name}`} {value ? choices.find((choice) => choice.value === value)?.label : `Select ${name}`}
<ChevronDown className="opacity-50"/> <ChevronDown className="opacity-50"/>
</Button> </Button>
@@ -119,7 +143,8 @@ export function ComboBoxFormItem(props: comboBoxFormItemProps) {
}} }}
> >
{choice.label} {choice.label}
<Check className={cn("ml-auto", choice.value === value ? "opacity-100" : "opacity-0")} /> <Check
className={cn("ml-auto", choice.value === value ? "opacity-100" : "opacity-0")}/>
</CommandItem> </CommandItem>
))} ))}
</CommandGroup> </CommandGroup>
@@ -2,7 +2,7 @@
import {useMutation} from "@tanstack/react-query"; import {useMutation} from "@tanstack/react-query";
import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "@/components/ui/dialog"; import {Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle} from "@/components/ui/dialog";
import {Button} from "@/components/ui/button"; import {Button} from "@/components/ui/button";
import {Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm} from "@/components/ui/form"; import {Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm} from "@/components/ui/form";
import {Input} from "@/components/ui/input"; import {Input} from "@/components/ui/input";
@@ -13,13 +13,14 @@ import { useState } from "react";
import {authClient} from "@/lib/auth/auth-client"; import {authClient} from "@/lib/auth/auth-client";
export type createOrganizationModalProps = { export type createOrganizationModalProps = {
children: any; open: boolean;
onOpenChange: (open: boolean) => void;
onSuccess?: () => void;
}; };
export function CreateOrganizationModal(props: createOrganizationModalProps) { export function CreateOrganizationModal({open, onOpenChange, onSuccess}: createOrganizationModalProps) {
const [open, setOpen] = useState(false);
const { children } = props;
const router = useRouter(); const router = useRouter();
@@ -27,6 +28,7 @@ export function CreateOrganizationModal(props: createOrganizationModalProps) {
schema: OrganizationSchema, schema: OrganizationSchema,
}); });
const mutation = useMutation({ const mutation = useMutation({
mutationFn: async (values: OrganizationSchema) => { mutationFn: async (values: OrganizationSchema) => {
console.log(values); console.log(values);
@@ -35,18 +37,18 @@ export function CreateOrganizationModal(props: createOrganizationModalProps) {
if (result && result.data) { if (result && result.data) {
if (result.data.success && result.data.value) { if (result.data.success && result.data.value) {
setOpen(false); onOpenChange(false);
await authClient.organization.setActive({organizationSlug: result.data.value.slug}); await authClient.organization.setActive({organizationSlug: result.data.value.slug});
router.replace(`/dashboard/${result.data.value.slug}/home`); onSuccess?.();
router.replace(`/dashboard/home`);
// router.refresh();
} }
} }
}, },
}); });
return ( return (
<Dialog open={open} onOpenChange={setOpen}> <Dialog open={open} onOpenChange={onOpenChange}>
<DialogTrigger asChild>{children}</DialogTrigger>
<DialogContent className="sm:max-w-[425px] w-full"> <DialogContent className="sm:max-w-[425px] w-full">
<DialogHeader> <DialogHeader>
<DialogTitle>Create a new organization</DialogTitle> <DialogTitle>Create a new organization</DialogTitle>
@@ -9,8 +9,8 @@ export function OrganizationCombobox() {
const router = useRouter(); const router = useRouter();
const {state} = useSidebar(); const {state} = useSidebar();
const { data: organizations } = authClient.useListOrganizations(); const {data: organizations, refetch} = authClient.useListOrganizations();
const { data: activeOrganization } = authClient.useActiveOrganization(); const {data: activeOrganization, refetch: refetchActiveOrga} = authClient.useActiveOrganization();
if (!organizations) return null; if (!organizations) return null;
@@ -28,9 +28,16 @@ export function OrganizationCombobox() {
await authClient.organization.setActive({ await authClient.organization.setActive({
organizationSlug: slug, organizationSlug: slug,
}); });
// router.replace(`/dashboard/${slug}/home`);
router.refresh(); router.refresh();
}; };
return <>{state === "expanded" && <ComboBox sideBar values={values} defaultValue={activeOrganization?.slug} onValueChange={onValueChange} />}</>; const handleReset = () => {
refetch();
refetchActiveOrga()
router.refresh();
}
return <>{state === "expanded" &&
<ComboBox sideBar values={values} defaultValue={activeOrganization?.slug} onValueChange={onValueChange}
reload={handleReset}/>}</>;
} }
+1599 -2290
View File
File diff suppressed because it is too large Load Diff