Spaces:
Sleeping
Sleeping
Update templates/api_logs.html
Browse files- templates/api_logs.html +321 -281
templates/api_logs.html
CHANGED
|
@@ -1,282 +1,322 @@
|
|
| 1 |
-
<!DOCTYPE html>
|
| 2 |
-
<html lang="fr" class="dark">
|
| 3 |
-
<head>
|
| 4 |
-
<meta charset="UTF-8">
|
| 5 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
-
<title>Logs API -
|
| 7 |
-
<
|
| 8 |
-
<
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
/*
|
| 21 |
-
:
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
/*
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
| 153 |
-
|
| 154 |
-
|
| 155 |
-
|
| 156 |
-
|
| 157 |
-
|
| 158 |
-
|
| 159 |
-
|
| 160 |
-
<
|
| 161 |
-
|
| 162 |
-
|
| 163 |
-
|
| 164 |
-
|
| 165 |
-
|
| 166 |
-
<
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
|
| 171 |
-
</
|
| 172 |
-
|
| 173 |
-
<
|
| 174 |
-
|
| 175 |
-
|
| 176 |
-
|
| 177 |
-
|
| 178 |
-
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
|
| 190 |
-
|
| 191 |
-
|
| 192 |
-
|
| 193 |
-
|
| 194 |
-
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
| 222 |
-
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
|
| 226 |
-
|
| 227 |
-
|
| 228 |
-
|
| 229 |
-
|
| 230 |
-
|
| 231 |
-
|
| 232 |
-
|
| 233 |
-
|
| 234 |
-
|
| 235 |
-
|
| 236 |
-
|
| 237 |
-
|
| 238 |
-
|
| 239 |
-
|
| 240 |
-
|
| 241 |
-
|
| 242 |
-
|
| 243 |
-
|
| 244 |
-
<div>
|
| 245 |
-
|
| 246 |
-
|
| 247 |
-
|
| 248 |
-
|
| 249 |
-
|
| 250 |
-
|
| 251 |
-
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
|
| 255 |
-
|
| 256 |
-
|
| 257 |
-
|
| 258 |
-
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
|
| 265 |
-
|
| 266 |
-
|
| 267 |
-
|
| 268 |
-
|
| 269 |
-
|
| 270 |
-
|
| 271 |
-
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 282 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="fr" class="dark">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Nexus | Logs d'API - Pro</title>
|
| 7 |
+
<link rel="icon" type="image/png" href="https://i.imgur.com/7Gn3toV.png">
|
| 8 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 9 |
+
<link rel="stylesheet"
|
| 10 |
+
href="https://fonts.googleapis.com/css2?family=Material+Symbols+Rounded:opsz,wght,FILL,GRAD@24,400,0,0" />
|
| 11 |
+
<style>
|
| 12 |
+
/* Configuration de la police Inter */
|
| 13 |
+
body { font-family: 'Inter', sans-serif; }
|
| 14 |
+
|
| 15 |
+
/* Définition des variables de thème (Ajoutées pour le style) */
|
| 16 |
+
:root {
|
| 17 |
+
/* Couleurs de base (exemple - ajustez si nécessaire) */
|
| 18 |
+
--page-var: #f8fafc; /* light - slate-50 */
|
| 19 |
+
--color-var: #0f172a; /* light - slate-900 */
|
| 20 |
+
--secondary-var: #64748b; /* light - slate-500 */
|
| 21 |
+
--card-var: #ffffff; /* light - white */
|
| 22 |
+
--sidebar-var: #e2e8f0; /* light - slate-200 */
|
| 23 |
+
--sidebar-active-var: #cbd5e1; /* light - slate-300 */
|
| 24 |
+
--input-var: #f1f5f9; /* light - slate-100 */
|
| 25 |
+
--primary-color-var: #4f46e5; /* indigo-600 */
|
| 26 |
+
--primary-hover-var: #4338ca; /* indigo-700 */
|
| 27 |
+
--error-var: #fef2f2; /* red-50 */
|
| 28 |
+
--success-var: #f0fdf4; /* green-50 */
|
| 29 |
+
--warning-var: #fcd34d; /* amber-400 */
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
.dark {
|
| 33 |
+
--page-var: #18181b; /* dark - zinc-900 (Gris très foncé pour l'arrière-plan de la page) */
|
| 34 |
+
--color-var: #f4f4f5; /* dark - zinc-100 (Texte clair) */
|
| 35 |
+
--secondary-var: #a1a1aa; /* dark - zinc-400 (Texte secondaire) */
|
| 36 |
+
--card-var: #27272a; /* dark - zinc-800 (Gris foncé pour les cartes et la sidebar) */
|
| 37 |
+
--sidebar-var: #27272a; /* dark - zinc-800 */
|
| 38 |
+
--sidebar-active-var: #3f3f46; /* dark - zinc-700 (Gris un peu plus clair pour l'actif) */
|
| 39 |
+
--input-var: #18181b; /* dark - zinc-900 (Fond de champ de saisie) */
|
| 40 |
+
--primary-color-var: #6366f1; /* indigo-500 (Couleur primaire inchangée) */
|
| 41 |
+
--primary-hover-var: #4f46e5; /* indigo-600 */
|
| 42 |
+
--error-var: #450a0a; /* red-950 */
|
| 43 |
+
--success-var: #052e16; /* green-950 */
|
| 44 |
+
--warning-var: #b45309; /* amber-800 */
|
| 45 |
+
}
|
| 46 |
+
|
| 47 |
+
/* Transition pour un effet doux des couleurs */
|
| 48 |
+
.transition-colors-theme { transition: background-color 0.3s, color 0.3s, border-color 0.3s; }
|
| 49 |
+
|
| 50 |
+
/* Style et positionnement du bouton de Thème */
|
| 51 |
+
.theme-switch {
|
| 52 |
+
background: none;
|
| 53 |
+
border: none;
|
| 54 |
+
cursor: pointer;
|
| 55 |
+
font-size: 24px;
|
| 56 |
+
transition: color 0.2s;
|
| 57 |
+
position: fixed; /* Reste fixe même si le reste défile */
|
| 58 |
+
top: 1rem;
|
| 59 |
+
right: 1rem;
|
| 60 |
+
z-index: 50; /* Doit être au-dessus du reste */
|
| 61 |
+
}
|
| 62 |
+
|
| 63 |
+
/* Style pour la sidebar responsive */
|
| 64 |
+
.sidebar {
|
| 65 |
+
position: fixed;
|
| 66 |
+
top: 0;
|
| 67 |
+
left: 0;
|
| 68 |
+
height: 100vh;
|
| 69 |
+
z-index: 40;
|
| 70 |
+
transform: translateX(-100%);
|
| 71 |
+
}
|
| 72 |
+
|
| 73 |
+
/* Styles pour le mode desktop/large screen */
|
| 74 |
+
@media (min-width: 1024px) {
|
| 75 |
+
.sidebar {
|
| 76 |
+
transform: translateX(0);
|
| 77 |
+
}
|
| 78 |
+
.main-content {
|
| 79 |
+
margin-left: 16rem; /* 64px width */
|
| 80 |
+
}
|
| 81 |
+
}
|
| 82 |
+
|
| 83 |
+
/* Styles pour le mode mobile/tablet */
|
| 84 |
+
@media (max-width: 1023px) {
|
| 85 |
+
.sidebar {
|
| 86 |
+
transition: transform 0.3s ease-in-out;
|
| 87 |
+
}
|
| 88 |
+
.sidebar.open {
|
| 89 |
+
transform: translateX(0);
|
| 90 |
+
}
|
| 91 |
+
}
|
| 92 |
+
|
| 93 |
+
/* Ajout des styles pour les variables CSS dans Tailwind */
|
| 94 |
+
.bg-page-var { background-color: var(--page-var); }
|
| 95 |
+
.text-color-var { color: var(--color-var); }
|
| 96 |
+
.text-secondary-var { color: var(--secondary-var); }
|
| 97 |
+
.bg-card-var { background-color: var(--card-var); }
|
| 98 |
+
.bg-sidebar-var { background-color: var(--sidebar-var); }
|
| 99 |
+
.border-sidebar-var { border-color: var(--sidebar-var); }
|
| 100 |
+
.bg-sidebar-active-var { background-color: var(--sidebar-active-var); }
|
| 101 |
+
.bg-input-var { background-color: var(--input-var); }
|
| 102 |
+
.border-input-var { border-color: var(--input-var); }
|
| 103 |
+
.text-primary-color-var { color: var(--primary-color-var); }
|
| 104 |
+
.focus\:ring-primary-color-var:focus { --tw-ring-color: var(--primary-color-var); }
|
| 105 |
+
.focus\:border-primary-color-var:focus { border-color: var(--primary-color-var); }
|
| 106 |
+
.bg-primary-color-var { background-color: var(--primary-color-var); }
|
| 107 |
+
.hover\:bg-primary-hover-var:hover { background-color: var(--primary-hover-var); }
|
| 108 |
+
.hover\:bg-sidebar-active-var:hover { background-color: var(--sidebar-active-var); }
|
| 109 |
+
.hover\:bg-sidebar-active-var\/80:hover { background-color: color-mix(in srgb, var(--sidebar-active-var) 80%, transparent); }
|
| 110 |
+
|
| 111 |
+
/* Correction pour les messages flash pour utiliser les variables */
|
| 112 |
+
.bg-red-900\/20 { background-color: color-mix(in srgb, var(--error-var) 20%, transparent); } /* Approximation des couleurs spécifiques */
|
| 113 |
+
.text-red-500 { color: #ef4444; } /* Laissez le rouge spécifique pour les erreurs */
|
| 114 |
+
.border-red-900 { border-color: #7f1d1d; } /* Laissez le rouge spécifique pour les erreurs */
|
| 115 |
+
.bg-green-900\/20 { background-color: color-mix(in srgb, var(--success-var) 20%, transparent); } /* Approximation des couleurs spécifiques */
|
| 116 |
+
.text-green-500 { color: #22c55e; } /* Laissez le vert spécifique pour le succès */
|
| 117 |
+
.border-green-900 { border-color: #064e3b; } /* Laissez le vert spécifique pour le succès */
|
| 118 |
+
.hover\:text-link-hover-var:hover { color: var(--secondary-var); } /* Ajout d'une pseudo-variable pour le hover de l'icône de thème (simple fallback) */
|
| 119 |
+
|
| 120 |
+
</style>
|
| 121 |
+
</head>
|
| 122 |
+
|
| 123 |
+
<body class="bg-page-var text-color-var min-h-screen transition-colors-theme">
|
| 124 |
+
|
| 125 |
+
<button id="theme-switch" class="theme-switch text-color-var hover:text-link-hover-var transition-colors-theme">
|
| 126 |
+
<span class="material-symbols-rounded">dark_mode</span>
|
| 127 |
+
</button>
|
| 128 |
+
|
| 129 |
+
<aside id="sidebar" class="sidebar w-64 bg-sidebar-var border-r border-sidebar-var p-6 lg:block transition-colors-theme">
|
| 130 |
+
<div class="flex items-center mb-10">
|
| 131 |
+
<img src="https://i.imgur.com/7Gn3toV.png" alt="Nexus Pro Logo" class="h-8">
|
| 132 |
+
<span class="text-xl font-bold text-color-var ml-2 transition-colors-theme">Nexus Pro</span>
|
| 133 |
+
</div>
|
| 134 |
+
|
| 135 |
+
<nav class="space-y-3">
|
| 136 |
+
<a href="{{ url_for('user_bp.dashboard') }}" class="flex items-center p-3 text-secondary-var hover:text-color-var hover:bg-sidebar-active-var rounded-lg transition duration-150 transition-colors-theme">
|
| 137 |
+
<span class="material-symbols-rounded">dashboard</span>
|
| 138 |
+
<span class="ml-3">Dashboard</span>
|
| 139 |
+
</a>
|
| 140 |
+
<a href="{{ url_for('user_bp.api_key') }}" class="flex items-center p-3 text-secondary-var hover:text-color-var hover:bg-sidebar-active-var rounded-lg transition duration-150 transition-colors-theme">
|
| 141 |
+
<span class="material-symbols-rounded">key</span>
|
| 142 |
+
<span class="ml-3">Clés API</span>
|
| 143 |
+
</a>
|
| 144 |
+
<a href="{{ url_for('user_bp.profile') }}" class="flex items-center p-3 text-secondary-var hover:text-color-var hover:bg-sidebar-active-var rounded-lg transition duration-150 transition-colors-theme">
|
| 145 |
+
<span class="material-symbols-rounded">person</span>
|
| 146 |
+
<span class="ml-3">Profil</span>
|
| 147 |
+
</a>
|
| 148 |
+
<a href="/api_logs" class="flex items-center p-3 bg-sidebar-active-var text-color-var rounded-lg transition duration-150 transition-colors-theme">
|
| 149 |
+
<span class="material-symbols-rounded">list_alt</span>
|
| 150 |
+
<span class="ml-3">Logs d'API</span>
|
| 151 |
+
</a>
|
| 152 |
+
<a href="/tarifs" class="flex items-center p-3 text-secondary-var hover:text-color-var hover:bg-sidebar-active-var rounded-lg transition duration-150 transition-colors-theme">
|
| 153 |
+
<span class="material-symbols-rounded">payments</span>
|
| 154 |
+
<span class="ml-3">Tarifs</span>
|
| 155 |
+
</a>
|
| 156 |
+
<a href="/statut" class="flex items-center p-3 text-secondary-var hover:text-color-var hover:bg-sidebar-active-var rounded-lg transition duration-150 transition-colors-theme">
|
| 157 |
+
<span class="material-symbols-rounded">monitor_heart</span>
|
| 158 |
+
<span class="ml-3">Statut de l'API</span>
|
| 159 |
+
</a>
|
| 160 |
+
<a href="{{ url_for('user_bp.deconnexion') }}" id="logout-button-sidebar" class="flex items-center p-3 text-red-500 hover:text-red-400 hover:bg-sidebar-active-var rounded-lg transition duration-150 transition-colors-theme">
|
| 161 |
+
<span class="material-symbols-rounded">logout</span>
|
| 162 |
+
<span class="ml-3">Déconnexion</span>
|
| 163 |
+
</a>
|
| 164 |
+
</nav>
|
| 165 |
+
|
| 166 |
+
<div class="absolute bottom-6 w-52 text-xs text-secondary-var transition-colors-theme">
|
| 167 |
+
<p>Connecté en tant que: <span class="font-semibold text-color-var transition-colors-theme">{{ user.email if user and user.email else 'Chargement...' }}</span></p>
|
| 168 |
+
<p>Plan: <span class="font-semibold text-color-var transition-colors-theme">{{ (user.plan | upper) if user and user.plan else 'GRATUIT' }}</span></p>
|
| 169 |
+
</div>
|
| 170 |
+
|
| 171 |
+
</aside>
|
| 172 |
+
|
| 173 |
+
<div id="main-content" class="main-content p-8 transition-colors-theme">
|
| 174 |
+
|
| 175 |
+
<header class="lg:hidden flex justify-between items-center mb-8">
|
| 176 |
+
<div class="flex items-center">
|
| 177 |
+
<img src="https://i.imgur.com/7Gn3toV.png" alt="Nexus Pro Logo" class="h-8">
|
| 178 |
+
<span class="text-xl font-bold text-color-var ml-2 transition-colors-theme">Nexus Pro</span>
|
| 179 |
+
</div>
|
| 180 |
+
<button id="sidebar-toggle" class="p-2 rounded-lg bg-sidebar-active-var hover:bg-sidebar-active-var/80 transition-colors-theme">
|
| 181 |
+
<span class="material-symbols-rounded text-color-var">menu</span>
|
| 182 |
+
</button>
|
| 183 |
+
</header>
|
| 184 |
+
|
| 185 |
+
<h1 class="text-3xl font-bold mb-8 text-color-var transition-colors-theme">Logs d'API Utilisateur</h1>
|
| 186 |
+
|
| 187 |
+
{% with messages = get_flashed_messages(with_categories=true) %}
|
| 188 |
+
{% if messages %}
|
| 189 |
+
{% for category, message in messages %}
|
| 190 |
+
<div class="p-4 mb-4 text-sm rounded-lg border border-transparent
|
| 191 |
+
{{ 'bg-red-900/20 text-red-500 border-red-900' if category == 'error' or category == 'danger' or category == 'warning' else 'bg-green-900/20 text-green-500 border-green-900' }}" role="alert">
|
| 192 |
+
{{ message }}
|
| 193 |
+
</div>
|
| 194 |
+
{% endfor %}
|
| 195 |
+
{% endif %}
|
| 196 |
+
{% endwith %}
|
| 197 |
+
|
| 198 |
+
<div class="bg-card-var p-6 rounded-lg shadow-xl border border-sidebar-var transition-colors-theme mb-8">
|
| 199 |
+
<h2 class="text-xl font-semibold mb-4 flex items-center text-color-var transition-colors-theme">
|
| 200 |
+
<span class="material-symbols-rounded mr-2">history</span>
|
| 201 |
+
Historique des Requêtes API
|
| 202 |
+
</h2>
|
| 203 |
+
<p class="text-secondary-var mb-6 text-sm transition-colors-theme">Retrouvez ici les 100 dernières requêtes effectuées sur l'API Nexus.</p>
|
| 204 |
+
|
| 205 |
+
<div class="overflow-x-auto">
|
| 206 |
+
<table class="min-w-full divide-y divide-sidebar-active-var transition-colors-theme">
|
| 207 |
+
<thead>
|
| 208 |
+
<tr class="text-left text-sm font-semibold text-secondary-var uppercase tracking-wider bg-input-var transition-colors-theme">
|
| 209 |
+
<th class="px-4 py-3">Date</th>
|
| 210 |
+
<th class="px-4 py-3">Endpoint</th>
|
| 211 |
+
<th class="px-4 py-3">Méthode</th>
|
| 212 |
+
<th class="px-4 py-3">Statut</th>
|
| 213 |
+
<th class="px-4 py-3">Temps (ms)</th>
|
| 214 |
+
</tr>
|
| 215 |
+
</thead>
|
| 216 |
+
<tbody class="divide-y divide-sidebar-active-var transition-colors-theme text-sm">
|
| 217 |
+
{% if api_logs and api_logs|length > 0 %}
|
| 218 |
+
{% for log in api_logs %}
|
| 219 |
+
<tr class="text-color-var hover:bg-sidebar-active-var/80 transition-colors-theme">
|
| 220 |
+
<td class="px-4 py-3 whitespace-nowrap">{{ log.timestamp }}</td>
|
| 221 |
+
<td class="px-4 py-3 whitespace-nowrap">{{ log.endpoint }}</td>
|
| 222 |
+
<td class="px-4 py-3 whitespace-nowrap">{{ log.method }}</td>
|
| 223 |
+
<td class="px-4 py-3 whitespace-nowrap">
|
| 224 |
+
{% if log.status_code >= 200 and log.status_code < 300 %}
|
| 225 |
+
<span class="text-green-500 font-medium">Succès ({{ log.status_code }})</span>
|
| 226 |
+
{% elif log.status_code >= 400 and log.status_code < 500 %}
|
| 227 |
+
<span class="text-red-500 font-medium">Erreur Client ({{ log.status_code }})</span>
|
| 228 |
+
{% elif log.status_code >= 500 %}
|
| 229 |
+
<span class="text-red-500 font-medium">Erreur Serveur ({{ log.status_code }})</span>
|
| 230 |
+
{% else %}
|
| 231 |
+
<span class="text-secondary-var">{{ log.status_code }}</span>
|
| 232 |
+
{% endif %}
|
| 233 |
+
</td>
|
| 234 |
+
<td class="px-4 py-3 whitespace-nowrap">{{ log.response_time_ms }}</td>
|
| 235 |
+
</tr>
|
| 236 |
+
{% endfor %}
|
| 237 |
+
{% else %}
|
| 238 |
+
<tr class="text-secondary-var">
|
| 239 |
+
<td colspan="5" class="px-4 py-6 text-center">Aucun log d'API trouvé pour le moment.</td>
|
| 240 |
+
</tr>
|
| 241 |
+
{% endif %}
|
| 242 |
+
</tbody>
|
| 243 |
+
</table>
|
| 244 |
+
</div>
|
| 245 |
+
|
| 246 |
+
</div>
|
| 247 |
+
|
| 248 |
+
</div>
|
| 249 |
+
|
| 250 |
+
<script>
|
| 251 |
+
|
| 252 |
+
// Fonction utilitaire pour appliquer le thème
|
| 253 |
+
function applyTheme(theme) {
|
| 254 |
+
if (theme === 'dark') {
|
| 255 |
+
document.documentElement.classList.add('dark');
|
| 256 |
+
localStorage.setItem('theme', 'dark');
|
| 257 |
+
} else {
|
| 258 |
+
document.documentElement.classList.remove('dark');
|
| 259 |
+
localStorage.setItem('theme', 'light');
|
| 260 |
+
}
|
| 261 |
+
// Mettre à jour l'icône du switch si nécessaire
|
| 262 |
+
const icon = document.querySelector('#theme-switch .material-symbols-rounded');
|
| 263 |
+
if (icon) {
|
| 264 |
+
// S'assurer que l'icône reflète le mode ACTIF
|
| 265 |
+
icon.textContent = theme === 'dark' ? 'light_mode' : 'dark_mode';
|
| 266 |
+
}
|
| 267 |
+
}
|
| 268 |
+
|
| 269 |
+
// 1. Initialisation du thème au chargement
|
| 270 |
+
// Récupérer le thème sauvé ou utiliser 'dark' comme défaut
|
| 271 |
+
const savedTheme = localStorage.getItem('theme') || 'dark';
|
| 272 |
+
applyTheme(savedTheme);
|
| 273 |
+
|
| 274 |
+
// 2. Logique du switch de thème
|
| 275 |
+
document.getElementById('theme-switch').addEventListener('click', () => {
|
| 276 |
+
// Vérifier si la classe 'dark' est présente sur l'élément racine
|
| 277 |
+
const currentTheme = document.documentElement.classList.contains('dark') ? 'dark' : 'light';
|
| 278 |
+
const newTheme = currentTheme === 'light' ? 'dark' : 'light';
|
| 279 |
+
applyTheme(newTheme);
|
| 280 |
+
});
|
| 281 |
+
|
| 282 |
+
// 3. Logique de bascule de la sidebar pour mobile/tablette
|
| 283 |
+
const sidebarToggle = document.getElementById('sidebar-toggle');
|
| 284 |
+
const sidebar = document.getElementById('sidebar');
|
| 285 |
+
|
| 286 |
+
if (sidebarToggle && sidebar) {
|
| 287 |
+
sidebarToggle.addEventListener('click', () => {
|
| 288 |
+
sidebar.classList.toggle('open');
|
| 289 |
+
});
|
| 290 |
+
}
|
| 291 |
+
|
| 292 |
+
// 4. Fermeture de la sidebar lors du clic sur un lien (pour mobile)
|
| 293 |
+
// Note: Assurez-vous que 'sidebar' est défini avant d'appeler querySelectorAll
|
| 294 |
+
if (sidebar) {
|
| 295 |
+
const sidebarLinks = sidebar.querySelectorAll('a');
|
| 296 |
+
if (sidebarLinks) {
|
| 297 |
+
sidebarLinks.forEach(link => {
|
| 298 |
+
link.addEventListener('click', () => {
|
| 299 |
+
// Fermer la sidebar uniquement sur les petits écrans
|
| 300 |
+
if (window.innerWidth < 1024) {
|
| 301 |
+
sidebar.classList.remove('open');
|
| 302 |
+
}
|
| 303 |
+
});
|
| 304 |
+
});
|
| 305 |
+
}
|
| 306 |
+
}
|
| 307 |
+
|
| 308 |
+
// 5. Logique de Déconnexion (Conservée)
|
| 309 |
+
const logoutHandler = async (e) => {
|
| 310 |
+
e.preventDefault();
|
| 311 |
+
// La déconnexion est gérée par la route Flask directe
|
| 312 |
+
window.location.href = document.getElementById('logout-button-sidebar').href;
|
| 313 |
+
};
|
| 314 |
+
// On attache l'événement à la déconnexion dans la sidebar.
|
| 315 |
+
const logoutButtonSidebar = document.getElementById('logout-button-sidebar');
|
| 316 |
+
if (logoutButtonSidebar) {
|
| 317 |
+
logoutButtonSidebar.addEventListener('click', logoutHandler);
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
</script>
|
| 321 |
+
</body>
|
| 322 |
</html>
|