diff --git a/attached_assets/image_1755119737827.png b/attached_assets/image_1755119737827.png new file mode 100644 index 0000000..78633b0 Binary files /dev/null and b/attached_assets/image_1755119737827.png differ diff --git a/client/src/components/RouterProduction.tsx b/client/src/components/RouterProduction.tsx index bb5f6e8..53f7a54 100644 --- a/client/src/components/RouterProduction.tsx +++ b/client/src/components/RouterProduction.tsx @@ -18,6 +18,7 @@ import CustomerOrders from "@/pages/CustomerOrders"; import DlcPage from "@/pages/DlcPage"; import BackupManager from "@/pages/BackupManager"; +import Utilities from "@/pages/Utilities"; import Tasks from "@/pages/Tasks"; import TasksSimplified from "@/pages/TasksSimplified"; import Layout from "@/components/Layout"; @@ -77,10 +78,14 @@ function RouterProduction() { - + - - + + {/* Routes de compatibilité - redirection vers utilities */} + + + + diff --git a/client/src/components/Sidebar.tsx b/client/src/components/Sidebar.tsx index 0675126..516881e 100644 --- a/client/src/components/Sidebar.tsx +++ b/client/src/components/Sidebar.tsx @@ -21,7 +21,8 @@ import { ListTodo, ChevronLeft, ChevronRight, - X + X, + Settings } from "lucide-react"; export default function Sidebar() { @@ -147,21 +148,9 @@ export default function Sidebar() { roles: ["admin"] }, { - path: "/backup", - label: "Sauvegardes", - icon: Database, - roles: ["admin"] - }, - { - path: "/nocodb-config", - label: "Configuration NocoDB", - icon: Database, - roles: ["admin"] - }, - { - path: "/database-debug", - label: "Debug Base de Données", - icon: Database, + path: "/utilities", + label: "Utilitaires", + icon: Settings, roles: ["admin"] }, ]; diff --git a/client/src/pages/Utilities.tsx b/client/src/pages/Utilities.tsx new file mode 100644 index 0000000..3b9cc19 --- /dev/null +++ b/client/src/pages/Utilities.tsx @@ -0,0 +1,121 @@ +import { useState } from "react"; +import { useAuthUnified } from "@/hooks/useAuthUnified"; +import { hasPermission } from "@/lib/permissions"; +import { + Settings, + Database, + Server, + Bug +} from "lucide-react"; +import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"; +import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; +import { AlertTriangle } from "lucide-react"; + +// Import des composants existants +import BackupManager from "./BackupManager"; +import NocoDBConfig from "./NocoDBConfig"; +import DatabaseDebug from "./DatabaseDebug"; + +export default function Utilities() { + const { user } = useAuthUnified(); + // Détecter l'onglet actif basé sur l'URL pour la compatibilité + const [activeTab, setActiveTab] = useState(() => { + const path = window.location.pathname; + if (path === '/backup') return 'backups'; + if (path === '/nocodb-config') return 'nocodb'; + if (path === '/database-debug') return 'debug'; + return 'backups'; + }); + + // Vérification des permissions pour chaque onglet + const canManageBackups = hasPermission(user?.role || '', 'backups', 'manage'); + const canManageNocoDB = user?.role === 'admin'; + const canDebugDatabase = user?.role === 'admin'; + + // Si l'utilisateur n'a aucune permission, afficher le message d'accès refusé + if (!canManageBackups && !canManageNocoDB && !canDebugDatabase) { + return ( +
+ + + + Accès refusé + + Vous n'avez pas les permissions nécessaires pour accéder aux utilitaires d'administration. + + + +
+ ); + } + + return ( +
+ {/* Header */} +
+
+ +
+

+ Utilitaires d'Administration +

+

+ Outils de gestion et de maintenance du système +

+
+
+
+ + {/* Content avec onglets */} +
+ + + {canManageBackups && ( + + + Sauvegardes + + )} + {canManageNocoDB && ( + + + Configuration NocoDB + + )} + {canDebugDatabase && ( + + + Debug Base de Données + + )} + + + {/* Contenu des onglets */} + {canManageBackups && ( + +
+ +
+
+ )} + + {canManageNocoDB && ( + +
+ +
+
+ )} + + {canDebugDatabase && ( + +
+ +
+
+ )} +
+
+
+ ); +} \ No newline at end of file