"feat: Update database schema for myp.db-shm and printer templates"

This commit is contained in:
Till Tomczak 2025-05-29 20:50:34 +02:00
parent f4c2f2b2d2
commit b1e7c538a9
2 changed files with 69 additions and 5 deletions

Binary file not shown.

View File

@ -457,6 +457,7 @@
<h1 class="text-4xl font-bold text-mercedes-black dark:text-white tracking-tight">3D-Drucker</h1>
<p class="text-mercedes-gray dark:text-slate-400 mt-1 text-lg">Live-Überwachung und Verwaltung Ihrer Produktionseinheiten</p>
<div class="flex items-center mt-2 text-sm text-mercedes-blue">
<div id="live-status-indicator" class="w-2 h-2 bg-green-500 rounded-full mr-2 animate-pulse"></div>
<svg class="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/>
</svg>
@ -1656,6 +1657,21 @@ class PrinterManager {
container: 'status-maintenance',
iconBg: 'bg-purple-100 dark:bg-purple-900/30 text-purple-600',
badge: 'bg-purple-100 text-purple-800 dark:bg-purple-900/30 dark:text-purple-400'
},
'standby': {
container: 'status-standby',
iconBg: 'bg-yellow-100 dark:bg-yellow-900/30 text-yellow-600',
badge: 'bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400'
},
'unreachable': {
container: 'status-unreachable',
iconBg: 'bg-gray-100 dark:bg-gray-900/30 text-gray-600',
badge: 'bg-gray-100 text-gray-800 dark:bg-gray-900/30 dark:text-gray-400'
},
'unconfigured': {
container: 'status-unconfigured',
iconBg: 'bg-indigo-100 dark:bg-indigo-900/30 text-indigo-600',
badge: 'bg-indigo-100 text-indigo-800 dark:bg-indigo-900/30 dark:text-indigo-400'
}
};
return classes[status] || classes['offline'];
@ -1667,7 +1683,10 @@ class PrinterManager {
'offline': '<div class="w-3 h-3 bg-red-500 rounded-full"></div>',
'printing': '<div class="w-3 h-3 bg-blue-500 rounded-full status-pulse"></div>',
'error': '<div class="w-3 h-3 bg-orange-500 rounded-full"></div>',
'maintenance': '<div class="w-3 h-3 bg-purple-500 rounded-full"></div>'
'maintenance': '<div class="w-3 h-3 bg-purple-500 rounded-full"></div>',
'standby': '<div class="w-3 h-3 bg-yellow-500 rounded-full"></div>',
'unreachable': '<div class="w-3 h-3 bg-gray-500 rounded-full"></div>',
'unconfigured': '<div class="w-3 h-3 bg-indigo-500 rounded-full"></div>'
};
return icons[status] || icons['offline'];
}
@ -1679,7 +1698,10 @@ class PrinterManager {
'printing': 'Druckt',
'error': 'Fehler',
'maintenance': 'Wartung',
'idle': 'Bereit'
'idle': 'Bereit',
'standby': 'Standby',
'unreachable': 'Unerreichbar',
'unconfigured': 'Nicht konfiguriert'
};
return texts[status] || status;
}
@ -1687,9 +1709,12 @@ class PrinterManager {
updateStatistics() {
const stats = {
total: allPrinters.length,
online: allPrinters.filter(p => ['online', 'idle'].includes(p.status)).length,
offline: allPrinters.filter(p => p.status === 'offline').length,
printing: allPrinters.filter(p => p.status === 'printing').length
online: allPrinters.filter(p => ['online', 'idle', 'standby'].includes(p.status)).length,
offline: allPrinters.filter(p => ['offline', 'unreachable'].includes(p.status)).length,
printing: allPrinters.filter(p => p.status === 'printing').length,
standby: allPrinters.filter(p => p.status === 'standby').length,
unreachable: allPrinters.filter(p => p.status === 'unreachable').length,
unconfigured: allPrinters.filter(p => p.status === 'unconfigured').length
};
// Animate counter updates
@ -1704,6 +1729,17 @@ class PrinterManager {
document.getElementById('offline-percentage').textContent = Math.round((stats.offline / total) * 100);
document.getElementById('active-percentage').textContent = Math.round((stats.printing / total) * 100);
// Zeige detaillierte Status-Info in der Konsole
console.log('📊 Status-Verteilung:', {
'Online (inkl. Standby)': stats.online,
'Standby': stats.standby,
'Offline/Unerreichbar': stats.offline,
'Druckt aktiv': stats.printing,
'Unerreichbar': stats.unreachable,
'Unkonfiguriert': stats.unconfigured,
'Gesamt': stats.total
});
this.updatePerformanceMetrics(stats);
}
@ -2065,6 +2101,34 @@ document.addEventListener('DOMContentLoaded', function() {
btn.addEventListener('click', openAddPrinterModal);
});
// PrinterMonitor für Live-Status initialisieren
if (window.printerMonitor) {
console.log('🖨️ Starte PrinterMonitor für Live-Status-Updates...');
window.printerMonitor.start();
// Zusätzlicher Callback für Status-Updates
window.printerMonitor.onUpdate((data) => {
if (data.type === 'update' && data.summary) {
// Update header statistics
document.getElementById('online-count').textContent = data.summary.online || 0;
document.getElementById('total-count').textContent = data.summary.total || 0;
// Visual feedback für Live-Updates
const statusIndicator = document.getElementById('live-status-indicator');
if (statusIndicator) {
statusIndicator.classList.add('animate-pulse', 'text-green-500');
setTimeout(() => {
statusIndicator.classList.remove('animate-pulse');
}, 1000);
}
console.log('📊 Live-Status-Update:', data.summary);
}
});
} else {
console.warn('⚠️ PrinterMonitor nicht verfügbar - verwende Standard-Updates');
}
console.log('✅ Printer Management System erfolgreich initialisiert');
});
</script>