update
This commit is contained in:
parent
b8c6f30d32
commit
3177976845
22
app.js
22
app.js
@ -381,12 +381,13 @@ function addConnection(topicHex) {
|
|||||||
window.activePeer = null;
|
window.activePeer = null;
|
||||||
dashboard.classList.add('hidden');
|
dashboard.classList.add('hidden');
|
||||||
containerList.innerHTML = '';
|
containerList.innerHTML = '';
|
||||||
|
stopStatsInterval(); // Stop stats polling
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!window.activePeer) {
|
if (!window.activePeer) {
|
||||||
switchConnection(topicId);
|
switchConnection(topicId);
|
||||||
}
|
}
|
||||||
|
startStatsInterval();
|
||||||
});
|
});
|
||||||
|
|
||||||
// Collapse the sidebar after adding a connection
|
// Collapse the sidebar after adding a connection
|
||||||
@ -409,6 +410,15 @@ document.addEventListener('DOMContentLoaded', () => {
|
|||||||
const topicHex = savedConnections[topicId].topic;
|
const topicHex = savedConnections[topicId].topic;
|
||||||
addConnection(topicHex);
|
addConnection(topicHex);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (Object.keys(connections).length > 0) {
|
||||||
|
hideWelcomePage();
|
||||||
|
startStatsInterval(); // Start stats polling for active peers
|
||||||
|
} else {
|
||||||
|
showWelcomePage();
|
||||||
|
}
|
||||||
|
|
||||||
|
assertVisibility();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@ -789,26 +799,24 @@ function updateStatsUI(row, stats) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateContainerStats(stats) {
|
function updateContainerStats(stats) {
|
||||||
// console.log(`[DEBUG] Updating stats for container ID: ${stats.id}, Topic ID: ${stats.topicId}`);
|
|
||||||
|
|
||||||
if (!window.activePeer || !connections[stats.topicId] || window.activePeer !== connections[stats.topicId].peer) {
|
if (!window.activePeer || !connections[stats.topicId] || window.activePeer !== connections[stats.topicId].peer) {
|
||||||
// console.warn(`[WARN] Stats received for inactive or unknown connection. Skipping.`);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const row = containerList.querySelector(`tr[data-container-id="${stats.id}"]`);
|
const row = containerList.querySelector(`tr[data-container-id="${stats.id}"]`);
|
||||||
if (!row) {
|
if (!row) {
|
||||||
// console.warn(`[WARN] No matching row for container ID: ${stats.id}. Skipping stats update.`);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use updateStatsUI for cleaner and optimized DOM updates
|
// Smooth incoming stats
|
||||||
updateStatsUI(row, stats);
|
const smoothed = smoothStats(stats);
|
||||||
|
updateStatsUI(row, smoothed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Function to open the Duplicate Modal with container configurations
|
// Function to open the Duplicate Modal with container configurations
|
||||||
function openDuplicateModal(container) {
|
function openDuplicateModal(container) {
|
||||||
console.log(`[INFO] Opening Duplicate Modal for container: ${container.Id}`);
|
console.log(`[INFO] Opening Duplicate Modal for container: ${container.Id}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user