mkcontrol-app/static/js/ui-status.js

36 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// static/js/ui-status.js Status-Badge & Reconnect
function updateStatus(connected, message = '') {
const badge = document.getElementById('connection-status');
const reconnect = document.getElementById('reconnect-section');
if (!badge) return;
if (connected) {
badge.className = 'badge bg-success px-3 py-2 fs-6';
badge.innerHTML = '<i class="bi bi-circle-fill me-2"></i> Verbunden' + (message ? ` ${message}` : '');
if (reconnect) reconnect.style.display = 'none';
} else {
badge.className = 'badge bg-danger px-3 py-2 fs-6';
badge.innerHTML = '<i class="bi bi-circle-fill me-2"></i> Getrennt' + (message ? ` ${message}` : '');
if (reconnect) reconnect.style.display = 'block';
}
}
function showReconnect() {
const control = document.getElementById('control-section');
const reconnect = document.getElementById('reconnect-section');
if (control && reconnect) {
control.style.display = 'none';
reconnect.style.display = 'block';
}
}
window.updateStatus = updateStatus;
window.showReconnect = showReconnect;
// Am Ende
window.initStatus = function() {
// Dein Status-Init-Code, falls vorhanden
console.log('ui-status.js → Status initialisiert');
};