mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-13 18:28:38 +02:00
Add system for managing and scheduling data backups
Introduce a new backup management feature with automated scheduling, manual backups, and a dedicated interface for viewing backup status and details. This includes integrating `node-cron` for scheduling, updating the database schema to store backup information, and creating new routes and components for the backup manager. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 7c468936-2a88-4686-ac0a-84921a45222d Replit-Commit-Checkpoint-Type: full_checkpoint Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/7c468936-2a88-4686-ac0a-84921a45222d/9xfbVBU
This commit is contained in:
1 parent
bfc90053f0
commit
fbeb36c04a
9 files changed
+131
-58
No files matched your search
@@ -138,7 +138,7 @@ export default function Layout({ children }: LayoutProps) {
|
||||
<div className="flex items-center gap-2">
|
||||
<div
|
||||
className="w-3 h-3"
|
||||
style={{ backgroundColor: store.color }}
|
||||
style={{ backgroundColor: store.color || '#gray-400' }}
|
||||
/>
|
||||
<span>{store.name}</span>
|
||||
</div>
|
||||
|
||||
@@ -17,6 +17,7 @@ import DatabaseDebug from "@/pages/DatabaseDebug";
|
||||
import CustomerOrders from "@/pages/CustomerOrders";
|
||||
|
||||
import DlcPage from "@/pages/DlcPage";
|
||||
import BackupManager from "@/pages/BackupManager";
|
||||
import Tasks from "@/pages/Tasks";
|
||||
import TasksSimplified from "@/pages/TasksSimplified";
|
||||
import Layout from "@/components/Layout";
|
||||
@@ -76,6 +77,7 @@ function RouterProduction() {
|
||||
<Route path="/publicities" component={Publicities} />
|
||||
<Route path="/customer-orders" component={CustomerOrders} />
|
||||
<Route path="/dlc" component={DlcPage} />
|
||||
<Route path="/backup" component={BackupManager} />
|
||||
<Route path="/tasks" component={Tasks} />
|
||||
<Route path="/nocodb-config" component={NocoDBConfig} />
|
||||
<Route path="/database-debug" component={DatabaseDebug} />
|
||||
|
||||
@@ -146,6 +146,12 @@ export default function Sidebar() {
|
||||
icon: UserCog,
|
||||
roles: ["admin"]
|
||||
},
|
||||
{
|
||||
path: "/backup",
|
||||
label: "Sauvegardes",
|
||||
icon: Database,
|
||||
roles: ["admin"]
|
||||
},
|
||||
{
|
||||
path: "/nocodb-config",
|
||||
label: "Configuration NocoDB",
|
||||
|
||||
@@ -24,9 +24,13 @@ import { fr } from "date-fns/locale";
|
||||
interface BackupFile {
|
||||
id: string;
|
||||
filename: string;
|
||||
description: string | null;
|
||||
size: number;
|
||||
createdAt: string;
|
||||
type: 'manual' | 'automatic';
|
||||
createdBy: string;
|
||||
tablesCount: number;
|
||||
status: string;
|
||||
backupType: string;
|
||||
}
|
||||
|
||||
export default function BackupManager() {
|
||||
@@ -118,6 +122,19 @@ export default function BackupManager() {
|
||||
: <Badge variant="outline">Manuelle</Badge>;
|
||||
};
|
||||
|
||||
const getStatusBadge = (status: string) => {
|
||||
switch (status) {
|
||||
case 'completed':
|
||||
return <Badge className="bg-green-100 text-green-800">Terminé</Badge>;
|
||||
case 'creating':
|
||||
return <Badge className="bg-blue-100 text-blue-800">En cours</Badge>;
|
||||
case 'failed':
|
||||
return <Badge variant="destructive">Échec</Badge>;
|
||||
default:
|
||||
return <Badge variant="outline">{status}</Badge>;
|
||||
}
|
||||
};
|
||||
|
||||
if (!canManageBackups) {
|
||||
return (
|
||||
<div className="flex-1 flex items-center justify-center">
|
||||
@@ -254,7 +271,7 @@ export default function BackupManager() {
|
||||
>
|
||||
<div className="flex items-center space-x-4">
|
||||
<div className="flex items-center space-x-2">
|
||||
{getTypeIcon(backup.type)}
|
||||
{getTypeIcon(backup.backupType)}
|
||||
<FileText className="w-5 h-5 text-gray-400" />
|
||||
</div>
|
||||
|
||||
@@ -262,12 +279,17 @@ export default function BackupManager() {
|
||||
<div className="font-medium text-gray-900">
|
||||
{backup.filename}
|
||||
</div>
|
||||
<div className="text-sm text-gray-500 flex items-center space-x-4">
|
||||
<div className="text-sm text-gray-500">
|
||||
{backup.description || 'Sauvegarde de base de données'}
|
||||
</div>
|
||||
<div className="text-sm text-gray-500 flex items-center space-x-4 mt-1">
|
||||
<span>
|
||||
{format(new Date(backup.createdAt), 'dd/MM/yyyy à HH:mm', { locale: fr })}
|
||||
</span>
|
||||
<span>{formatFileSize(backup.size)}</span>
|
||||
{getTypeBadge(backup.type)}
|
||||
<span>{backup.tablesCount} tables</span>
|
||||
{getTypeBadge(backup.backupType)}
|
||||
{getStatusBadge(backup.status)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user