Reconnect yhdellä rivillä: ei floodata terminaalia

Sama rivi päivittyy laskurilla: '↻ Yhdistetään uudelleen... (3)'
Rivi poistetaan kun yhteys palautuu.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-07 07:18:13 +03:00
parent 73bcd3143a
commit 30e81875db

View File

@@ -1691,6 +1691,9 @@
const hubLabel = document.getElementById('agent-hub-label'); const hubLabel = document.getElementById('agent-hub-label');
const hubStatus = document.getElementById('agent-hub-status'); const hubStatus = document.getElementById('agent-hub-status');
if (hubDot) hubDot.style.background = '#3fb950'; if (hubDot) hubDot.style.background = '#3fb950';
// Poistetaan reconnect-rivi
const reconnLine = document.getElementById('agent-terminal')?.querySelector('.term-reconnect');
if (reconnLine) reconnLine.remove();
if (hubLabel) { hubLabel.textContent = 'Yhdistetty'; hubLabel.style.color = '#3fb950'; } if (hubLabel) { hubLabel.textContent = 'Yhdistetty'; hubLabel.style.color = '#3fb950'; }
if (hubStatus) hubStatus.title = 'Yhdistetty Kipinä Hubiin — tehtävien jakelu ja solmujen koordinointi aktiivinen'; if (hubStatus) hubStatus.title = 'Yhdistetty Kipinä Hubiin — tehtävien jakelu ja solmujen koordinointi aktiivinen';
@@ -1758,9 +1761,22 @@
} }
// Automaattinen reconnect 3s kuluttua // Automaattinen reconnect 3s kuluttua
if (!wsReconnectTimer) { if (!wsReconnectTimer) {
// Päivitetään samaa riviä eikä floodata uusia
let reconnLine = termPanel?.querySelector('.term-reconnect');
let reconnCount = 0;
if (!reconnLine) {
reconnLine = document.createElement('div');
reconnLine.className = 'terminal-line term-reconnect';
termPanel?.appendChild(reconnLine);
} else {
reconnCount = parseInt(reconnLine.dataset.count || '0');
}
wsReconnectTimer = setTimeout(() => { wsReconnectTimer = setTimeout(() => {
wsReconnectTimer = null; wsReconnectTimer = null;
termLog(' <span style="color:#d29922">↻ Yhdistetään uudelleen...</span>'); reconnCount++;
reconnLine.dataset.count = reconnCount;
reconnLine.innerHTML = ` <span style="color:#d29922">↻ Yhdistetään uudelleen...${reconnCount > 1 ? ' (' + reconnCount + ')' : ''}</span>`;
termPanel.scrollTop = termPanel.scrollHeight;
connectHub(); connectHub();
}, 3000); }, 3000);
} }