mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
Refactoring on some files
This commit is contained in:
@@ -38,7 +38,6 @@ export default async function RoutePage(props: PageParams<{ agentId: string }>)
|
||||
// const databaseId = 'db-123';
|
||||
//
|
||||
|
||||
console.log("agent",agent)
|
||||
|
||||
|
||||
|
||||
|
||||
+12
-8
@@ -86,17 +86,21 @@ export default async function RoutePage(props: PageParams<{
|
||||
return (
|
||||
<Page>
|
||||
<div className="justify-between gap-2 sm:flex">
|
||||
<PageTitle className="flex items-center">
|
||||
<PageTitle className="flex items-center justify-between w-full">
|
||||
{capitalizeFirstLetter(dbItem.name)}
|
||||
<EditButton/>
|
||||
<RetentionPolicySheet database={dbItem}/>
|
||||
<CronButton database={dbItem}/>
|
||||
|
||||
<div className="flex items-center gap-2 justify-between w-full">
|
||||
<div className="flex items-center gap-2">
|
||||
<EditButton/>
|
||||
<RetentionPolicySheet database={dbItem}/>
|
||||
<CronButton database={dbItem}/>
|
||||
</div>
|
||||
<div className="flex items-center gap-2">
|
||||
<BackupButton disable={isAlreadyBackup} databaseId={databaseId}/>
|
||||
</div>
|
||||
</div>
|
||||
</PageTitle>
|
||||
<PageActions className="justify-between">
|
||||
<BackupButton disable={isAlreadyBackup} databaseId={databaseId}/>
|
||||
</PageActions>
|
||||
</div>
|
||||
|
||||
{dbItem.description && (
|
||||
<PageDescription className="mt-5 sm:mt-0">{dbItem.description}</PageDescription>
|
||||
)}
|
||||
|
||||
@@ -45,7 +45,6 @@ export default async function RoutePage(props: PageParams<{ projectId: string }>
|
||||
)
|
||||
// .filter((db) => db.project !== null) as DatabaseWith[];
|
||||
|
||||
console.log("ici34",availableDatabases);
|
||||
|
||||
|
||||
return (
|
||||
|
||||
@@ -35,7 +35,6 @@ export default async function RoutePage(props: PageParams<{ }>) {
|
||||
|
||||
if (!org) notFound();
|
||||
|
||||
console.log("ici",availableDatabases)
|
||||
|
||||
return (
|
||||
<Page>
|
||||
|
||||
@@ -45,7 +45,6 @@ export default async function RoutePage(props: PageParams<{}>) {
|
||||
});
|
||||
|
||||
|
||||
console.log("evolution",backupsEvolution);
|
||||
|
||||
// const tomorrow = new Date();
|
||||
// tomorrow.setDate(tomorrow.getDate() + 1);
|
||||
|
||||
@@ -10,7 +10,6 @@ import {getAccounts, getSessions} from "@/lib/auth/auth";
|
||||
|
||||
export default async function RoutePage(props: PageParams<{}>) {
|
||||
const user = await currentUser();
|
||||
console.log("my user",user);
|
||||
if (!user) {
|
||||
return notFound();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ export async function POST(
|
||||
const body: BodyResultRestore = await request.json();
|
||||
|
||||
console.log(body)
|
||||
console.log(agentId)
|
||||
|
||||
|
||||
if (!isUuidv4(body.generatedId)) {
|
||||
|
||||
@@ -48,8 +48,6 @@ export async function handleDatabases(body: Body, agent: Agent, lastContact: Dat
|
||||
{status: 500}
|
||||
);
|
||||
}
|
||||
console.log(db)
|
||||
console.log(dbmsEnumSchema.parse(db.dbms))
|
||||
const [databaseCreated] = await dbClient
|
||||
.insert(drizzleDb.schemas.database)
|
||||
.values({
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
"use client";
|
||||
|
||||
import { useRouter } from "next/navigation";
|
||||
import {useRouter} from "next/navigation";
|
||||
|
||||
import { useMutation } from "@tanstack/react-query";
|
||||
import { toast } from "sonner";
|
||||
import {useMutation} from "@tanstack/react-query";
|
||||
import {toast} from "sonner";
|
||||
|
||||
import { backupButtonAction } from "@/components/wrappers/dashboard/backup/backup-button/backup-button.action";
|
||||
import { ButtonWithLoading } from "@/components/wrappers/common/button/button-with-loading";
|
||||
import {backupButtonAction} from "@/components/wrappers/dashboard/backup/backup-button/backup-button.action";
|
||||
import {ButtonWithLoading} from "@/components/wrappers/common/button/button-with-loading";
|
||||
import {Database, DatabaseZap} from "lucide-react";
|
||||
import {useIsMobile} from "@/hooks/use-mobile";
|
||||
|
||||
export type BackupButtonProps = {
|
||||
databaseId: string;
|
||||
@@ -15,6 +17,8 @@ export type BackupButtonProps = {
|
||||
|
||||
export const BackupButton = (props: BackupButtonProps) => {
|
||||
const router = useRouter();
|
||||
const isMobile = useIsMobile()
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: async (databaseId: string) => {
|
||||
const backup = await backupButtonAction(databaseId);
|
||||
@@ -32,8 +36,9 @@ export const BackupButton = (props: BackupButtonProps) => {
|
||||
|
||||
return (
|
||||
<ButtonWithLoading
|
||||
icon={<DatabaseZap/>}
|
||||
disabled={props.disable}
|
||||
text="Backup"
|
||||
text={isMobile ? "" : "Backup"}
|
||||
isPending={mutation.isPending}
|
||||
size={"default"}
|
||||
onClick={async () => {
|
||||
|
||||
@@ -58,7 +58,6 @@ export const DatabaseForm = (props: DatabaseFormProps) => {
|
||||
form={form}
|
||||
className="flex flex-col gap-4 mt-3"
|
||||
onSubmit={async (values) => {
|
||||
console.log("sssssss");
|
||||
await mutation.mutateAsync(values);
|
||||
}}
|
||||
>
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
import {Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle, SheetTrigger} from "@/components/ui/sheet";
|
||||
import {Button} from "@/components/ui/button";
|
||||
import {Database, DatabaseZap} from "lucide-react";
|
||||
import {Database, Ruler} from "lucide-react";
|
||||
import {DatabaseWith as DbSchema, RetentionPolicy} from "@/db/schema/07_database";
|
||||
import {
|
||||
BackupRetentionSettingsForm
|
||||
@@ -15,7 +15,7 @@ export const RetentionPolicySheet = ({database}: RetentionPolicySheetProps) => {
|
||||
<Sheet>
|
||||
<SheetTrigger asChild>
|
||||
<Button variant="outline">
|
||||
<DatabaseZap/>
|
||||
<Ruler />
|
||||
</Button>
|
||||
</SheetTrigger>
|
||||
<SheetContent
|
||||
|
||||
@@ -77,7 +77,6 @@ export const updateOrganizationAction = userAction
|
||||
.action(async ({parsedInput, ctx}): Promise<ServerActionResult<Organization>> => {
|
||||
try {
|
||||
const newUserList = parsedInput.data.users;
|
||||
console.log(parsedInput);
|
||||
const organization = await db.query.organization.findFirst({
|
||||
where: eq(drizzleDb.schemas.organization.id, parsedInput.organizationId),
|
||||
with: {
|
||||
|
||||
@@ -42,8 +42,6 @@ export const UserForm = (props: UserFormProps) => {
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: async (values: UserType) => {
|
||||
console.log("values", values);
|
||||
console.log(props.userId);
|
||||
const updateUser = await updateUserAction({
|
||||
id: props.userId ?? "-",
|
||||
data: values,
|
||||
|
||||
@@ -47,7 +47,6 @@ export const ProjectForm = (props: projectFormProps) => {
|
||||
|
||||
const mutation = useMutation({
|
||||
mutationFn: async (values: ProjectType) => {
|
||||
console.log(values);
|
||||
if (!isCreate && !props.projectId) {
|
||||
throw new Error("Project ID is required for updates");
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ export function backupColumns(isAlreadyRestore: boolean, settings: Setting, data
|
||||
</TooltipTrigger>
|
||||
{row.original.deletedAt != null && (
|
||||
<TooltipContent>
|
||||
<p>{formatFrenchDate(row.getValue("deletedAt"))}</p>
|
||||
<p>{formatFrenchDate(row.original.deletedAt)}</p>
|
||||
</TooltipContent>
|
||||
)}
|
||||
</Tooltip>
|
||||
@@ -58,13 +58,6 @@ export function backupColumns(isAlreadyRestore: boolean, settings: Setting, data
|
||||
accessorKey: "id",
|
||||
header: "Reference",
|
||||
},
|
||||
// {
|
||||
// accessorKey: "deletedAt",
|
||||
// header: "Deleted At",
|
||||
// cell: ({row}) => {
|
||||
// return row.original.deletedAt ? formatFrenchDate(row.getValue("deletedAt")) : "-"
|
||||
// },
|
||||
// },
|
||||
{
|
||||
accessorKey: "createdAt",
|
||||
header: "Created At",
|
||||
|
||||
+10
-8
@@ -65,12 +65,14 @@ async function createDefaultOrganization() {
|
||||
|
||||
function consoleAscii() {
|
||||
console.log(
|
||||
"\n" +
|
||||
" ____ __ __ _____ \n" +
|
||||
" / __ \\ ____ _____ / /_ ____ _ / /_ ____ _ _____ ___ / ___/ ___ _____ _ __ ___ _____\n" +
|
||||
" / /_/ // __ \\ / ___// __// __ // __ \\ / __ // ___// _ \\ \\__ \\ / _ \\ / ___/| | / // _ \\ / ___/\n" +
|
||||
" / ____// /_/ // / / /_ / /_/ // /_/ // /_/ /(__ )/ __/ ___/ // __// / | |/ // __// / \n" +
|
||||
"/_/ \\____//_/ \\__/ \\__,_//_.___/ \\__,_//____/ \\___/ /____/ \\___//_/ |___/ \\___//_/ \n" +
|
||||
" \n"
|
||||
);
|
||||
" \n" +
|
||||
" ____ __ __ \n" +
|
||||
" / __ \\____ _____/ /_____ _/ /_ ____ _________ \n" +
|
||||
" / /_/ / __ \\/ ___/ __/ __ / __ \\/ __ / ___/ _ \\ \n" +
|
||||
" / ____/ /_/ / / / /_/ /_/ / /_/ / /_/ (__ ) __/ \n" +
|
||||
" /_/ \\____/_/ \\__/\\__,_/_.___/\\__,_/____/\\___/ \n" +
|
||||
" \n" +
|
||||
` Community Edition v${env.NEXT_PUBLIC_PROJECT_VERSION} \n ` +
|
||||
" \n"
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user