Merge remote-tracking branch 'origin/main'

# Conflicts:
#	src/components/wrappers/dashboard/Organization/organization-combobox.tsx
This commit is contained in:
charles-gauthereau
2024-12-16 12:03:16 +01:00
93 changed files with 207 additions and 265 deletions
+1 -1
View File
@@ -3,7 +3,7 @@
import {useEffect, useRef} from "react";
import {useSearchParams} from "next/navigation";
import {LoginForm} from "@/components/wrappers/Auth/Login/LoginForm/LoginForm";
import {LoginForm} from "@/components/wrappers/auth/Login/LoginForm/LoginForm";
import {toast} from "sonner";
export default function SignInPage(props: {
+1 -1
View File
@@ -1,7 +1,7 @@
"use client"
import {PageParams} from "@/types/next";
import {RegisterForm} from "@/components/wrappers/Auth/Register/RegisterForm/RegisterForm";
import {RegisterForm} from "@/components/wrappers/auth/Register/RegisterForm/RegisterForm";
export default function RoutePage(props: PageParams<{}>) {
return (
+1 -1
View File
@@ -3,7 +3,7 @@ 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 {AdminTabs} from "@/components/wrappers/Dashboard/admin/admin-tabs";
import {AdminTabs} from "@/components/wrappers/dashboard/admin/admin-tabs";
export default async function RoutePage(props: PageParams<{}>) {
@@ -1,6 +1,6 @@
import {PageParams} from "@/types/next";
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
import {AgentForm} from "@/components/wrappers/Agent/AgentForm/AgentForm";
import {AgentForm} from "@/components/wrappers/dashboard/agent/AgentForm/AgentForm";
import {requiredCurrentUser} from "@/auth/current-user";
import {prisma} from "@/prisma";
import {notFound} from "next/navigation";
@@ -8,9 +8,9 @@ import {Page, PageActions, PageContent, PageDescription, PageTitle} from "@/feat
import {formatDateLastContact} from "@/utils/date-formatting";
import {Button, buttonVariants} from "@/components/ui/button";
import {Card, CardContent, CardHeader} from "@/components/ui/card";
import {AgentModalKey} from "@/components/wrappers/Agent/AgentModalKey/AgentModalKey";
import {AgentModalKey} from "@/components/wrappers/dashboard/agent/AgentModalKey/AgentModalKey";
import {CardsWithPagination} from "@/components/wrappers/cards-with-pagination";
import {DatabaseCard} from "@/components/wrappers/Dashboard/Projects/ProjectCard/ProjectDatabaseCard";
import {DatabaseCard} from "@/components/wrappers/dashboard/Projects/ProjectCard/ProjectDatabaseCard";
export default async function RoutePage(props: PageParams<{ agentId: string }>) {
+1 -1
View File
@@ -1,6 +1,6 @@
import {PageParams} from "@/types/next";
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
import {AgentForm} from "@/components/wrappers/Agent/AgentForm/AgentForm";
import {AgentForm} from "@/components/wrappers/dashboard/agent/AgentForm/AgentForm";
export default async function RoutePage(props: PageParams<{}>) {
+1 -1
View File
@@ -1,6 +1,6 @@
import {PageParams} from "@/types/next";
import {prisma} from "@/prisma";
import {AgentCard} from "@/components/wrappers/Agent/AgentCard/AgentCard";
import {AgentCard} from "@/components/wrappers/dashboard/agent/AgentCard/AgentCard";
import {CardsWithPagination} from "@/components/wrappers/cards-with-pagination";
import {Button} from "@/components/ui/button";
import Link from 'next/link'
@@ -3,7 +3,7 @@ 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";
import {RestoreForm} from "@/components/wrappers/dashboard/database/RestoreForm";
export default async function RoutePage(props: PageParams<{
+1 -1
View File
@@ -2,7 +2,7 @@ import React from "react";
import {redirect} from "next/navigation";
import {SidebarInset, SidebarProvider} from "@/components/ui/sidebar"
import {AppSidebar} from "@/components/wrappers/Dashboard/SideBar/app-sidebar";
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";
+3 -3
View File
@@ -3,11 +3,11 @@ import {Page, PageActions, PageContent, PageHeader, PageTitle} from "@/features/
import {Avatar, AvatarFallback, AvatarImage} from "@/components/ui/avatar";
import {notFound} from "next/navigation";
import {requiredCurrentUser} from "@/auth/current-user";
import {UserForm} from "@/components/wrappers/Dashboard/Profile/UserForm/UserForm";
import {UserForm} from "@/components/wrappers/dashboard/Profile/UserForm/UserForm";
import {prisma} from "@/prisma";
import {Badge} from "@/components/ui/badge";
import {ButtonDeleteAccount} from "@/components/wrappers/Dashboard/Profile/ButtonDeleteAccount/ButtonDeleteAccount";
import {AvatarWithUpload} from "@/components/wrappers/Dashboard/Profile/Avatar/AvatarWithUpload";
import {ButtonDeleteAccount} from "@/components/wrappers/dashboard/Profile/ButtonDeleteAccount/ButtonDeleteAccount";
import {AvatarWithUpload} from "@/components/wrappers/dashboard/Profile/Avatar/AvatarWithUpload";
export default async function RoutePage(props: PageParams<{}>) {
@@ -1,10 +1,10 @@
import {PageParams} from "@/types/next";
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
import {AgentForm} from "@/components/wrappers/Agent/AgentForm/AgentForm";
import {AgentForm} from "@/components/wrappers/dashboard/agent/AgentForm/AgentForm";
import {requiredCurrentUser} from "@/auth/current-user";
import {prisma} from "@/prisma";
import {notFound} from "next/navigation";
import {DatabaseForm} from "@/components/wrappers/Database/DatabaseForm/DatabaseForm";
import {DatabaseForm} from "@/components/wrappers/dashboard/database/DatabaseForm/DatabaseForm";
export default async function RoutePage(props: PageParams<{
@@ -2,14 +2,14 @@ import {PageParams} from "@/types/next";
import {prisma} from "@/prisma";
import {notFound, usePathname, useRouter} from "next/navigation";
import {Page, PageActions, PageContent, PageDescription, PageTitle} from "@/features/layout/page";
import {BackupButton} from "@/components/wrappers/BackupButton/BackupButton";
import {DatabaseTabs} from "@/components/wrappers/Dashboard/Projects/Database/DatabaseTabs";
import {DatabaseKpi} from "@/components/wrappers/Dashboard/Projects/Database/DatabaseKpi";
import {BackupButton} from "@/components/wrappers/dashboard/backup/backup-button/backup-button";
import {DatabaseTabs} from "@/components/wrappers/dashboard/Projects/Database/DatabaseTabs";
import {DatabaseKpi} from "@/components/wrappers/dashboard/Projects/Database/DatabaseKpi";
import Link from "next/link";
import {buttonVariants} from "@/components/ui/button";
import {GearIcon} from "@radix-ui/react-icons";
import {EditButton} from "@/components/wrappers/Database/EditButton/EditButton";
import {CronButton} from "@/components/wrappers/Database/CronButton/CronButton";
import {EditButton} from "@/components/wrappers/dashboard/database/EditButton/EditButton";
import {CronButton} from "@/components/wrappers/dashboard/database/CronButton/CronButton";
export default async function RoutePage(props: PageParams<{ databaseId: string }>) {
@@ -3,7 +3,7 @@ import {notFound} from "next/navigation";
import {PageParams} from "@/types/next";
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
import {prisma} from "@/prisma";
import {ProjectForm} from "@/components/wrappers/Dashboard/Projects/ProjectsForm/ProjectForm";
import {ProjectForm} from "@/components/wrappers/dashboard/Projects/ProjectsForm/ProjectForm";
export default async function RoutePage(props: PageParams<{
@@ -4,9 +4,9 @@ import {buttonVariants} from "@/components/ui/button";
import {prisma} from "@/prisma";
import {GearIcon} from "@radix-ui/react-icons";
import Link from "next/link";
import {ButtonDeleteProject} from "@/components/wrappers/Dashboard/Projects/ButtonDeleteProject/ButtonDeleteProject";
import {ButtonDeleteProject} from "@/components/wrappers/dashboard/Projects/ButtonDeleteProject/ButtonDeleteProject";
import {CardsWithPagination} from "@/components/wrappers/cards-with-pagination";
import {ProjectDatabaseCard} from "@/components/wrappers/Dashboard/Projects/ProjectCard/ProjectDatabaseCard";
import {ProjectDatabaseCard} from "@/components/wrappers/dashboard/Projects/ProjectCard/ProjectDatabaseCard";
import {notFound} from "next/navigation";
@@ -1,7 +1,7 @@
import {PageParams} from "@/types/next";
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
import {prisma} from "@/prisma";
import {ProjectForm} from "@/components/wrappers/Dashboard/Projects/ProjectsForm/ProjectForm";
import {ProjectForm} from "@/components/wrappers/dashboard/Projects/ProjectsForm/ProjectForm";
export default async function RoutePage(props: PageParams<{}>) {
+1 -1
View File
@@ -4,7 +4,7 @@ import {CardsWithPagination} from "@/components/wrappers/cards-with-pagination";
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 {ProjectCard} from "@/components/wrappers/dashboard/Projects/ProjectCard/ProjectCard";
import {requiredCurrentUser} from "@/auth/current-user";
export default async function RoutePage(props: PageParams<{}>) {
+1 -1
View File
@@ -2,7 +2,7 @@ import {prisma} from "@/prisma";
import {PageParams} from "@/types/next";
import {Page, PageContent, PageDescription, PageHeader, PageTitle} from "@/features/layout/page";
import {requiredCurrentUser} from "@/auth/current-user";
import {SettingsTabs} from "@/components/wrappers/Dashboard/Settings/SettingsTabs/SettingsTabs";
import {SettingsTabs} from "@/components/wrappers/dashboard/Settings/SettingsTabs/SettingsTabs";
export default async function RoutePage(props: PageParams<{}>) {
+2 -2
View File
@@ -2,8 +2,8 @@ import {PageParams} from "@/types/next";
import {Page, PageContent, PageHeader, PageTitle} from "@/features/layout/page";
import {prisma} from "@/prisma";
import {Card, CardContent, CardHeader, CardTitle} from "@/components/ui/card";
import {EvolutionLineChart} from "@/components/wrappers/charts/evolution-line-chart";
import {PercentageLineChart} from "@/components/wrappers/charts/percentage-line-chart";
import {EvolutionLineChart} from "@/components/wrappers/dashboard/statistics/charts/evolution-line-chart";
import {PercentageLineChart} from "@/components/wrappers/dashboard/statistics/charts/percentage-line-chart";
export default async function RoutePage(props: PageParams<{}>) {
@@ -1,5 +1,4 @@
import {PropsWithChildren} from "react";
import {ClipboardCopy, Copy, CopyIcon} from "lucide-react";
import {Button} from "@/components/ui/button"
export type CodeSnippetProps = PropsWithChildren<{
@@ -11,19 +10,10 @@ export const CodeSnippet = (props: CodeSnippetProps) => {
return (
// <div className="flex items-center space-x-4 w-full">
// <code
// className="text-xs sm:text-sm inline-flex text-left bg-gray-800 text-white rounded-lg p-4 overflow-x-auto whitespace-nowrap max-w-full"
// >
// <span className="flex-1">{props.code}</span>
// </code>
// </div>
<div className="rounded-lg border bg-background">
<div className="flex items-center justify-between border-b bg-muted px-4 py-2">
<div className="text-sm font-medium">.env</div>
<Button variant="ghost" size="icon" className="hover:bg-muted/50 text-muted-foreground">
{/*<CopyIcon className="h-4 w-4"/>*/}
{/*<span className="sr-only">Copy code</span>*/}
</Button>
</div>
<div className="p-4 font-mono text-sm leading-6 text-foreground truncate">
@@ -1,144 +0,0 @@
// "use client"
//
// import {CartesianGrid, Line, LineChart, Tooltip, XAxis, YAxis} from "recharts"
// import {ChartConfig, ChartContainer, ChartTooltip, ChartTooltipContent,} from "@/components/ui/chart"
// import {humanReadableDate} from "@/utils/date-formatting";
//
//
// export type lineChartProps = {
// data: any
// }
//
// export function EvolutionLineChart(props: lineChartProps) {
//
// const {data} = props
//
// // Process data to calculate cumulative count
// const cumulativeData = data.reduce((acc, backup) => {
// const date = backup.createdAt.toISOString().split("T")[0]; // Format as YYYY-MM-DD
//
// // Increment count for the current date or initialize it
// if (acc.length && acc[acc.length - 1].date === date) {
// acc[acc.length - 1].count += 1;
// } else {
// const lastCount = acc.length ? acc[acc.length - 1].count : 0;
// acc.push({date, count: lastCount + 1});
// }
//
// return acc;
// }, [] as { date: string; count: number }[]);
//
//
// const chartConfig = {
// date: {
// label: "Date",
// color: "#2563eb",
// },
// count: {
// label: "Number of backups",
// color: "#60a5fa",
// },
// } satisfies ChartConfig
//
//
// return (
// <ChartContainer config={chartConfig}>
// <LineChart
// accessibilityLayer
// data={data}
// margin={{
// left: 12,
// right: 12,
// }}
// >
// <CartesianGrid vertical={false}/>
// <XAxis
// dataKey="date"
// tickLine={false}
// axisLine={false}
// tickMargin={8}
// tickFormatter={(value) => humanReadableDate(Date(value)).split(' ')[0]}
// />
// <YAxis/>
// <ChartTooltip
// cursor={false}
// content={<ChartTooltipContent hideLabel/>}
// />
// <Line
// dataKey="count"
// type="linear"
// stroke="var(--color-desktop)"
// strokeWidth={2}
// dot={false}
// />
// </LineChart>
// </ChartContainer>
// )
// }
//
// export function PercentageLineChart(props: lineChartProps) {
//
// const {data} = props
//
// const chartConfig = {
// date: {
// label: "Date",
// color: "#2563eb",
// },
// successRate: {
// label: "Success Rate",
// color: "#60a5fa",
// },
// } satisfies ChartConfig
//
// const dailyStats = data.reduce((acc, backup) => {
// const date = backup.createdAt.toISOString().split("T")[0]; // Format YYYY-MM-DD
// const status = backup.status;
//
// if (!acc[date]) {
// acc[date] = {success: 0, failed: 0, total: 0};
// }
//
// acc[date][status === "success" ? "success" : "failed"] += backup._count.id;
// acc[date].total += backup._count.id;
//
// return acc;
// }, {} as Record<string, { success: number; failed: number; total: number }>);
//
// // Format data for the chart
// const formattedData = Object.entries(dailyStats).map(([date, stats]) => ({
// date,
// successRate: (stats.success / stats.total) * 100,
// }));
//
// return (
// <ChartContainer config={chartConfig}>
// <LineChart data={formattedData}>
// <CartesianGrid strokeDasharray="3 3"/>
// <XAxis dataKey="date"/>
// <YAxis domain={[0, 100]} tickFormatter={(tick) => `${tick}%`}/>
// {/*<Tooltip formatter={(value: number) => `${value.toFixed(2)}%`}/>*/}
// <ChartTooltip
// content={<ChartTooltipContent/>}
// cursor={false}
// defaultIndex={1}
// formatter={(value, name) => (
// <div className="flex min-w-[130px] items-center text-xs text-muted-foreground">
// {chartConfig[name as keyof typeof chartConfig]?.label ||
// name}
// <div className="ml-auto flex items-baseline gap-0.5 font-mono font-medium tabular-nums text-foreground">
// {value}
// <span className="font-normal text-muted-foreground">
// %
// </span>
// </div>
// </div>
// )}
// />
// <Line type="step" dataKey="successRate" stroke="#8884d8" strokeWidth={2}/>
// </LineChart>
// </ChartContainer>
// )
//
// }
//
@@ -11,10 +11,10 @@ import {toast} from "sonner";
import {useMutation} from "@tanstack/react-query";
import {TooltipProvider} from "@/components/ui/tooltip";
import Link from "next/link";
import {PasswordInput} from "@/components/wrappers/Auth/PaswordInput/password-input";
import {LoginSchema, LoginType} from "@/components/wrappers/Auth/Login/LoginForm/login-form.schema";
import {PasswordInput} from "@/components/wrappers/auth/PaswordInput/password-input";
import {LoginSchema, LoginType} from "@/components/wrappers/auth/Login/LoginForm/login-form.schema";
import {signInAction} from "@/features/auth/auth.action";
import {SocialAuthButton} from "@/components/wrappers/Auth/Login/SocialAuth/SocialAuthButtons/SocialAuthButton";
import {SocialAuthButton} from "@/components/wrappers/auth/Login/SocialAuth/SocialAuthButtons/SocialAuthButton";
import Image from 'next/image';
export type loginFormProps = {
@@ -11,9 +11,9 @@ import {Input} from "@/components/ui/input";
import {Form} from "@/components/ui/form"
import {Button} from "@/components/ui/button";
import {TooltipProvider, TooltipTrigger, Tooltip, TooltipContent} from "@/components/ui/tooltip";
import {RegisterSchema, RegisterType} from "@/components/wrappers/Auth/Register/RegisterForm/register-form.schema";
import {registerUserAction} from "@/components/wrappers/Auth/Register/RegisterForm/register-form.action";
import {PasswordInput} from "@/components/wrappers/Auth/PaswordInput/password-input";
import {RegisterSchema, RegisterType} from "@/components/wrappers/auth/Register/RegisterForm/register-form.schema";
import {registerUserAction} from "@/components/wrappers/auth/Register/RegisterForm/register-form.action";
import {PasswordInput} from "@/components/wrappers/auth/PaswordInput/password-input";
export type registerFormProps = {
defaultValues?: RegisterType;
@@ -1,5 +1,5 @@
"use server"
import {RegisterSchema} from "@/components/wrappers/Auth/Register/RegisterForm/register-form.schema";
import {RegisterSchema} from "@/components/wrappers/auth/Register/RegisterForm/register-form.schema";
import {action} from "@/safe-actions";
import {prisma} from "@/prisma";
import {hashPassword} from "@/utils/password";
@@ -2,7 +2,7 @@
import {useEffect, useState} from "react";
import {Check, ChevronDown} from "lucide-react"
import {Check, ChevronDown, KeyRound} from "lucide-react"
import {cn} from "@/lib/utils"
import {Button} from "@/components/ui/button"
@@ -22,6 +22,8 @@ import {
import {FormControl} from "@/components/ui/form";
import {SidebarMenuButton} from "@/components/ui/sidebar";
import {Separator} from "@/components/ui/separator";
import {AgentModalKey} from "@/components/wrappers/dashboard/agent/AgentModalKey/AgentModalKey";
import {CreateOrganizationModal} from "@/components/wrappers/dashboard/Organization/create-organisation-modal";
export type comboBoxProps = {
values: Array<{ value: string, label: string }>
@@ -34,7 +36,13 @@ export type 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>()
@@ -100,9 +108,11 @@ export function ComboBox(props: comboBoxProps) {
</Command>
<Separator/>
{sideBar ?
<SidebarMenuButton>
+ Create new organization
</SidebarMenuButton>
<CreateOrganizationModal>
<SidebarMenuButton>
+ Create new organization
</SidebarMenuButton>
</CreateOrganizationModal>
: null}
</PopoverContent>
</Popover>
@@ -1,6 +1,6 @@
import {Avatar, AvatarFallback, AvatarImage} from "@/components/ui/avatar"
import {currentUser} from "@/auth/current-user";
import {LoggedInDropdown} from "@/components/wrappers/Dashboard/LoggedInDropdown/LoggedInDropdown";
import {LoggedInDropdown} from "@/components/wrappers/dashboard/LoggedInDropdown/LoggedInDropdown";
import {SidebarMenuButton} from "@/components/ui/sidebar";
import {ChevronUp} from "lucide-react";
@@ -0,0 +1,77 @@
"use client"
import {useMutation} from "@tanstack/react-query";
import {Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, DialogTrigger} from "@/components/ui/dialog";
import {Button} from "@/components/ui/button";
import {Form, FormControl, FormField, FormItem, FormLabel, FormMessage, useZodForm} from "@/components/ui/form";
import {Input} from "@/components/ui/input";
import {OrganizationSchema} from "@/components/wrappers/dashboard/Organization/organization.schema";
export type createOrganizationModalProps = {
children: any
}
export function CreateOrganizationModal(props: createOrganizationModalProps) {
const {children} = props;
const form = useZodForm({
schema: OrganizationSchema,
});
const mutation = useMutation({
mutationFn: async (values: OrganizationSchema) => {
}
})
return (
<Dialog>
<DialogTrigger asChild>
{children}
</DialogTrigger>
<DialogContent className="sm:max-w-[425px] w-full">
<DialogHeader>
<DialogTitle>Create a new organization</DialogTitle>
</DialogHeader>
<div className="sm:max-w-[375px] w-full">
<Form form={form}
className="flex flex-col gap-4"
onSubmit={async (values) => {
await mutation.mutateAsync(values);
}}
>
<FormField
control={form.control}
name="name"
defaultValue=""
render={({field}) => (
<FormItem>
<FormLabel>Name</FormLabel>
<FormControl>
<Input {...field} />
</FormControl>
<FormMessage/>
</FormItem>
)}
/>
</Form>
</div>
<DialogFooter>
<div className="flex items-center justify-between w-full">
<Button type="submit">Create</Button>
</div>
</DialogFooter>
</DialogContent>
</Dialog>
)
}
@@ -2,10 +2,10 @@
import {useEffect, useState} from "react";
import {ComboBox} from "@/components/wrappers/combobox";
import {ComboBox} from "@/components/wrappers/common/combobox";
import {Organization} from "@prisma/client";
import {useStore} from "@/state-management/store";
import {getCurrentOrganizationSlug, setCurrentOrganizationSlug} from "@/features/dashboard/organization";
import {getCurrentOrganizationSlug, setCurrentOrganizationSlug} from "@/features/dashboard/organization-cookie";
import {useSidebar} from "@/components/ui/sidebar";
export type organizationComboBoxProps = {
@@ -14,7 +14,7 @@ export type organizationComboBoxProps = {
}
export function OrganizationComboBox(props: organizationComboBoxProps) {
export function OrganizationCombobox(props: organizationComboBoxProps) {
// const {organizationId, moveToAnotherOrganization} = useStore((state) => state);
@@ -0,0 +1,8 @@
import {z} from "zod";
export const OrganizationSchema = z.object({
name: z.string(),
});
export type OrganizationSchema = z.infer<typeof OrganizationSchema>;
@@ -6,7 +6,7 @@ import {toast} from "sonner";
import {uploadImageAction} from "@/features/upload/public/upload.action";
import {useMutation} from "@tanstack/react-query";
import {prisma} from "@/prisma";
import {updateImageUserAction} from "@/components/wrappers/Dashboard/Profile/Avatar/avatar.action";
import {updateImageUserAction} from "@/components/wrappers/dashboard/Profile/Avatar/avatar.action";
import {useRouter} from "next/navigation";
import {useSession} from "next-auth/react";
@@ -1,8 +1,8 @@
"use client"
import {useMutation} from "@tanstack/react-query";
import {signOutAction} from "@/features/auth/auth.action";
import {ButtonWithConfirm} from "@/components/wrappers/Button/ButtonWithConfirm/ButtonWithConfirm";
import {deleteUserAction} from "@/components/wrappers/Dashboard/Profile/ButtonDeleteAccount/delete-account.action";
import {ButtonWithConfirm} from "@/components/wrappers/common/button/ButtonWithConfirm/ButtonWithConfirm";
import {deleteUserAction} from "@/components/wrappers/dashboard/Profile/ButtonDeleteAccount/delete-account.action";
import {Trash2} from "lucide-react";
export type ButtonDeleteAccountProps = {
@@ -3,7 +3,7 @@ import {userAction} from "@/safe-actions";
import {prisma} from "@/prisma";
import {z} from "zod";
import {v4 as uuidv4} from "uuid";
import {EmailFormSchema} from "@/components/wrappers/Dashboard/admin/AdminEmailTab/EmailForm/email-form.schema";
import {EmailFormSchema} from "@/components/wrappers/dashboard/admin/AdminEmailTab/EmailForm/email-form.schema";
export const deleteUserAction = userAction
@@ -10,9 +10,9 @@ import {Button} from "@/components/ui/button";
import {useRouter} from "next/navigation";
import {useMutation} from "@tanstack/react-query";
import {TooltipProvider} from "@/components/ui/tooltip";
import {UserSchema, UserType} from "@/components/wrappers/Dashboard/Profile/UserForm/user-form.schema";
import {UserSchema, UserType} from "@/components/wrappers/dashboard/Profile/UserForm/user-form.schema";
import {toast} from "sonner";
import {updateUserAction} from "@/components/wrappers/Dashboard/Profile/UserForm/user-form.action";
import {updateUserAction} from "@/components/wrappers/dashboard/Profile/UserForm/user-form.action";
import { useSession } from "next-auth/react";
export type userFormProps = {
@@ -2,7 +2,7 @@
import {userAction} from "@/safe-actions";
import {z} from "zod";
import {prisma} from "@/prisma";
import {UserSchema} from "@/components/wrappers/Dashboard/Profile/UserForm/user-form.schema";
import {UserSchema} from "@/components/wrappers/dashboard/Profile/UserForm/user-form.schema";
export const updateUserAction = userAction
.schema(
@@ -1,5 +1,5 @@
"use client"
import {ButtonWithConfirm} from "@/components/wrappers/Button/ButtonWithConfirm/ButtonWithConfirm";
import {ButtonWithConfirm} from "@/components/wrappers/common/button/ButtonWithConfirm/ButtonWithConfirm";
import {Trash2} from "lucide-react";
export type ButtonDeleteProjectProps = {
@@ -14,11 +14,11 @@ import {Input} from "@/components/ui/input";
import {Form} from "@/components/ui/form"
import {Button} from "@/components/ui/button";
import {useMutation} from "@tanstack/react-query";
import {ProjectSchema, ProjectType} from "@/components/wrappers/Dashboard/Projects/ProjectsForm/ProjectForm.schema";
import {ProjectSchema, ProjectType} from "@/components/wrappers/dashboard/Projects/ProjectsForm/ProjectForm.schema";
import {
createProjectAction,
updateProjectAction
} from "@/components/wrappers/Dashboard/Projects/ProjectsForm/project-form.action";
} from "@/components/wrappers/dashboard/Projects/ProjectsForm/project-form.action";
import {useRouter} from "next/navigation";
import {Database, Organization, Projects} from "@prisma/client"
import {MultiSelect} from "@/components/wrappers/MultiSelect/MultiSelect";
@@ -2,7 +2,7 @@
import {userAction} from "@/safe-actions";
import {prisma} from "@/prisma";
import {ProjectSchema} from "@/components/wrappers/Dashboard/Projects/ProjectsForm/ProjectForm.schema";
import {ProjectSchema} from "@/components/wrappers/dashboard/Projects/ProjectsForm/ProjectForm.schema";
import {z} from "zod";
import {ServerActionResult} from "@/types/action-type";
import {Projects} from "@prisma/client";
@@ -2,12 +2,12 @@
import {Tabs, TabsContent, TabsList, TabsTrigger} from "@/components/ui/tabs";
import {DataTableWithPagination} from "@/components/wrappers/table/data-table-with-pagination";
import {usersColumns} from "@/components/wrappers/Dashboard/Settings/SettingsUsersTab/columns-users";
import {usersColumns} from "@/components/wrappers/dashboard/Settings/SettingsUsersTab/columns-users";
import {User, Settings} from "@prisma/client";
import {backupColumns} from "@/features/backup/columns";
import {SettingsEmailTab} from "@/components/wrappers/Dashboard/admin/AdminEmailTab/SettingsEmailTab";
import {SettingsStorageTab} from "@/components/wrappers/Dashboard/admin/AdminStorageTab/SettingsStorageTab";
import {SettingsUsersTab} from "@/components/wrappers/Dashboard/Settings/SettingsUsersTab/SettingsUsersTab";
import {SettingsEmailTab} from "@/components/wrappers/dashboard/admin/AdminEmailTab/SettingsEmailTab";
import {SettingsStorageTab} from "@/components/wrappers/dashboard/admin/AdminStorageTab/SettingsStorageTab";
import {SettingsUsersTab} from "@/components/wrappers/dashboard/Settings/SettingsUsersTab/SettingsUsersTab";
export type SettingsTabsProps = {
@@ -1,7 +1,7 @@
import {User} from "@prisma/client";
import {DataTableWithPagination} from "@/components/wrappers/table/data-table-with-pagination";
import {usersColumns} from "@/components/wrappers/Dashboard/Settings/SettingsUsersTab/columns-users";
import {UsersDataTable} from "@/components/wrappers/Dashboard/admin/admin-user-table";
import {usersColumns} from "@/components/wrappers/dashboard/Settings/SettingsUsersTab/columns-users";
import {UsersDataTable} from "@/components/wrappers/dashboard/admin/admin-user-table";
export type SettingsUsersTabProps = {
@@ -3,14 +3,14 @@
import {ColumnDef} from "@tanstack/react-table"
import {Badge} from "@/components/ui/badge";
import {User} from "@prisma/client";
import {updateUserAction} from "@/components/wrappers/Dashboard/Profile/UserForm/user-form.action";
import {updateUserAction} from "@/components/wrappers/dashboard/Profile/UserForm/user-form.action";
import {useMutation} from "@tanstack/react-query";
import {toast} from "sonner";
import {useRouter} from "next/navigation";
import {useState} from "react";
import {Trash2} from "lucide-react";
import {deleteUserAction} from "@/components/wrappers/Dashboard/Profile/ButtonDeleteAccount/delete-account.action";
import {ButtonWithLoading} from "@/components/wrappers/Button/ButtonWithLoading/ButtonWithLoading";
import {deleteUserAction} from "@/components/wrappers/dashboard/Profile/ButtonDeleteAccount/delete-account.action";
import {ButtonWithLoading} from "@/components/wrappers/common/button/ButtonWithLoading/ButtonWithLoading";
export const usersColumns: ColumnDef<User>[] = [
{
@@ -5,7 +5,7 @@ import Link from "next/link";
import {SidebarMenu, SidebarMenuAction, SidebarMenuButton, SidebarMenuItem} from "@/components/ui/sidebar";
import {cn} from "@/lib/utils";
import {buttonVariants} from "@/components/ui/button";
import {ChartArea, FolderKanban, Home, Layers, Settings, ShieldHalf} from "lucide-react";
import {ChartArea, Layers, Settings, ShieldHalf} from "lucide-react";
import {usePathname} from "next/navigation";
export type SidebarMenuCustomProps = {}
@@ -16,11 +16,6 @@ export const SidebarMenuCustom = (props: SidebarMenuCustomProps) => {
const pathname = usePathname();
// Menu items.
const items = [
// {
// title: "Home",
// url: "/",
// icon: Home,
// },
{
title: "Projects",
url: "projects",
@@ -6,9 +6,9 @@ import {
SidebarMenu,
SidebarMenuItem,
} from "@/components/ui/sidebar"
import {LoggedInButton} from "@/components/wrappers/Dashboard/LoggedInButton/LoggedInButton";
import {SidebarMenuCustom} from "@/components/wrappers/Dashboard/SideBar/SideBarMenu/SideBarMenu";
import {OrganizationComboBox} from "@/components/wrappers/Organization/OrganizationCombobox";
import {LoggedInButton} from "@/components/wrappers/dashboard/LoggedInButton/LoggedInButton";
import {SidebarMenuCustom} from "@/components/wrappers/dashboard/SideBar/SideBarMenu/SideBarMenu";
import {OrganizationCombobox} from "@/components/wrappers/dashboard/Organization/organization-combobox";
import {prisma} from "@/prisma";
import {requiredCurrentUser} from "@/auth/current-user";
import {SideBarLogo} from "@/components/wrappers/Dashboard/SideBar/SideBarLogo/SideBarLogo";
@@ -39,7 +39,7 @@ export async function AppSidebar() {
<SideBarLogo/>
<SidebarMenu>
<SidebarMenuItem>
<OrganizationComboBox
<OrganizationCombobox
organizations={organizations}
defaultOrganization={defaultOrganization}
/>
@@ -13,12 +13,12 @@ import {TooltipProvider} from "@/components/ui/tooltip";
import {
EmailFormSchema,
EmailFormType
} from "@/components/wrappers/Dashboard/admin/AdminEmailTab/EmailForm/email-form.schema";
} from "@/components/wrappers/dashboard/admin/AdminEmailTab/EmailForm/email-form.schema";
import Link from "next/link";
import {PasswordInput} from "@/components/wrappers/Auth/PaswordInput/password-input";
import {PasswordInput} from "@/components/wrappers/auth/PaswordInput/password-input";
import {
updateEmailSettingsAction
} from "@/components/wrappers/Dashboard/admin/AdminEmailTab/EmailForm/email-form.action";
} from "@/components/wrappers/dashboard/admin/AdminEmailTab/EmailForm/email-form.action";
import {toast} from "sonner";
import {useRouter} from "next/navigation";
@@ -2,7 +2,7 @@
import {userAction} from "@/safe-actions";
import {z} from "zod";
import {prisma} from "@/prisma";
import {EmailFormSchema} from "@/components/wrappers/Dashboard/admin/AdminEmailTab/EmailForm/email-form.schema";
import {EmailFormSchema} from "@/components/wrappers/dashboard/admin/AdminEmailTab/EmailForm/email-form.schema";
export const updateEmailSettingsAction = userAction
@@ -1,7 +1,7 @@
import {EmailForm} from "@/components/wrappers/Dashboard/admin/AdminEmailTab/EmailForm/EmailForm";
import {EmailForm} from "@/components/wrappers/dashboard/admin/AdminEmailTab/EmailForm/EmailForm";
import {Settings} from "@prisma/client";
import {Send} from "lucide-react";
import {ButtonWithLoading} from "@/components/wrappers/Button/ButtonWithLoading/ButtonWithLoading";
import {ButtonWithLoading} from "@/components/wrappers/common/button/ButtonWithLoading/ButtonWithLoading";
import {useMutation} from "@tanstack/react-query";
import {sendEmail} from "@/utils/email-helper";
import TestEmailSettings from "../../../../../../emails/TestEmailSettings";
@@ -2,18 +2,18 @@ import {Alert, AlertDescription, AlertTitle} from "@/components/ui/alert";
import {Info, Send, ShieldCheck} from "lucide-react";
import {Switch} from "@/components/ui/switch";
import {Label} from "@/components/ui/label";
import {StorageS3Form} from "@/components/wrappers/Dashboard/admin/AdminStorageTab/StorageS3Form/StorageS3Form";
import {StorageS3Form} from "@/components/wrappers/dashboard/admin/AdminStorageTab/StorageS3Form/StorageS3Form";
import {useState} from "react";
import {Settings} from "@prisma/client";
import {ButtonWithLoading} from "@/components/wrappers/Button/ButtonWithLoading/ButtonWithLoading";
import {ButtonWithLoading} from "@/components/wrappers/common/button/ButtonWithLoading/ButtonWithLoading";
import {useMutation} from "@tanstack/react-query";
import {checkConnexionToS3} from "@/features/upload/public/upload.action";
import {toast} from "sonner";
import {updateUserAction} from "@/components/wrappers/Dashboard/Profile/UserForm/user-form.action";
import {updateUserAction} from "@/components/wrappers/dashboard/Profile/UserForm/user-form.action";
import {useRouter} from "next/navigation";
import {
updateStorageSettingsAction
} from "@/components/wrappers/Dashboard/admin/AdminStorageTab/StorageS3Form/s3-form.action";
} from "@/components/wrappers/dashboard/admin/AdminStorageTab/StorageS3Form/s3-form.action";
export type SettingsStorageTabProps = {
@@ -13,12 +13,12 @@ import {TooltipProvider} from "@/components/ui/tooltip";
import {
S3FormSchema,
S3FormType
} from "@/components/wrappers/Dashboard/admin/AdminStorageTab/StorageS3Form/s3-form.schema";
} from "@/components/wrappers/dashboard/admin/AdminStorageTab/StorageS3Form/s3-form.schema";
import {useRouter} from "next/navigation";
import {toast} from "sonner";
import {
updateS3SettingsAction
} from "@/components/wrappers/Dashboard/admin/AdminStorageTab/StorageS3Form/s3-form.action";
} from "@/components/wrappers/dashboard/admin/AdminStorageTab/StorageS3Form/s3-form.action";
export type S3FormProps = {
defaultValues?: S3FormType;
@@ -5,7 +5,7 @@ import {prisma} from "@/prisma";
import {
S3FormSchema,
StorageSwitchSchema
} from "@/components/wrappers/Dashboard/admin/AdminStorageTab/StorageS3Form/s3-form.schema";
} from "@/components/wrappers/dashboard/admin/AdminStorageTab/StorageS3Form/s3-form.schema";
export const updateS3SettingsAction = userAction
@@ -2,9 +2,9 @@
import {User, Settings} from "@prisma/client";
import {Tabs, TabsContent, TabsList, TabsTrigger} from "@/components/ui/tabs";
import {SettingsEmailTab} from "@/components/wrappers/Dashboard/admin/AdminEmailTab/SettingsEmailTab";
import {SettingsStorageTab} from "@/components/wrappers/Dashboard/admin/AdminStorageTab/SettingsStorageTab";
import {AdminUsersTable} from "@/components/wrappers/Dashboard/admin/admin-user-table";
import {SettingsEmailTab} from "@/components/wrappers/dashboard/admin/AdminEmailTab/SettingsEmailTab";
import {SettingsStorageTab} from "@/components/wrappers/dashboard/admin/AdminStorageTab/SettingsStorageTab";
import {AdminUsersTable} from "@/components/wrappers/dashboard/admin/admin-user-table";
export type AdminTabsProps = {
@@ -2,7 +2,7 @@ import {flexRender, Row, RowData} from "@tanstack/react-table";
import {User} from "@prisma/client";
import {DataTableWithPagination} from "@/components/wrappers/table/data-table-with-pagination";
import {usersColumns} from "@/components/wrappers/Dashboard/Settings/SettingsUsersTab/columns-users";
import {usersColumns} from "@/components/wrappers/dashboard/Settings/SettingsUsersTab/columns-users";
import {Table, TableBody, TableCell, TableHead, TableHeader, TableRow} from "@/components/ui/table";
import {cn} from "@/lib/utils";
@@ -10,9 +10,9 @@ import {Button} from "@/components/ui/button";
import {useRouter} from "next/navigation";
import {useMutation} from "@tanstack/react-query";
import {TooltipProvider} from "@/components/ui/tooltip";
import {AgentSchema, AgentType} from "@/components/wrappers/Agent/AgentForm/agent-form.schema";
import {AgentSchema, AgentType} from "@/components/wrappers/dashboard/agent/AgentForm/agent-form.schema";
import {toast} from "sonner";
import {createAgentAction, updateAgentAction} from "@/components/wrappers/Agent/AgentForm/agent-form.action";
import {createAgentAction, updateAgentAction} from "@/components/wrappers/dashboard/agent/AgentForm/agent-form.action";
export type agentFormProps = {
defaultValues?: AgentType;
@@ -1,7 +1,7 @@
"use server"
import {ActionError, userAction} from "@/safe-actions";
import {prisma} from "@/prisma";
import {AgentSchema} from "@/components/wrappers/Agent/AgentForm/agent-form.schema";
import {AgentSchema} from "@/components/wrappers/dashboard/agent/AgentForm/agent-form.schema";
import {z} from "zod";
@@ -14,7 +14,7 @@ import {CodeSnippet} from "@/components/wrappers/CodeSnippet/CodeSnippet";
import {generateEdgeKey} from "@/utils/edge_key";
import {Copy} from "lucide-react";
import {PropsWithChildren, useState} from "react";
import {CopyButton} from "@/components/wrappers/copy-button";
import {CopyButton} from "@/components/wrappers/common/button/copy-button";
import {Agent} from "@prisma/client";
import {getServerUrl} from "@/utils/get-server-url";
@@ -1,6 +1,8 @@
"use server"
import {userAction} from "@/safe-actions";
import {z} from "zod";
import {userAction} from "@/safe-actions";
import {prisma} from "@/prisma";
import {ServerActionResult} from "@/types/action-type";
import {Backup} from "@prisma/client";
@@ -1,9 +1,12 @@
"use client"
import {useMutation} from "@tanstack/react-query";
import {backupButtonAction} from "@/components/wrappers/BackupButton/backup-button.action";
import {toast} from "sonner";
import {useRouter} from "next/navigation";
import {ButtonWithLoading} from "@/components/wrappers/Button/ButtonWithLoading/ButtonWithLoading";
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/ButtonWithLoading/ButtonWithLoading";
export type BackupButtonProps = {
databaseId: string
@@ -9,7 +9,7 @@ import {
DialogTitle,
DialogTrigger
} from "@/components/ui/dialog";
import {CronInput} from "@/components/wrappers/Database/CronButton/CronInput";
import {CronInput} from "@/components/wrappers/dashboard/database/CronButton/CronInput";
import {Switch} from "@/components/ui/switch";
import {Label} from "@/components/ui/label"
import {Separator} from "@/components/ui/separator";
@@ -17,14 +17,14 @@ import {useState} from "react";
import {useMutation} from "@tanstack/react-query";
import {
updateStorageSettingsAction
} from "@/components/wrappers/Dashboard/admin/AdminStorageTab/StorageS3Form/s3-form.action";
} from "@/components/wrappers/dashboard/admin/AdminStorageTab/StorageS3Form/s3-form.action";
import {toast} from "sonner";
import {useRouter} from "next/navigation";
import {Database} from "@prisma/client";
import {
updateBackupPolicyAction,
updateDatabaseBackupPolicyAction
} from "@/components/wrappers/Database/CronButton/cron.action";
} from "@/components/wrappers/dashboard/database/CronButton/cron.action";
export type CronButtonProps = {
@@ -2,7 +2,7 @@ import { AdvancedCronSelect } from "./AdvancedCronSelect";
import {
updateBackupPolicyAction,
updateDatabaseBackupPolicyAction
} from "@/components/wrappers/Database/CronButton/cron.action";
} from "@/components/wrappers/dashboard/database/CronButton/cron.action";
import {useMutation} from "@tanstack/react-query";
import {useState} from "react";
import {useRouter} from "next/navigation";
@@ -16,8 +16,8 @@ import {Button} from "@/components/ui/button";
import {useRouter} from "next/navigation";
import {useMutation} from "@tanstack/react-query";
import {TooltipProvider} from "@/components/ui/tooltip";
import {DatabaseSchema, DatabaseType} from "@/components/wrappers/Database/DatabaseForm/form-database.schema";
import {updateDatabaseAction} from "@/components/wrappers/Database/DatabaseForm/form-database.action";
import {DatabaseSchema, DatabaseType} from "@/components/wrappers/dashboard/database/DatabaseForm/form-database.schema";
import {updateDatabaseAction} from "@/components/wrappers/dashboard/database/DatabaseForm/form-database.action";
import {toast} from "sonner";
export type DatabaseFormProps = {
@@ -4,7 +4,7 @@ import {z} from "zod";
import {userAction} from "@/safe-actions";
import {prisma} from "@/prisma";
import {DatabaseSchema} from "@/components/wrappers/Database/DatabaseForm/form-database.schema";
import {DatabaseSchema} from "@/components/wrappers/dashboard/database/DatabaseForm/form-database.schema";
export const updateDatabaseAction = userAction
@@ -14,10 +14,10 @@ import {
useZodForm
} from "@/components/ui/form";
import {Input} from "@/components/ui/input";
import {RestoreSchema} from "@/components/wrappers/Database/restore-form.schema";
import {RestoreSchema} from "@/components/wrappers/dashboard/database/restore-form.schema";
import {Select, SelectContent, SelectItem, SelectTrigger, SelectValue} from "@/components/ui/select";
import {useMutation} from "@tanstack/react-query";
import {ComboBox, ComboBoxFormItem} from "@/components/wrappers/combobox";
import {ComboBox, ComboBoxFormItem} from "@/components/wrappers/common/combobox";
import {Label} from "@/components/ui/label";
export type restoreFormProps = {
+1 -1
View File
@@ -1,7 +1,7 @@
import {notFound} from "next/navigation";
import {currentUser} from "@/auth/current-user";
import {LoggedInButton} from "@/components/wrappers/Dashboard/LoggedInButton/LoggedInButton";
import {LoggedInButton} from "@/components/wrappers/dashboard/LoggedInButton/LoggedInButton";
import {SidebarTrigger} from "@/components/ui/sidebar";
import {ModeToggle} from "@/features/theme/ModeToggle";
@@ -1,4 +1,5 @@
"use server"
import {mkdir, writeFile} from "fs/promises";
import path from "path";
import * as fs from "node:fs";
@@ -1,4 +1,5 @@
"use server"
import {userAction} from "@/safe-actions";
import {z} from "zod";
import {v4 as uuidv4} from 'uuid';
-1
View File
@@ -6,6 +6,5 @@ export const isValidCronPart = (type: string, value: string): boolean => {
month: /^(\*|([1-9]|1[0-2])|(\d+(,\d+)*|(\d+-\d+)|(\*\/\d+)))$/,
"day-of-week": /^(\*|[0-6]|(\d+(,\d+)*|(\d+-\d+)|(\*\/\d+)))$/,
};
return regexMap[type]?.test(value) ?? false;
};