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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 | Statut de l'API</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 |
+
/* Nouveaux styles pour le statut de l'API */
|
| 121 |
+
.status-bar {
|
| 122 |
+
height: 1.5rem; /* 6px */
|
| 123 |
+
border-radius: 0.375rem; /* rounded-md */
|
| 124 |
+
transition: width 0.5s ease-out; /* Animation douce pour le changement de statut */
|
| 125 |
+
display: flex;
|
| 126 |
+
align-items: center;
|
| 127 |
+
padding-left: 0.75rem;
|
| 128 |
+
font-weight: 600;
|
| 129 |
+
color: white; /* Texte blanc par défaut pour la barre de statut */
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
/* Couleurs spécifiques pour le statut */
|
| 133 |
+
.status-green { background-color: #22c55e; } /* green-500 */
|
| 134 |
+
.status-yellow { background-color: #f59e0b; } /* amber-500 */
|
| 135 |
+
.status-red { background-color: #ef4444; } /* red-500 */
|
| 136 |
+
|
| 137 |
+
</style>
|
| 138 |
+
</head>
|
| 139 |
+
|
| 140 |
+
<body class="bg-page-var text-color-var min-h-screen transition-colors-theme">
|
| 141 |
+
|
| 142 |
+
<button id="theme-switch" class="theme-switch text-color-var hover:text-link-hover-var transition-colors-theme">
|
| 143 |
+
<span class="material-symbols-rounded">dark_mode</span>
|
| 144 |
+
</button>
|
| 145 |
+
|
| 146 |
+
<aside id="sidebar" class="sidebar w-64 bg-sidebar-var border-r border-sidebar-var p-6 lg:block transition-colors-theme">
|
| 147 |
+
<div class="flex items-center mb-10">
|
| 148 |
+
<img src="https://i.imgur.com/7Gn3toV.png" alt="Nexus Pro Logo" class="h-8">
|
| 149 |
+
<span class="text-xl font-bold text-color-var ml-2 transition-colors-theme">Nexus Pro</span>
|
| 150 |
+
</div>
|
| 151 |
+
|
| 152 |
+
<nav class="space-y-3">
|
| 153 |
+
<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">
|
| 154 |
+
<span class="material-symbols-rounded">dashboard</span>
|
| 155 |
+
<span class="ml-3">Dashboard</span>
|
| 156 |
+
</a>
|
| 157 |
+
<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">
|
| 158 |
+
<span class="material-symbols-rounded">key</span>
|
| 159 |
+
<span class="ml-3">Clés API</span>
|
| 160 |
+
</a>
|
| 161 |
+
<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">
|
| 162 |
+
<span class="material-symbols-rounded">person</span>
|
| 163 |
+
<span class="ml-3">Profil</span>
|
| 164 |
+
</a>
|
| 165 |
+
<a href="/api_logs" 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">
|
| 166 |
+
<span class="material-symbols-rounded">list_alt</span>
|
| 167 |
+
<span class="ml-3">Logs d'API</span>
|
| 168 |
+
</a>
|
| 169 |
+
<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">
|
| 170 |
+
<span class="material-symbols-rounded">payments</span>
|
| 171 |
+
<span class="ml-3">Tarifs</span>
|
| 172 |
+
</a>
|
| 173 |
+
<a href="/statut" class="flex items-center p-3 bg-sidebar-active-var text-color-var rounded-lg transition duration-150 transition-colors-theme">
|
| 174 |
+
<span class="material-symbols-rounded">monitor_heart</span>
|
| 175 |
+
<span class="ml-3">Statut de l'API</span>
|
| 176 |
+
</a>
|
| 177 |
+
<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">
|
| 178 |
+
<span class="material-symbols-rounded">logout</span>
|
| 179 |
+
<span class="ml-3">Déconnexion</span>
|
| 180 |
+
</a>
|
| 181 |
+
</nav>
|
| 182 |
+
|
| 183 |
+
<div class="absolute bottom-6 w-52 text-xs text-secondary-var transition-colors-theme">
|
| 184 |
+
<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>
|
| 185 |
+
<p>Plan: <span class="font-semibold text-color-var transition-colors-theme">{{ (user.plan | upper) if user and user.plan else 'GRATUIT' }}</span></p>
|
| 186 |
+
</div>
|
| 187 |
+
|
| 188 |
+
</aside>
|
| 189 |
+
|
| 190 |
+
<div id="main-content" class="main-content p-8 transition-colors-theme">
|
| 191 |
+
|
| 192 |
+
<header class="lg:hidden flex justify-between items-center mb-8">
|
| 193 |
+
<div class="flex items-center">
|
| 194 |
+
<img src="https://i.imgur.com/7Gn3toV.png" alt="Nexus Pro Logo" class="h-8">
|
| 195 |
+
<span class="text-xl font-bold text-color-var ml-2 transition-colors-theme">Nexus Pro</span>
|
| 196 |
+
</div>
|
| 197 |
+
<button id="sidebar-toggle" class="p-2 rounded-lg bg-sidebar-active-var hover:bg-sidebar-active-var/80 transition-colors-theme">
|
| 198 |
+
<span class="material-symbols-rounded text-color-var">menu</span>
|
| 199 |
+
</button>
|
| 200 |
+
</header>
|
| 201 |
+
|
| 202 |
+
<h1 class="text-3xl font-bold mb-8 text-color-var transition-colors-theme">Statut de l'API Nexus</h1>
|
| 203 |
+
|
| 204 |
+
{% with messages = get_flashed_messages(with_categories=true) %}
|
| 205 |
+
{% if messages %}
|
| 206 |
+
{% for category, message in messages %}
|
| 207 |
+
<div class="p-4 mb-4 text-sm rounded-lg border border-transparent
|
| 208 |
+
{{ '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">
|
| 209 |
+
{{ message }}
|
| 210 |
+
</div>
|
| 211 |
+
{% endfor %}
|
| 212 |
+
{% endif %}
|
| 213 |
+
{% endwith %}
|
| 214 |
+
|
| 215 |
+
<div class="bg-card-var p-6 rounded-lg shadow-xl border border-sidebar-var transition-colors-theme mb-8">
|
| 216 |
+
<h2 class="text-xl font-semibold mb-4 flex items-center text-color-var transition-colors-theme">
|
| 217 |
+
<span class="material-symbols-rounded mr-2 text-primary-color-var">cloud_queue</span>
|
| 218 |
+
État Global du Service
|
| 219 |
+
</h2>
|
| 220 |
+
<div id="overall-status-display" class="p-4 rounded-lg text-lg font-bold text-white transition duration-300 shadow-md">
|
| 221 |
+
<p id="overall-status-text">Chargement du statut...</p>
|
| 222 |
+
</div>
|
| 223 |
+
</div>
|
| 224 |
+
|
| 225 |
+
<div class="bg-card-var p-6 rounded-lg shadow-xl border border-sidebar-var transition-colors-theme mb-8">
|
| 226 |
+
<h2 class="text-xl font-semibold mb-6 flex items-center text-color-var transition-colors-theme">
|
| 227 |
+
<span class="material-symbols-rounded mr-2 text-primary-color-var">bar_chart</span>
|
| 228 |
+
Statut des Composants API
|
| 229 |
+
</h2>
|
| 230 |
+
|
| 231 |
+
<div class="space-y-6">
|
| 232 |
+
|
| 233 |
+
<div class="flex flex-col md:flex-row items-start md:items-center justify-between border-b border-sidebar-var pb-4">
|
| 234 |
+
<span class="text-lg font-medium text-color-var w-full md:w-1/3 mb-2 md:mb-0 transition-colors-theme">Service d'Authentification</span>
|
| 235 |
+
<div class="w-full md:w-2/3">
|
| 236 |
+
<div id="auth-status-bar" data-status="{{ api_status.auth }}" class="status-bar" style="width: 100%;" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
|
| 237 |
+
{{ api_status.auth_display if api_status and api_status.auth_display else 'Chargement...' }}
|
| 238 |
+
</div>
|
| 239 |
+
</div>
|
| 240 |
+
</div>
|
| 241 |
+
|
| 242 |
+
<div class="flex flex-col md:flex-row items-start md:items-center justify-between border-b border-sidebar-var pb-4">
|
| 243 |
+
<span class="text-lg font-medium text-color-var w-full md:w-1/3 mb-2 md:mb-0 transition-colors-theme">Traitement des Données (Endpoints V1)</span>
|
| 244 |
+
<div class="w-full md:w-2/3">
|
| 245 |
+
<div id="data-status-bar" data-status="{{ api_status.data_v1 }}" class="status-bar" style="width: 100%;" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
|
| 246 |
+
{{ api_status.data_v1_display if api_status and api_status.data_v1_display else 'Chargement...' }}
|
| 247 |
+
</div>
|
| 248 |
+
</div>
|
| 249 |
+
</div>
|
| 250 |
+
|
| 251 |
+
<div class="flex flex-col md:flex-row items-start md:items-center justify-between">
|
| 252 |
+
<span class="text-lg font-medium text-color-var w-full md:w-1/3 mb-2 md:mb-0 transition-colors-theme">Base de Données Principale</span>
|
| 253 |
+
<div class="w-full md:w-2/3">
|
| 254 |
+
<div id="db-status-bar" data-status="{{ api_status.database }}" class="status-bar" style="width: 100%;" role="progressbar" aria-valuenow="100" aria-valuemin="0" aria-valuemax="100">
|
| 255 |
+
{{ api_status.database_display if api_status and api_status.database_display else 'Chargement...' }}
|
| 256 |
+
</div>
|
| 257 |
+
</div>
|
| 258 |
+
</div>
|
| 259 |
+
|
| 260 |
+
</div>
|
| 261 |
+
|
| 262 |
+
<p class="mt-8 text-sm text-secondary-var">Dernière mise à jour: <span id="last-updated">{{ api_status.last_updated if api_status and api_status.last_updated else 'N/A' }}</span></p>
|
| 263 |
+
|
| 264 |
+
</div>
|
| 265 |
+
|
| 266 |
+
<div class="bg-card-var p-6 rounded-lg shadow-xl border border-sidebar-var transition-colors-theme">
|
| 267 |
+
<h2 class="text-xl font-semibold mb-4 flex items-center text-color-var transition-colors-theme">
|
| 268 |
+
<span class="material-symbols-rounded mr-2 text-primary-color-var">history</span>
|
| 269 |
+
Historique des Incidents
|
| 270 |
+
</h2>
|
| 271 |
+
|
| 272 |
+
{% if incidents %}
|
| 273 |
+
<ul class="space-y-4">
|
| 274 |
+
{% for incident in incidents %}
|
| 275 |
+
<li class="border-l-4 p-4 rounded-r-lg shadow-sm
|
| 276 |
+
{% if incident.status == 'resolved' %} border-green-500 bg-green-900/20 text-green-500
|
| 277 |
+
{% elif incident.status == 'monitoring' %} border-yellow-500 bg-yellow-900/20 text-yellow-500
|
| 278 |
+
{% elif incident.status == 'investigating' %} border-red-500 bg-red-900/20 text-red-500
|
| 279 |
+
{% else %} border-secondary-var bg-input-var text-secondary-var
|
| 280 |
+
{% endif %}">
|
| 281 |
+
<p class="font-bold">{{ incident.title }} -
|
| 282 |
+
<span class="text-sm font-normal uppercase">[{{ incident.status_display }}]</span></p>
|
| 283 |
+
<p class="text-sm mt-1">{{ incident.description }}</p>
|
| 284 |
+
<p class="text-xs mt-2 opacity-75">Date: {{ incident.date }}</p>
|
| 285 |
+
</li>
|
| 286 |
+
{% endfor %}
|
| 287 |
+
</ul>
|
| 288 |
+
{% else %}
|
| 289 |
+
<p class="text-secondary-var italic">Aucun incident récent à signaler. Le service est stable.</p>
|
| 290 |
+
{% endif %}
|
| 291 |
+
|
| 292 |
+
</div>
|
| 293 |
+
|
| 294 |
+
</div>
|
| 295 |
+
|
| 296 |
+
<script>
|
| 297 |
+
|
| 298 |
+
// Fonction utilitaire pour appliquer le thème
|
| 299 |
+
function applyTheme(theme) {
|
| 300 |
+
if (theme === 'dark') {
|
| 301 |
+
document.documentElement.classList.add('dark');
|
| 302 |
+
localStorage.setItem('theme', 'dark');
|
| 303 |
+
} else {
|
| 304 |
+
document.documentElement.classList.remove('dark');
|
| 305 |
+
localStorage.setItem('theme', 'light');
|
| 306 |
+
}
|
| 307 |
+
// Mettre à jour l'icône du switch si nécessaire
|
| 308 |
+
const icon = document.querySelector('#theme-switch .material-symbols-rounded');
|
| 309 |
+
if (icon) {
|
| 310 |
+
// S'assurer que l'icône reflète le mode ACTIF
|
| 311 |
+
icon.textContent = theme === 'dark' ? 'light_mode' : 'dark_mode';
|
| 312 |
+
}
|
| 313 |
+
}
|
| 314 |
+
|
| 315 |
+
// 1. Initialisation du thème au chargement
|
| 316 |
+
// Récupérer le thème sauvé ou utiliser 'dark' comme défaut
|
| 317 |
+
const savedTheme = localStorage.getItem('theme') || 'dark';
|
| 318 |
+
applyTheme(savedTheme);
|
| 319 |
+
|
| 320 |
+
// 2. Logique du switch de thème
|
| 321 |
+
document.getElementById('theme-switch').addEventListener('click', () => {
|
| 322 |
+
// Vérifier si la classe 'dark' est présente sur l'élément racine
|
| 323 |
+
const currentTheme = document.documentElement.classList.contains('dark') ? 'dark' : 'light';
|
| 324 |
+
const newTheme = currentTheme === 'light' ? 'dark' : 'light';
|
| 325 |
+
applyTheme(newTheme);
|
| 326 |
+
});
|
| 327 |
+
|
| 328 |
+
// 3. Logique de bascule de la sidebar pour mobile/tablette
|
| 329 |
+
const sidebarToggle = document.getElementById('sidebar-toggle');
|
| 330 |
+
const sidebar = document.getElementById('sidebar');
|
| 331 |
+
|
| 332 |
+
if (sidebarToggle && sidebar) {
|
| 333 |
+
sidebarToggle.addEventListener('click', () => {
|
| 334 |
+
sidebar.classList.toggle('open');
|
| 335 |
+
});
|
| 336 |
+
}
|
| 337 |
+
|
| 338 |
+
// 4. Fermeture de la sidebar lors du clic sur un lien (pour mobile)
|
| 339 |
+
if (sidebar) {
|
| 340 |
+
const sidebarLinks = sidebar.querySelectorAll('a');
|
| 341 |
+
if (sidebarLinks) {
|
| 342 |
+
sidebarLinks.forEach(link => {
|
| 343 |
+
link.addEventListener('click', () => {
|
| 344 |
+
// Fermer la sidebar uniquement sur les petits écrans
|
| 345 |
+
if (window.innerWidth < 1024) {
|
| 346 |
+
sidebar.classList.remove('open');
|
| 347 |
+
}
|
| 348 |
+
});
|
| 349 |
+
});
|
| 350 |
+
}
|
| 351 |
+
}
|
| 352 |
+
|
| 353 |
+
// 5. Logique de Déconnexion (Conservée)
|
| 354 |
+
const logoutHandler = async (e) => {
|
| 355 |
+
e.preventDefault();
|
| 356 |
+
// La déconnexion est gérée par la route Flask directe
|
| 357 |
+
window.location.href = document.getElementById('logout-button-sidebar').href;
|
| 358 |
+
};
|
| 359 |
+
// On attache l'événement à la déconnexion dans la sidebar.
|
| 360 |
+
const logoutButtonSidebar = document.getElementById('logout-button-sidebar');
|
| 361 |
+
if (logoutButtonSidebar) {
|
| 362 |
+
logoutButtonSidebar.addEventListener('click', logoutHandler);
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
// 6. Logique de Mise à Jour du Statut de l'API (Simulée pour l'exemple)
|
| 366 |
+
function updateStatusBar(elementId, status) {
|
| 367 |
+
const bar = document.getElementById(elementId);
|
| 368 |
+
if (!bar) return;
|
| 369 |
+
|
| 370 |
+
// Réinitialiser les classes de couleur
|
| 371 |
+
bar.classList.remove('status-green', 'status-yellow', 'status-red');
|
| 372 |
+
|
| 373 |
+
let colorClass = 'status-green';
|
| 374 |
+
let statusText = 'Opérationnel';
|
| 375 |
+
|
| 376 |
+
// Le statut peut venir de Jinja (comme 'operational', 'degraded', 'outage')
|
| 377 |
+
switch (status) {
|
| 378 |
+
case 'operational':
|
| 379 |
+
colorClass = 'status-green';
|
| 380 |
+
statusText = 'Opérationnel';
|
| 381 |
+
bar.style.width = '100%';
|
| 382 |
+
break;
|
| 383 |
+
case 'degraded':
|
| 384 |
+
colorClass = 'status-yellow';
|
| 385 |
+
statusText = 'Performance Dégradée';
|
| 386 |
+
bar.style.width = '80%'; // Visuel de barre partielle
|
| 387 |
+
break;
|
| 388 |
+
case 'outage':
|
| 389 |
+
colorClass = 'status-red';
|
| 390 |
+
statusText = 'Panne Majeure';
|
| 391 |
+
bar.style.width = '20%'; // Visuel de barre presque vide
|
| 392 |
+
break;
|
| 393 |
+
default:
|
| 394 |
+
colorClass = 'bg-secondary-var';
|
| 395 |
+
statusText = 'Indisponible / Inconnu';
|
| 396 |
+
bar.style.width = '100%';
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
bar.classList.add(colorClass);
|
| 400 |
+
// S'assurer que le texte est à jour (seulement si non fourni par Jinja)
|
| 401 |
+
if (bar.textContent.trim() === 'Chargement...') {
|
| 402 |
+
bar.textContent = statusText;
|
| 403 |
+
}
|
| 404 |
+
bar.setAttribute('aria-valuenow', bar.style.width.replace('%', ''));
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
function updateOverallStatus(authStatus, dataStatus, dbStatus) {
|
| 408 |
+
const display = document.getElementById('overall-status-display');
|
| 409 |
+
const text = document.getElementById('overall-status-text');
|
| 410 |
+
if (!display || !text) return;
|
| 411 |
+
|
| 412 |
+
display.classList.remove('bg-green-500', 'bg-yellow-500', 'bg-red-500', 'bg-secondary-var');
|
| 413 |
+
|
| 414 |
+
// Logique de statut général
|
| 415 |
+
if (authStatus === 'outage' || dataStatus === 'outage' || dbStatus === 'outage') {
|
| 416 |
+
display.classList.add('bg-red-500');
|
| 417 |
+
text.textContent = 'PANNE MAJEURE - Nous enquêtons sur un problème.';
|
| 418 |
+
} else if (authStatus === 'degraded' || dataStatus === 'degraded' || dbStatus === 'degraded') {
|
| 419 |
+
display.classList.add('bg-yellow-500');
|
| 420 |
+
text.textContent = 'PERFORMANCE DÉGRADÉE - Certains services sont affectés.';
|
| 421 |
+
} else if (authStatus === 'operational' && dataStatus === 'operational' && dbStatus === 'operational') {
|
| 422 |
+
display.classList.add('bg-green-500');
|
| 423 |
+
text.textContent = 'TOUT EST OPÉRATIONNEL - L\'API fonctionne normalement.';
|
| 424 |
+
} else {
|
| 425 |
+
display.classList.add('bg-secondary-var');
|
| 426 |
+
text.textContent = 'Statut Indéterminé.';
|
| 427 |
+
}
|
| 428 |
+
}
|
| 429 |
+
|
| 430 |
+
// Fonction pour lire les statuts depuis les attributs de données (simulant le backend)
|
| 431 |
+
function initializeStatus() {
|
| 432 |
+
// Lecture des données Jinja2 pré-remplies (simulées)
|
| 433 |
+
const authStatus = document.getElementById('auth-status-bar').dataset.status || 'operational';
|
| 434 |
+
const dataStatus = document.getElementById('data-status-bar').dataset.status || 'operational';
|
| 435 |
+
const dbStatus = document.getElementById('db-status-bar').dataset.status || 'operational';
|
| 436 |
+
|
| 437 |
+
// Mise à jour visuelle
|
| 438 |
+
updateStatusBar('auth-status-bar', authStatus);
|
| 439 |
+
updateStatusBar('data-status-bar', dataStatus);
|
| 440 |
+
updateStatusBar('db-status-bar', dbStatus);
|
| 441 |
+
updateOverallStatus(authStatus, dataStatus, dbStatus);
|
| 442 |
+
|
| 443 |
+
// ** Simulation d'une mise à jour en temps réel (Animation) **
|
| 444 |
+
// Dans une application réelle, cette fonction appellerait une API / WebSocket.
|
| 445 |
+
// Pour l'exemple, nous allons animer les barres après le chargement initial.
|
| 446 |
+
|
| 447 |
+
setTimeout(() => {
|
| 448 |
+
// Le backend peut ajuster la largeur pour montrer la "santé" (par exemple, 90% pour opé)
|
| 449 |
+
// Ici, nous utilisons juste les couleurs/texte basés sur le statut simple (operational/degraded/outage)
|
| 450 |
+
document.getElementById('auth-status-bar').style.width = authStatus === 'operational' ? '100%' : (authStatus === 'degraded' ? '80%' : '20%');
|
| 451 |
+
document.getElementById('data-status-bar').style.width = dataStatus === 'operational' ? '100%' : (dataStatus === 'degraded' ? '80%' : '20%');
|
| 452 |
+
document.getElementById('db-status-bar').style.width = dbStatus === 'operational' ? '100%' : (dbStatus === 'degraded' ? '80%' : '20%');
|
| 453 |
+
}, 100); // Petite pause pour l'effet de chargement initial.
|
| 454 |
+
}
|
| 455 |
+
|
| 456 |
+
// 7. Initialisation du statut au chargement de la page
|
| 457 |
+
document.addEventListener('DOMContentLoaded', initializeStatus);
|
| 458 |
+
|
| 459 |
+
</script>
|
| 460 |
+
</body>
|
| 461 |
+
</html>
|