Es scheint, dass Sie eine Reihe von Dateien und Verzeichnissen in Ihrem Backend-Projekt bearbeitet haben. Hier ist ein zusammenfassender Überblick über die Änderungen:
1. **Entfernung von 'node_modules'**: Es scheint, dass Sie den 'node_modules'-Ordner entfernt oder aktualisiert haben, da einige Dateien wie '.gitignore', 'package
This commit is contained in:
@ -86,6 +86,50 @@ class AdminDashboard {
|
||||
return null;
|
||||
}
|
||||
|
||||
async loadInitialData() {
|
||||
console.log('📊 Lade initiale Dashboard-Daten...');
|
||||
|
||||
// Live-Statistiken laden
|
||||
await this.loadLiveStats();
|
||||
|
||||
// System-Gesundheitscheck durchführen
|
||||
await this.checkSystemHealth();
|
||||
|
||||
// Aktuelle Zeit anzeigen
|
||||
this.updateLiveTime();
|
||||
}
|
||||
|
||||
updateLiveTime() {
|
||||
const liveTimeElement = document.getElementById('live-time');
|
||||
if (liveTimeElement) {
|
||||
liveTimeElement.textContent = new Date().toLocaleTimeString('de-DE');
|
||||
}
|
||||
}
|
||||
|
||||
startLiveUpdates() {
|
||||
console.log('🔄 Starte Live-Update-Timer...');
|
||||
|
||||
// Clear existing interval if any
|
||||
if (this.updateInterval) {
|
||||
clearInterval(this.updateInterval);
|
||||
}
|
||||
|
||||
// Update live time every second
|
||||
this.updateInterval = setInterval(() => {
|
||||
this.updateLiveTime();
|
||||
}, 1000);
|
||||
|
||||
// Update statistics every 30 seconds
|
||||
setInterval(() => {
|
||||
this.loadLiveStats();
|
||||
}, 30000);
|
||||
|
||||
// System health check every 60 seconds
|
||||
setInterval(() => {
|
||||
this.checkSystemHealth();
|
||||
}, 60000);
|
||||
}
|
||||
|
||||
attachEventListeners() {
|
||||
if (this.eventListenersAttached) {
|
||||
console.log('⚠️ Event-Listener bereits registriert, überspringe...');
|
||||
@ -1298,6 +1342,72 @@ class AdminDashboard {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Live-Statistiken laden für Dashboard-Updates
|
||||
*/
|
||||
async loadLiveStats() {
|
||||
try {
|
||||
const response = await fetch(`${this.apiBaseUrl}/api/admin/live-stats`, {
|
||||
headers: {
|
||||
'X-CSRFToken': this.csrfToken
|
||||
}
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`HTTP ${response.status}: ${response.statusText}`);
|
||||
}
|
||||
|
||||
const data = await response.json();
|
||||
|
||||
if (data.success) {
|
||||
this.updateDashboardStats(data.stats);
|
||||
console.log('📊 Live-Statistiken erfolgreich geladen');
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Laden der Live-Statistiken:', error);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Dashboard-Statistiken in der UI aktualisieren
|
||||
*/
|
||||
updateDashboardStats(stats) {
|
||||
if (!stats) return;
|
||||
|
||||
// Benutzer-Statistiken aktualisieren
|
||||
this.updateElement('total-users-count', stats.total_users || 0);
|
||||
this.updateElement('active-users-count', stats.active_users || 0);
|
||||
|
||||
// Drucker-Statistiken aktualisieren
|
||||
this.updateElement('total-printers-count', stats.total_printers || 0);
|
||||
this.updateElement('online-printers-count', stats.online_printers || 0);
|
||||
|
||||
// Job-Statistiken aktualisieren
|
||||
this.updateElement('total-jobs-count', stats.total_jobs || 0);
|
||||
this.updateElement('active-jobs-count', stats.active_jobs || 0);
|
||||
this.updateElement('completed-jobs-count', stats.completed_jobs || 0);
|
||||
|
||||
// Gast-Anfragen aktualisieren
|
||||
this.updateElement('pending-guests-count', stats.pending_guests || 0);
|
||||
|
||||
// Zeitstempel aktualisieren
|
||||
const timestampEl = document.getElementById('stats-timestamp');
|
||||
if (timestampEl) {
|
||||
timestampEl.textContent = new Date().toLocaleTimeString('de-DE');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Hilfsfunktion zum sicheren Aktualisieren von DOM-Elementen
|
||||
*/
|
||||
updateElement(id, value) {
|
||||
const element = document.getElementById(id);
|
||||
if (element) {
|
||||
element.textContent = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Test-Version der Fix-Errors Funktion
|
||||
async testFixErrors() {
|
||||
console.log('🧪 TEST: Fix-Errors wird ausgeführt...');
|
||||
|
Reference in New Issue
Block a user