show nr of connections
This commit is contained in:
parent
0d90252e33
commit
97694cdd50
@ -74,6 +74,7 @@
|
|||||||
<li class="nav-item"><a href="{{ url_for('songs_dashboard') }}" class="nav-link">Auswertung-Wiederholungen</a></li>
|
<li class="nav-item"><a href="{{ url_for('songs_dashboard') }}" class="nav-link">Auswertung-Wiederholungen</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
<span>Anzahl Verbindungen: <strong id="totalConnections">0</strong></span>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@ -108,6 +109,12 @@
|
|||||||
socket.emit("request_initial_data");
|
socket.emit("request_initial_data");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// compute & write stats into the header
|
||||||
|
function updateStats(data) {
|
||||||
|
const total = data.length;
|
||||||
|
document.getElementById("totalConnections").textContent = total;
|
||||||
|
}
|
||||||
|
|
||||||
// Helper: Create a table row.
|
// Helper: Create a table row.
|
||||||
// When applyAnimation is true, the row uses the slide-in animation.
|
// When applyAnimation is true, the row uses the slide-in animation.
|
||||||
function createRow(record, applyAnimation = true) {
|
function createRow(record, applyAnimation = true) {
|
||||||
@ -202,6 +209,7 @@
|
|||||||
|
|
||||||
// Listen for incoming connection data from the server.
|
// Listen for incoming connection data from the server.
|
||||||
socket.on("recent_connections", function(data) {
|
socket.on("recent_connections", function(data) {
|
||||||
|
updateStats(data);
|
||||||
animateTableWithNewRow(data);
|
animateTableWithNewRow(data);
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user