feat: interface admin complète pour gestion système (Phase 2.3)
Implémentation complète de l'interface d'administration web : Backend (server/api/admin.js) : - Endpoints CRUD pour gestion des groupes (GET/POST/PUT/DELETE /admin/groups) - Gestion utilisateurs connectés en temps réel (GET/DELETE /admin/users) - Monitoring statistiques système (GET /admin/stats) - Affichage logs serveur avec filtrage (GET /admin/logs) - Configuration audio globale (PUT /admin/config/audio) - Système de tracking des connexions/déconnexions - Export fonctions registerUser, unregisterUser, addLog Frontend (client/src/Admin.jsx + Admin.css) : - Interface admin complète avec 4 onglets (Groupes, Utilisateurs, Stats, Logs) - Gestion groupes : création, modification, suppression avec formulaires - Gestion canaux audio par groupe (inputs/outputs) - Liste utilisateurs connectés avec déconnexion forcée - Dashboard statistiques temps réel (connexions, uptime, mémoire) - Viewer logs avec code couleur par niveau (debug/info/warn/error) - Rafraîchissement auto toutes les 3s - Design responsive et mode sombre Intégration système : - Routes admin montées sous /admin dans index.js - Enregistrement automatique des utilisateurs lors de la génération de token - Logs serveur centralisés dans le système admin - Routing simple frontend pour /admin (main.jsx) 🎛️ Interface accessible via https://localhost:5173/admin 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,544 @@
|
||||
/* Admin Interface Styles */
|
||||
|
||||
.admin-container {
|
||||
min-height: 100vh;
|
||||
background: #1a1a1a;
|
||||
color: #ffffff;
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
||||
}
|
||||
|
||||
.admin-header {
|
||||
background: #2a2a2a;
|
||||
padding: 1rem 2rem;
|
||||
border-bottom: 2px solid #3a3a3a;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.admin-header h1 {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
.btn-back {
|
||||
background: #444;
|
||||
color: white;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 4px;
|
||||
text-decoration: none;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.btn-back:hover {
|
||||
background: #555;
|
||||
}
|
||||
|
||||
/* Tabs */
|
||||
.admin-tabs {
|
||||
background: #2a2a2a;
|
||||
padding: 0 2rem;
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
border-bottom: 1px solid #3a3a3a;
|
||||
}
|
||||
|
||||
.admin-tabs button {
|
||||
background: none;
|
||||
border: none;
|
||||
color: #aaa;
|
||||
padding: 1rem 1.5rem;
|
||||
cursor: pointer;
|
||||
border-bottom: 3px solid transparent;
|
||||
transition: all 0.2s;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.admin-tabs button:hover {
|
||||
color: #fff;
|
||||
background: #333;
|
||||
}
|
||||
|
||||
.admin-tabs button.active {
|
||||
color: #4CAF50;
|
||||
border-bottom-color: #4CAF50;
|
||||
}
|
||||
|
||||
/* Content */
|
||||
.admin-content {
|
||||
padding: 2rem;
|
||||
max-width: 1400px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.admin-error {
|
||||
background: #d32f2f;
|
||||
color: white;
|
||||
padding: 1rem;
|
||||
border-radius: 4px;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.empty-state {
|
||||
text-align: center;
|
||||
color: #666;
|
||||
padding: 3rem;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
/* Tab Headers */
|
||||
.tab-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.tab-header h2 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/* Buttons */
|
||||
.btn-primary {
|
||||
background: #4CAF50;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.75rem 1.5rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.btn-primary:hover {
|
||||
background: #45a049;
|
||||
}
|
||||
|
||||
.btn-secondary {
|
||||
background: #666;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.75rem 1.5rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
transition: background 0.2s;
|
||||
}
|
||||
|
||||
.btn-secondary:hover {
|
||||
background: #777;
|
||||
}
|
||||
|
||||
.btn-small {
|
||||
background: #4CAF50;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.4rem 0.8rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.btn-danger {
|
||||
background: #d32f2f;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.4rem 0.8rem;
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.btn-danger-small {
|
||||
background: #d32f2f;
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 0.3rem 0.6rem;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.btn-edit {
|
||||
background: #2196F3;
|
||||
border: none;
|
||||
padding: 0.4rem 0.6rem;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.btn-delete {
|
||||
background: #d32f2f;
|
||||
border: none;
|
||||
padding: 0.4rem 0.6rem;
|
||||
border-radius: 3px;
|
||||
cursor: pointer;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
/* Groups */
|
||||
.groups-list {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
|
||||
gap: 1.5rem;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.group-card {
|
||||
background: #2a2a2a;
|
||||
border: 1px solid #3a3a3a;
|
||||
border-radius: 8px;
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
.group-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: flex-start;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.group-header h3 {
|
||||
margin: 0 0 0.5rem 0;
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
.group-id {
|
||||
color: #888;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.group-actions {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.group-description {
|
||||
color: #aaa;
|
||||
margin: 0 0 1rem 0;
|
||||
}
|
||||
|
||||
.group-info {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
color: #888;
|
||||
font-size: 0.9rem;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.channels-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.channel-badge {
|
||||
background: #333;
|
||||
padding: 0.4rem 0.8rem;
|
||||
border-radius: 12px;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
/* Group Form */
|
||||
.group-form-container {
|
||||
background: #2a2a2a;
|
||||
border: 2px solid #4CAF50;
|
||||
border-radius: 8px;
|
||||
padding: 2rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.group-form-container h3 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.form-row {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.group-form-container label {
|
||||
display: block;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.group-form-container label input,
|
||||
.group-form-container label select {
|
||||
display: block;
|
||||
width: 100%;
|
||||
margin-top: 0.5rem;
|
||||
padding: 0.6rem;
|
||||
background: #1a1a1a;
|
||||
border: 1px solid #444;
|
||||
border-radius: 4px;
|
||||
color: white;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.channels-section {
|
||||
margin: 1.5rem 0;
|
||||
}
|
||||
|
||||
.channels-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-bottom: 1rem;
|
||||
}
|
||||
|
||||
.channels-header h4 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.channel-item {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr 80px 80px 50px;
|
||||
gap: 0.5rem;
|
||||
margin-bottom: 0.5rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.channel-item input {
|
||||
padding: 0.5rem;
|
||||
background: #1a1a1a;
|
||||
border: 1px solid #444;
|
||||
border-radius: 4px;
|
||||
color: white;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.form-actions {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
margin-top: 1.5rem;
|
||||
}
|
||||
|
||||
/* Users Table */
|
||||
.users-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
background: #2a2a2a;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.users-table th {
|
||||
background: #333;
|
||||
padding: 1rem;
|
||||
text-align: left;
|
||||
font-weight: 600;
|
||||
border-bottom: 2px solid #444;
|
||||
}
|
||||
|
||||
.users-table td {
|
||||
padding: 1rem;
|
||||
border-bottom: 1px solid #333;
|
||||
}
|
||||
|
||||
.users-table tr:last-child td {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.users-table tr:hover {
|
||||
background: #333;
|
||||
}
|
||||
|
||||
.group-badge {
|
||||
background: #4CAF50;
|
||||
color: white;
|
||||
padding: 0.3rem 0.8rem;
|
||||
border-radius: 12px;
|
||||
font-size: 0.85rem;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
/* Stats */
|
||||
.stats-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
||||
gap: 1.5rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.stat-card {
|
||||
background: #2a2a2a;
|
||||
border: 1px solid #3a3a3a;
|
||||
border-radius: 8px;
|
||||
padding: 1.5rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.stat-card h3 {
|
||||
margin: 0 0 1rem 0;
|
||||
font-size: 0.95rem;
|
||||
color: #aaa;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.stat-value {
|
||||
font-size: 2.5rem;
|
||||
font-weight: bold;
|
||||
color: #4CAF50;
|
||||
}
|
||||
|
||||
.audio-stats {
|
||||
background: #2a2a2a;
|
||||
border-radius: 8px;
|
||||
padding: 1.5rem;
|
||||
margin-top: 2rem;
|
||||
}
|
||||
|
||||
.audio-stats h3 {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.stats-table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.stats-table th {
|
||||
background: #333;
|
||||
padding: 0.8rem;
|
||||
text-align: left;
|
||||
border-bottom: 2px solid #444;
|
||||
}
|
||||
|
||||
.stats-table td {
|
||||
padding: 0.8rem;
|
||||
border-bottom: 1px solid #333;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
.stats-table code {
|
||||
display: block;
|
||||
background: #1a1a1a;
|
||||
padding: 0.5rem;
|
||||
border-radius: 4px;
|
||||
font-size: 0.85rem;
|
||||
max-height: 100px;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
/* Logs */
|
||||
.logs-container {
|
||||
background: #1a1a1a;
|
||||
border: 1px solid #3a3a3a;
|
||||
border-radius: 8px;
|
||||
padding: 1rem;
|
||||
max-height: 70vh;
|
||||
overflow-y: auto;
|
||||
font-family: 'Monaco', 'Menlo', monospace;
|
||||
}
|
||||
|
||||
.log-entry {
|
||||
padding: 0.6rem;
|
||||
margin-bottom: 0.3rem;
|
||||
border-left: 3px solid #666;
|
||||
background: #2a2a2a;
|
||||
border-radius: 3px;
|
||||
display: grid;
|
||||
grid-template-columns: 180px 80px 1fr;
|
||||
gap: 1rem;
|
||||
align-items: start;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.log-entry.log-debug {
|
||||
border-left-color: #2196F3;
|
||||
}
|
||||
|
||||
.log-entry.log-info {
|
||||
border-left-color: #4CAF50;
|
||||
}
|
||||
|
||||
.log-entry.log-warn {
|
||||
border-left-color: #FF9800;
|
||||
}
|
||||
|
||||
.log-entry.log-error {
|
||||
border-left-color: #d32f2f;
|
||||
}
|
||||
|
||||
.log-timestamp {
|
||||
color: #888;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.log-level {
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.log-entry.log-debug .log-level {
|
||||
color: #2196F3;
|
||||
}
|
||||
|
||||
.log-entry.log-info .log-level {
|
||||
color: #4CAF50;
|
||||
}
|
||||
|
||||
.log-entry.log-warn .log-level {
|
||||
color: #FF9800;
|
||||
}
|
||||
|
||||
.log-entry.log-error .log-level {
|
||||
color: #d32f2f;
|
||||
}
|
||||
|
||||
.log-message {
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.log-meta {
|
||||
grid-column: 3;
|
||||
background: #1a1a1a;
|
||||
padding: 0.5rem;
|
||||
border-radius: 3px;
|
||||
font-size: 0.8rem;
|
||||
color: #888;
|
||||
display: block;
|
||||
margin-top: 0.3rem;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 768px) {
|
||||
.admin-content {
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
.groups-list {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.form-row {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.channel-item {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.stats-grid {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
|
||||
.log-entry {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.log-meta {
|
||||
grid-column: 1;
|
||||
}
|
||||
|
||||
.users-table {
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.users-table th,
|
||||
.users-table td {
|
||||
padding: 0.6rem;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user