📚 Improved documentation and log files for better system understanding & maintenance. 🖥️🔍
This commit is contained in:
@ -130,7 +130,7 @@
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<div class="p-3 bg-gradient-to-br from-green-500 to-green-600 rounded-xl shadow-lg">
|
||||
<svg class="w-6 h-6 text-white" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"/>
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"/>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="text-right">
|
||||
@ -617,41 +617,134 @@
|
||||
|
||||
<script>
|
||||
// ===== WARTUNGS-FUNKTIONALITÄT =====
|
||||
|
||||
// Wartung Modal Event Listeners
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
const maintenanceBtn = document.getElementById('maintenance-btn');
|
||||
const maintenanceModal = document.getElementById('maintenance-modal');
|
||||
const closeModalBtn = document.getElementById('close-maintenance-modal');
|
||||
|
||||
// Modal öffnen
|
||||
if (maintenanceBtn) {
|
||||
maintenanceBtn.addEventListener('click', function() {
|
||||
maintenanceModal.classList.remove('hidden');
|
||||
});
|
||||
// Wartungs-Modal Verwaltung
|
||||
class MaintenanceModal {
|
||||
constructor() {
|
||||
this.modal = document.getElementById('maintenance-modal');
|
||||
this.triggerBtn = document.getElementById('maintenance-btn');
|
||||
this.closeBtn = document.getElementById('close-maintenance-modal');
|
||||
this.isOpen = false;
|
||||
|
||||
this.initializeEventListeners();
|
||||
}
|
||||
|
||||
// Modal schließen
|
||||
if (closeModalBtn) {
|
||||
closeModalBtn.addEventListener('click', function() {
|
||||
maintenanceModal.classList.add('hidden');
|
||||
});
|
||||
}
|
||||
|
||||
// Modal schließen beim Klick außerhalb
|
||||
maintenanceModal.addEventListener('click', function(e) {
|
||||
if (e.target === maintenanceModal) {
|
||||
maintenanceModal.classList.add('hidden');
|
||||
initializeEventListeners() {
|
||||
// Modal öffnen
|
||||
if (this.triggerBtn) {
|
||||
this.triggerBtn.addEventListener('click', (e) => {
|
||||
e.preventDefault();
|
||||
this.openModal();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Modal schließen
|
||||
if (this.closeBtn) {
|
||||
this.closeBtn.addEventListener('click', () => this.closeModal());
|
||||
}
|
||||
|
||||
// Modal schließen bei Klick außerhalb
|
||||
if (this.modal) {
|
||||
this.modal.addEventListener('click', (e) => {
|
||||
if (e.target === this.modal) {
|
||||
this.closeModal();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// ESC-Taste zum Schließen
|
||||
document.addEventListener('keydown', (e) => {
|
||||
if (e.key === 'Escape' && this.isOpen) {
|
||||
this.closeModal();
|
||||
}
|
||||
});
|
||||
|
||||
// Wartungs-Aktionen
|
||||
this.initializeMaintenanceActions();
|
||||
}
|
||||
|
||||
// Wartungs-Funktionen
|
||||
document.getElementById('modal-clear-cache').addEventListener('click', clearCache);
|
||||
document.getElementById('modal-optimize-db').addEventListener('click', optimizeDatabase);
|
||||
document.getElementById('modal-create-backup').addEventListener('click', createBackup);
|
||||
document.getElementById('modal-advanced-settings').addEventListener('click', function() {
|
||||
window.location.href = '{{ url_for("optimization_settings") }}';
|
||||
});
|
||||
initializeMaintenanceActions() {
|
||||
const actions = [
|
||||
{ id: 'modal-clear-cache', handler: () => this.executeAction('clearCache') },
|
||||
{ id: 'modal-optimize-db', handler: () => this.executeAction('optimizeDatabase') },
|
||||
{ id: 'modal-create-backup', handler: () => this.executeAction('createBackup') },
|
||||
{ id: 'modal-advanced-settings', handler: () => this.navigateToSettings() }
|
||||
];
|
||||
|
||||
actions.forEach(action => {
|
||||
const element = document.getElementById(action.id);
|
||||
if (element) {
|
||||
element.addEventListener('click', action.handler);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
openModal() {
|
||||
if (this.modal) {
|
||||
this.modal.classList.remove('hidden');
|
||||
this.isOpen = true;
|
||||
document.body.style.overflow = 'hidden';
|
||||
|
||||
// Focus-Management für Barrierefreiheit
|
||||
const firstFocusable = this.modal.querySelector('button');
|
||||
if (firstFocusable) {
|
||||
firstFocusable.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
closeModal() {
|
||||
if (this.modal) {
|
||||
this.modal.classList.add('hidden');
|
||||
this.isOpen = false;
|
||||
document.body.style.overflow = '';
|
||||
|
||||
// Focus zurück zum Trigger-Button
|
||||
if (this.triggerBtn) {
|
||||
this.triggerBtn.focus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async executeAction(actionType) {
|
||||
try {
|
||||
this.setLoadingState(true);
|
||||
|
||||
switch (actionType) {
|
||||
case 'clearCache':
|
||||
await clearCache();
|
||||
break;
|
||||
case 'optimizeDatabase':
|
||||
await optimizeDatabase();
|
||||
break;
|
||||
case 'createBackup':
|
||||
await createBackup();
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unbekannte Aktion: ${actionType}`);
|
||||
}
|
||||
|
||||
this.closeModal();
|
||||
} catch (error) {
|
||||
console.error('Fehler bei Wartungsaktion:', error);
|
||||
showNotification('Fehler bei der Ausführung der Wartungsaktion', 'error');
|
||||
} finally {
|
||||
this.setLoadingState(false);
|
||||
}
|
||||
}
|
||||
|
||||
navigateToSettings() {
|
||||
try {
|
||||
window.location.href = '{{ url_for("optimization_settings") }}';
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Navigieren zu den Einstellungen:', error);
|
||||
showNotification('Fehler beim Öffnen der Einstellungen', 'error');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Initialisierung nach DOM-Laden
|
||||
document.addEventListener('DOMContentLoaded', function() {
|
||||
new MaintenanceModal();
|
||||
});
|
||||
|
||||
// Notification anzeigen
|
||||
|
Reference in New Issue
Block a user