All checks were successful
continuous-integration/drone/push Build is passing
✨ New Features: - Dynamic permission-based context menus for files and folders - Support for collaborative folder access control - Upload to specific folders including shared folders - Changelog modal for version updates - Improved dark mode synchronization 🐛 Bug Fixes: - Fixed context menu displaying incorrect options - Fixed CSS !important override preventing dynamic menu behavior - Fixed folder collaboration permission checks - Fixed breadcrumb navigation with empty segments - Fixed "Premature close" error loop in attachments - Fixed missing user variable in admin routes - Fixed avatar loading COEP policy issues 🔒 Security: - Added security middleware (CSRF, rate limiting, input validation) - Fixed collaboration folder access validation - Improved shared folder permission handling 🎨 UI/UX Improvements: - Removed Actions column from folder view - Context menu now properly hides/shows based on permissions - Better visual feedback for collaborative folders - Improved upload flow with inline modals 🧹 Code Quality: - Added collaboration data to folder routes - Refactored context menu logic for better maintainability - Added debug logging for troubleshooting - Improved file upload handling with chunking support
757 lines
25 KiB
Plaintext
757 lines
25 KiB
Plaintext
<!DOCTYPE html>
|
|
<html lang="fr">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Statistiques & Logs - Interface Admin</title>
|
|
<link rel="icon" href="/public/assets/homelab_logo.png" />
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
<style>
|
|
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
|
|
|
|
:root {
|
|
--background: 0 0% 100%;
|
|
--foreground: 222.2 84% 4.9%;
|
|
--card: 0 0% 100%;
|
|
--card-foreground: 222.2 84% 4.9%;
|
|
--popover: 0 0% 100%;
|
|
--popover-foreground: 222.2 84% 4.9%;
|
|
--primary: 222.2 47.4% 11.2%;
|
|
--primary-foreground: 210 40% 98%;
|
|
--secondary: 210 40% 96.1%;
|
|
--secondary-foreground: 222.2 47.4% 11.2%;
|
|
--muted: 210 40% 96.1%;
|
|
--muted-foreground: 215.4 16.3% 46.9%;
|
|
--accent: 210 40% 96.1%;
|
|
--accent-foreground: 222.2 47.4% 11.2%;
|
|
--destructive: 0 84.2% 60.2%;
|
|
--destructive-foreground: 210 40% 98%;
|
|
--border: 214.3 31.8% 91.4%;
|
|
--input: 214.3 31.8% 91.4%;
|
|
--ring: 222.2 84% 4.9%;
|
|
--radius: 0.5rem;
|
|
}
|
|
|
|
.dark {
|
|
--background: 222.2 84% 4.9%;
|
|
--foreground: 210 40% 98%;
|
|
--card: 222.2 84% 4.9%;
|
|
--card-foreground: 210 40% 98%;
|
|
--popover: 222.2 84% 4.9%;
|
|
--popover-foreground: 210 40% 98%;
|
|
--primary: 210 40% 98%;
|
|
--primary-foreground: 222.2 47.4% 11.2%;
|
|
--secondary: 217.2 32.6% 17.5%;
|
|
--secondary-foreground: 210 40% 98%;
|
|
--muted: 217.2 32.6% 17.5%;
|
|
--muted-foreground: 215 20.2% 65.1%;
|
|
--accent: 217.2 32.6% 17.5%;
|
|
--accent-foreground: 210 40% 98%;
|
|
--destructive: 0 62.8% 30.6%;
|
|
--destructive-foreground: 210 40% 98%;
|
|
--border: 217.2 32.6% 17.5%;
|
|
--input: 217.2 32.6% 17.5%;
|
|
--ring: 212.7 26.8% 83.9%;
|
|
}
|
|
|
|
* {
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: 'Inter', sans-serif;
|
|
background-color: hsl(var(--background));
|
|
color: hsl(var(--foreground));
|
|
transition: background-color 0.3s ease, color 0.3s ease;
|
|
margin: 0;
|
|
padding: 0;
|
|
min-height: 100vh;
|
|
background-image: url('<%= user.wallpaper %>');
|
|
background-size: cover;
|
|
background-position: center;
|
|
background-repeat: no-repeat;
|
|
background-attachment: fixed;
|
|
}
|
|
|
|
.backdrop {
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background: rgba(0, 0, 0, 0.3);
|
|
backdrop-filter: blur(8px);
|
|
-webkit-backdrop-filter: blur(8px);
|
|
z-index: 1;
|
|
}
|
|
|
|
.container {
|
|
position: relative;
|
|
z-index: 2;
|
|
max-width: 1200px;
|
|
margin: 0 auto;
|
|
padding: 2rem;
|
|
min-height: 100vh;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.admin-card {
|
|
background: hsl(var(--card));
|
|
border: 1px solid hsl(var(--border));
|
|
border-radius: 16px;
|
|
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.05);
|
|
backdrop-filter: blur(12px);
|
|
-webkit-backdrop-filter: blur(12px);
|
|
overflow: hidden;
|
|
width: 100%;
|
|
max-width: 1000px;
|
|
animation: slideIn 0.5s ease-out;
|
|
}
|
|
|
|
@keyframes slideIn {
|
|
from {
|
|
opacity: 0;
|
|
transform: translateY(20px) scale(0.95);
|
|
}
|
|
to {
|
|
opacity: 1;
|
|
transform: translateY(0) scale(1);
|
|
}
|
|
}
|
|
|
|
.admin-header {
|
|
padding: 2rem;
|
|
text-align: center;
|
|
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
|
|
color: white;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.admin-header::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
bottom: 0;
|
|
background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="white" opacity="0.1"/><circle cx="80" cy="80" r="2" fill="white" opacity="0.1"/><circle cx="40" cy="60" r="1" fill="white" opacity="0.05"/></svg>');
|
|
opacity: 0.3;
|
|
}
|
|
|
|
.admin-header h1 {
|
|
font-size: 2rem;
|
|
font-weight: 700;
|
|
margin: 0;
|
|
position: relative;
|
|
z-index: 2;
|
|
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.admin-content {
|
|
padding: 2rem;
|
|
}
|
|
|
|
.section-title {
|
|
font-size: 1.5rem;
|
|
font-weight: 600;
|
|
color: hsl(var(--foreground));
|
|
margin-bottom: 1.5rem;
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 0.75rem;
|
|
}
|
|
|
|
.section-title i {
|
|
color: #6366f1;
|
|
}
|
|
|
|
.stat-cards {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
|
gap: 1.5rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.stat-card {
|
|
background: hsl(var(--card));
|
|
border: 1px solid hsl(var(--border));
|
|
border-radius: 12px;
|
|
padding: 1.5rem;
|
|
transition: all 0.3s ease;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.stat-card::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
height: 4px;
|
|
background: linear-gradient(90deg, #6366f1, #8b5cf6);
|
|
}
|
|
|
|
.stat-card:hover {
|
|
transform: translateY(-4px);
|
|
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.stat-card-icon {
|
|
font-size: 2rem;
|
|
margin-bottom: 1rem;
|
|
color: #6366f1;
|
|
}
|
|
|
|
.stat-card-title {
|
|
font-size: 0.875rem;
|
|
font-weight: 500;
|
|
color: hsl(var(--muted-foreground));
|
|
margin-bottom: 0.5rem;
|
|
text-transform: uppercase;
|
|
letter-spacing: 0.5px;
|
|
}
|
|
|
|
.stat-card-value {
|
|
font-size: 1.75rem;
|
|
font-weight: 700;
|
|
color: hsl(var(--foreground));
|
|
}
|
|
|
|
.quick-actions {
|
|
display: grid;
|
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
|
gap: 1rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.quick-action {
|
|
background: hsl(var(--card));
|
|
border: 1px solid hsl(var(--border));
|
|
border-radius: 12px;
|
|
padding: 1.5rem;
|
|
text-align: center;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
text-decoration: none;
|
|
color: hsl(var(--foreground));
|
|
}
|
|
|
|
.quick-action:hover {
|
|
transform: translateY(-4px);
|
|
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
|
|
text-decoration: none;
|
|
color: hsl(var(--foreground));
|
|
}
|
|
|
|
.quick-action-icon {
|
|
font-size: 2rem;
|
|
margin-bottom: 1rem;
|
|
color: #6366f1;
|
|
}
|
|
|
|
.quick-action-title {
|
|
font-weight: 600;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
|
|
.quick-action-desc {
|
|
font-size: 0.85rem;
|
|
color: hsl(var(--muted-foreground));
|
|
}
|
|
|
|
.btn {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 0.5rem;
|
|
padding: 0.875rem 1.5rem;
|
|
border-radius: 25px;
|
|
font-weight: 500;
|
|
font-size: 0.95rem;
|
|
transition: all 0.3s ease;
|
|
cursor: pointer;
|
|
border: none;
|
|
text-decoration: none;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.btn::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: -100%;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
|
|
transition: left 0.5s;
|
|
}
|
|
|
|
.btn:hover::before {
|
|
left: 100%;
|
|
}
|
|
|
|
.btn:active {
|
|
transform: scale(0.98);
|
|
}
|
|
|
|
.btn-primary {
|
|
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
|
|
color: white;
|
|
box-shadow: 0 4px 14px 0 rgba(99, 102, 241, 0.3);
|
|
}
|
|
|
|
.btn-primary:hover {
|
|
transform: translateY(-2px);
|
|
box-shadow: 0 8px 25px 0 rgba(99, 102, 241, 0.4);
|
|
}
|
|
|
|
.btn-secondary {
|
|
background: hsl(var(--secondary));
|
|
color: hsl(var(--secondary-foreground));
|
|
border: 1px solid hsl(var(--border));
|
|
}
|
|
|
|
.btn-secondary:hover {
|
|
background: hsl(var(--accent));
|
|
color: hsl(var(--accent-foreground));
|
|
transform: translateY(-1px);
|
|
}
|
|
|
|
.btn-full {
|
|
width: 100%;
|
|
}
|
|
|
|
.theme-switcher {
|
|
position: fixed;
|
|
top: 2rem;
|
|
right: 2rem;
|
|
z-index: 10;
|
|
background: hsl(var(--card));
|
|
border: 1px solid hsl(var(--border));
|
|
border-radius: 50%;
|
|
padding: 0.75rem;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
|
|
}
|
|
|
|
.theme-switcher:hover {
|
|
transform: scale(1.1);
|
|
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
|
|
}
|
|
|
|
.theme-switcher svg {
|
|
width: 1.25rem;
|
|
height: 1.25rem;
|
|
color: hsl(var(--foreground));
|
|
}
|
|
|
|
.modal {
|
|
display: none;
|
|
position: fixed;
|
|
z-index: 1000;
|
|
left: 0;
|
|
top: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
overflow: auto;
|
|
background-color: rgba(0, 0, 0, 0.6);
|
|
backdrop-filter: blur(4px);
|
|
}
|
|
|
|
.modal-content {
|
|
background: hsl(var(--card));
|
|
margin: 5% auto;
|
|
padding: 0;
|
|
border: 1px solid hsl(var(--border));
|
|
width: 90%;
|
|
max-width: 900px;
|
|
border-radius: 16px;
|
|
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
|
animation: slideIn 0.3s ease-out;
|
|
}
|
|
|
|
.modal-header {
|
|
padding: 1.5rem 2rem;
|
|
background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
|
|
color: white;
|
|
border-radius: 16px 16px 0 0;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
.modal-header h2 {
|
|
margin: 0;
|
|
font-size: 1.5rem;
|
|
font-weight: 600;
|
|
}
|
|
|
|
.close {
|
|
color: white;
|
|
font-size: 2rem;
|
|
font-weight: 300;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
line-height: 1;
|
|
width: 32px;
|
|
height: 32px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
border-radius: 50%;
|
|
}
|
|
|
|
.close:hover {
|
|
background: rgba(255, 255, 255, 0.2);
|
|
transform: rotate(90deg);
|
|
}
|
|
|
|
.modal-body {
|
|
padding: 2rem;
|
|
max-height: 70vh;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.modal-body pre {
|
|
background: hsl(var(--muted));
|
|
border: 1px solid hsl(var(--border));
|
|
border-radius: 8px;
|
|
padding: 1.5rem;
|
|
overflow-x: auto;
|
|
font-size: 0.875rem;
|
|
line-height: 1.6;
|
|
color: hsl(var(--foreground));
|
|
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
|
|
}
|
|
|
|
.chart-container {
|
|
background: hsl(var(--card));
|
|
border: 1px solid hsl(var(--border));
|
|
border-radius: 12px;
|
|
padding: 1.5rem;
|
|
margin-bottom: 2rem;
|
|
}
|
|
|
|
.chart-container canvas {
|
|
max-height: 300px;
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
.container {
|
|
padding: 1rem;
|
|
}
|
|
|
|
.admin-header {
|
|
padding: 1.5rem;
|
|
}
|
|
|
|
.admin-header h1 {
|
|
font-size: 1.5rem;
|
|
}
|
|
|
|
.admin-content {
|
|
padding: 1.5rem;
|
|
}
|
|
|
|
.theme-switcher {
|
|
top: 1rem;
|
|
right: 1rem;
|
|
}
|
|
|
|
.stat-cards {
|
|
grid-template-columns: 1fr;
|
|
}
|
|
|
|
.modal-content {
|
|
width: 95%;
|
|
margin: 10% auto;
|
|
}
|
|
}
|
|
|
|
@keyframes fadeIn {
|
|
from { opacity: 0; transform: translateY(10px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="dark">
|
|
<div class="backdrop"></div>
|
|
|
|
<div class="container">
|
|
<div class="admin-card">
|
|
<div class="admin-header">
|
|
<h1><i class="fas fa-chart-line"></i> Statistiques & Logs</h1>
|
|
</div>
|
|
|
|
<div class="admin-content">
|
|
<!-- Statistiques Système -->
|
|
<div class="section-title">
|
|
<i class="fas fa-server"></i>
|
|
Statistiques Système
|
|
</div>
|
|
|
|
<div class="stat-cards">
|
|
<div class="stat-card">
|
|
<div class="stat-card-icon">
|
|
<i class="fas fa-clock"></i>
|
|
</div>
|
|
<div class="stat-card-title">Uptime</div>
|
|
<div class="stat-card-value" id="uptimeDisplay">
|
|
<%= Math.floor(uptime / 86400) %>j <%= Math.floor(uptime % 86400 / 3600) %>h <%= Math.floor(uptime % 3600 / 60) %>m
|
|
</div>
|
|
</div>
|
|
|
|
<div class="stat-card">
|
|
<div class="stat-card-icon">
|
|
<i class="fas fa-memory"></i>
|
|
</div>
|
|
<div class="stat-card-title">Mémoire</div>
|
|
<div class="stat-card-value">
|
|
<%= memoryUsage.toFixed(2) %> Mo
|
|
</div>
|
|
</div>
|
|
|
|
<div class="stat-card">
|
|
<div class="stat-card-icon">
|
|
<i class="fas fa-microchip"></i>
|
|
</div>
|
|
<div class="stat-card-title">CPU</div>
|
|
<div class="stat-card-value">
|
|
<%= (cpuUsage * 100).toFixed(2) %>%
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Graphiques -->
|
|
<div class="chart-container">
|
|
<canvas id="systemChart"></canvas>
|
|
</div>
|
|
|
|
<!-- Journaux -->
|
|
<div class="section-title">
|
|
<i class="fas fa-file-alt"></i>
|
|
Journaux du Système
|
|
</div>
|
|
|
|
<div class="quick-actions">
|
|
<% if (logs && logs.length > 0) { %>
|
|
<% logs.forEach((log, index) => { %>
|
|
<% if (log) { %>
|
|
<div class="quick-action" data-log-index="<%= index %>">
|
|
<div class="quick-action-icon">
|
|
<i class="fas fa-file-code"></i>
|
|
</div>
|
|
<div class="quick-action-title"><%= log.name %></div>
|
|
<div class="quick-action-desc">Cliquer pour voir</div>
|
|
</div>
|
|
<% } %>
|
|
<% }); %>
|
|
<% } else { %>
|
|
<div style="grid-column: 1 / -1; text-align: center; padding: 2rem; color: hsl(var(--muted-foreground));">
|
|
<i class="fas fa-info-circle" style="font-size: 3rem; margin-bottom: 1rem; opacity: 0.5;"></i>
|
|
<p>Aucun log disponible pour le moment.</p>
|
|
</div>
|
|
<% } %>
|
|
</div>
|
|
|
|
<!-- Bouton retour -->
|
|
<div style="margin-top: 2rem;">
|
|
<a href="/dpanel/dashboard/admin/" class="btn btn-secondary btn-full">
|
|
<i class="fas fa-arrow-left"></i>
|
|
Retourner au dashboard admin
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Modals pour les logs -->
|
|
<% if (logs && logs.length > 0) { %>
|
|
<% logs.forEach((log, index) => { %>
|
|
<% if (log) { %>
|
|
<div id="logModal<%= index %>" class="modal">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h2><i class="fas fa-file-code"></i> <%= log.name %></h2>
|
|
<span class="close" data-modal-index="<%= index %>">×</span>
|
|
</div>
|
|
<div class="modal-body">
|
|
<pre><%= log.content %></pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% } %>
|
|
<% }); %>
|
|
<% } %>
|
|
|
|
<!-- Theme Switcher -->
|
|
<button class="theme-switcher" id="themeSwitcher">
|
|
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M12 3v2.25m6.364.386l-1.591 1.591M21 12h-2.25m-.386 6.364l-1.591-1.591M12 18.75V21m-4.773-4.227l-1.591 1.591M5.25 12H3m4.227-4.773L5.636 5.636M15.75 12a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0z" />
|
|
</svg>
|
|
</button>
|
|
|
|
<script>
|
|
// =================== VARIABLES GLOBALES ===================
|
|
const body = document.body;
|
|
const themeSwitcher = document.getElementById('themeSwitcher');
|
|
|
|
// =================== GESTION DU THÈME ===================
|
|
function setTheme(theme) {
|
|
if (theme === 'dark') {
|
|
body.classList.add('dark');
|
|
} else {
|
|
body.classList.remove('dark');
|
|
}
|
|
localStorage.setItem('theme', theme);
|
|
}
|
|
|
|
const savedTheme = localStorage.getItem('theme');
|
|
if (savedTheme) {
|
|
setTheme(savedTheme);
|
|
} else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
|
setTheme('dark');
|
|
}
|
|
|
|
themeSwitcher.addEventListener('click', function() {
|
|
if (body.classList.contains('dark')) {
|
|
setTheme('light');
|
|
} else {
|
|
setTheme('dark');
|
|
}
|
|
});
|
|
|
|
// =================== GESTION DES MODALS ===================
|
|
const logButtons = document.querySelectorAll('.quick-action[data-log-index]');
|
|
const closeButtons = document.querySelectorAll('.close[data-modal-index]');
|
|
|
|
logButtons.forEach(button => {
|
|
button.addEventListener('click', function() {
|
|
const index = this.getAttribute('data-log-index');
|
|
const modal = document.getElementById('logModal' + index);
|
|
if (modal) {
|
|
modal.style.display = 'block';
|
|
}
|
|
});
|
|
});
|
|
|
|
closeButtons.forEach(button => {
|
|
button.addEventListener('click', function() {
|
|
const index = this.getAttribute('data-modal-index');
|
|
const modal = document.getElementById('logModal' + index);
|
|
if (modal) {
|
|
modal.style.display = 'none';
|
|
}
|
|
});
|
|
});
|
|
|
|
window.onclick = function(event) {
|
|
if (event.target.classList.contains('modal')) {
|
|
event.target.style.display = 'none';
|
|
}
|
|
};
|
|
|
|
// =================== GRAPHIQUE CHART.JS ===================
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
const ctx = document.getElementById('systemChart');
|
|
if (ctx) {
|
|
const isDark = body.classList.contains('dark');
|
|
const textColor = isDark ? 'rgba(210, 214, 220, 0.8)' : 'rgba(34, 41, 47, 0.8)';
|
|
const gridColor = isDark ? 'rgba(255, 255, 255, 0.1)' : 'rgba(0, 0, 0, 0.1)';
|
|
|
|
new Chart(ctx, {
|
|
type: 'bar',
|
|
data: {
|
|
labels: ['Uptime (jours)', 'Mémoire (Mo)', 'CPU (%)'],
|
|
datasets: [{
|
|
label: 'Statistiques Système',
|
|
data: [
|
|
<%= Math.floor(uptime / 86400) %>,
|
|
<%= memoryUsage.toFixed(2) %>,
|
|
<%= (cpuUsage * 100).toFixed(2) %>
|
|
],
|
|
backgroundColor: [
|
|
'rgba(99, 102, 241, 0.6)',
|
|
'rgba(139, 92, 246, 0.6)',
|
|
'rgba(168, 85, 247, 0.6)'
|
|
],
|
|
borderColor: [
|
|
'rgba(99, 102, 241, 1)',
|
|
'rgba(139, 92, 246, 1)',
|
|
'rgba(168, 85, 247, 1)'
|
|
],
|
|
borderWidth: 2,
|
|
borderRadius: 8
|
|
}]
|
|
},
|
|
options: {
|
|
responsive: true,
|
|
maintainAspectRatio: true,
|
|
plugins: {
|
|
legend: {
|
|
display: true,
|
|
labels: {
|
|
color: textColor,
|
|
font: {
|
|
family: 'Inter',
|
|
size: 12
|
|
}
|
|
}
|
|
},
|
|
title: {
|
|
display: true,
|
|
text: 'Aperçu des Ressources Système',
|
|
color: textColor,
|
|
font: {
|
|
family: 'Inter',
|
|
size: 16,
|
|
weight: '600'
|
|
}
|
|
}
|
|
},
|
|
scales: {
|
|
y: {
|
|
beginAtZero: true,
|
|
ticks: {
|
|
color: textColor
|
|
},
|
|
grid: {
|
|
color: gridColor
|
|
}
|
|
},
|
|
x: {
|
|
ticks: {
|
|
color: textColor
|
|
},
|
|
grid: {
|
|
color: gridColor
|
|
}
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
// =================== ANIMATIONS ===================
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
setTimeout(() => {
|
|
document.querySelector('.admin-card').style.opacity = '1';
|
|
document.querySelector('.admin-card').style.transform = 'translateY(0) scale(1)';
|
|
}, 100);
|
|
|
|
console.log('📊 Interface Statistiques & Logs chargée !');
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|