fix(dashboard): smooth latency badge updates, add ping settings
CI / Build & Test (push) Successful in 2m52s
CI / Build & Test (push) Successful in 2m52s
- Snapshot and restore latency badge values across innerHTML re-renders so badges never flash back to "…ms" on the 2-second state refresh cycle - Add CSS transition (color 0.4s ease) and in-flight opacity dim (.pinging) to .latency-badge for smooth color changes - Decouple latency pinging from the state refresh cycle — pings now run on their own independent interval instead of being triggered by refresh() - Add two new settings under a "Latency Ping" section in Settings: - Enable Latency Ping toggle (latencyPingEnabled, default: true) - Ping Interval in seconds (latencyPingIntervalMs, default: 5s) - Restart ping interval immediately on settings save so changes take effect without a page reload
This commit is contained in:
@@ -30,6 +30,12 @@ function updateServiceTunnelsTable(state) {
|
||||
const countEl = $('serviceTunnelCount');
|
||||
if (countEl) countEl.textContent = tunnels.length;
|
||||
|
||||
// Snapshot latency badge values before re-render so they survive the innerHTML swap
|
||||
const _latencySnapshot = {};
|
||||
tbody.querySelectorAll('.latency-badge[data-ping-port]').forEach(b => {
|
||||
_latencySnapshot[b.dataset.pingHost + ':' + b.dataset.pingPort] = { text: b.textContent, color: b.style.color };
|
||||
});
|
||||
|
||||
if (tunnels.length === 0) {
|
||||
tbody.innerHTML = `
|
||||
<tr><td colspan="6">
|
||||
@@ -95,6 +101,15 @@ function updateServiceTunnelsTable(state) {
|
||||
</tr>`;
|
||||
}).join('');
|
||||
|
||||
// Restore latency badge values immediately so there's no flash back to "…ms"
|
||||
tbody.querySelectorAll('.latency-badge[data-ping-port]').forEach(b => {
|
||||
const snap = _latencySnapshot[b.dataset.pingHost + ':' + b.dataset.pingPort];
|
||||
if (snap && snap.text && snap.text !== '…ms') {
|
||||
b.textContent = snap.text;
|
||||
b.style.color = snap.color;
|
||||
}
|
||||
});
|
||||
|
||||
tbody.querySelectorAll('.svc-row-cb').forEach(cb => {
|
||||
cb.addEventListener('change', _updateSvcBulkBar);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user