"feat: Integrate database shm

This commit is contained in:
Till Tomczak 2025-05-29 17:39:01 +02:00
parent 1f2405d56b
commit 05468e9b2d
6 changed files with 637 additions and 1300 deletions

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@

File diff suppressed because it is too large Load Diff

View File

@ -181,6 +181,12 @@ function initSystemManagement() {
if (restartSystemBtn) { if (restartSystemBtn) {
restartSystemBtn.addEventListener('click', () => restartSystem()); restartSystemBtn.addEventListener('click', () => restartSystem());
} }
// Drucker-Initialisierung erzwingen
const forceInitPrintersBtn = document.getElementById('force-init-printers-btn');
if (forceInitPrintersBtn) {
forceInitPrintersBtn.addEventListener('click', () => forceInitializePrinters());
}
} }
/** /**
@ -1151,9 +1157,11 @@ async function updateAllPrinters() {
} }
} }
// System neustarten /**
* System neustarten
*/
async function restartSystem() { async function restartSystem() {
if (!confirm('🔄 Möchten Sie das System wirklich neu starten? Dies kann einige Minuten dauern.')) return; if (!confirm('🔄 Möchten Sie das System wirklich neustarten?\n\nDies wird alle aktiven Verbindungen trennen.')) return;
showLoadingOverlay(); showLoadingOverlay();
@ -1163,26 +1171,72 @@ async function restartSystem() {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'X-CSRFToken': getCSRFToken() 'X-CSRFToken': csrfToken
} }
}); });
const result = await response.json(); const data = await response.json();
hideLoadingOverlay();
if (result.success) { if (data.success) {
showNotification('🔄 System wird neugestartet...', 'info'); showNotification('🔄 System wird neugestartet...', 'info');
// Nach 5 Sekunden versuchen, die Seite neu zu laden
// Nach 5 Sekunden zur Login-Seite weiterleiten
setTimeout(() => { setTimeout(() => {
location.reload(); window.location.href = '/auth/login';
}, 5000); }, 5000);
} else { } else {
showNotification('❌ Fehler beim Neustart: ' + result.message, 'error'); showNotification('❌ Fehler beim Neustart: ' + data.message, 'error');
} }
} catch (error) { } catch (error) {
console.error('System restart error:', error);
showNotification('❌ Fehler beim System-Neustart', 'error');
} finally {
hideLoadingOverlay(); hideLoadingOverlay();
showNotification('❌ Netzwerkfehler beim Neustart', 'error');
console.error('System restart error:', error);
}
}
/**
* Robuste Drucker-Initialisierung erzwingen
*/
async function forceInitializePrinters() {
if (!confirm('🔄 Möchten Sie eine robuste Drucker-Initialisierung starten?\n\nDies überprüft alle Drucker um jeden Preis und markiert sie als online/offline.')) return;
showLoadingOverlay();
try {
const url = `${API_BASE_URL}/api/admin/printers/force-initialize`;
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRFToken': csrfToken
}
});
const data = await response.json();
hideLoadingOverlay();
if (data.success) {
showNotification('🚀 Drucker-Initialisierung gestartet!', 'success');
showNotification(' ' + data.info, 'info');
// Nach 3 Sekunden die Drucker-Statistiken aktualisieren
setTimeout(() => {
updateDashboardStats();
}, 3000);
// Nach 10 Sekunden eine weitere Aktualisierung für vollständige Ergebnisse
setTimeout(() => {
updateDashboardStats();
showNotification('✅ Drucker-Status wurde aktualisiert', 'success');
}, 10000);
} else {
showNotification('❌ Fehler bei der Drucker-Initialisierung: ' + data.message, 'error');
}
} catch (error) {
hideLoadingOverlay();
showNotification('❌ Netzwerkfehler bei der Drucker-Initialisierung', 'error');
console.error('Force printer initialization error:', error);
} }
} }

View File

@ -433,6 +433,9 @@
<button id="create-backup-btn" class="w-full px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 transition-colors text-sm font-medium"> <button id="create-backup-btn" class="w-full px-4 py-2 bg-green-500 text-white rounded-lg hover:bg-green-600 transition-colors text-sm font-medium">
Backup erstellen Backup erstellen
</button> </button>
<button id="force-init-printers-btn" class="w-full px-4 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 transition-colors text-sm font-medium">
Drucker-Initialisierung erzwingen
</button>
</div> </div>
</div> </div>