implement connection info

This commit is contained in:
twisterarmy 2024-06-11 13:05:28 +03:00
parent 7bfe59d938
commit 712bfc1e3e
6 changed files with 53 additions and 0 deletions

View File

@ -71,6 +71,7 @@ table
{ {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; border-spacing: 0;
width: 100%;
} }
html, body html, body
{ {

View File

@ -92,6 +92,43 @@ function requestNetInfo(cbFunc, cbArg) {
function(args, ret) { function(args, ret) {
console.log("Error connecting to local twister daemon."); console.log("Error connecting to local twister daemon.");
}, {}); }, {});
twisterRpc("getpeerinfo", [],
function(args, ret) {
let connections = $(".connections > table > tbody");
connections.html('');
$.each(ret, function() {
connections.append(
$('<tr/>').append(
$('<td/>').text(
this.addr
)
).append(
$('<td/>').text(
this.subver
)
).append(
$('<td/>').text(
this.startingheight
)
).append(
$('<td/>').text(
this.bytessent / 1000
)
).append(
$('<td/>').text(
this.bytesrecv / 1000
)
)
);
});
}, {cbFunc:cbFunc, cbArg:cbArg},
function(args, ret) {
console.log("Error connecting to local twister daemon.");
}, {});
} }
function peerKeypress() { function peerKeypress() {

View File

@ -81,6 +81,18 @@
<li class="connections"> <li class="connections">
<label>Connections: </label> <label>Connections: </label>
<span class="connection-count">0</span> <span class="connection-count">0</span>
<table>
<thead>
<tr>
<td>Address</td>
<td>Version</td>
<td>Height</td>
<td>Sent, KB</td>
<td>Received, KB</td>
</tr>
</thead>
<tbody></tbody>
</table>
</li> </li>
<li> <li>
<label>Known peers: </label> <label>Known peers: </label>

View File

@ -244,6 +244,7 @@ ol, ul {
table { table {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; border-spacing: 0;
width: 100%;
} }
/* line 28, ../../../../../../var/lib/gems/2.1.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ /* line 28, ../../../../../../var/lib/gems/2.1.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */

View File

@ -244,6 +244,7 @@ ol, ul {
table { table {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; border-spacing: 0;
width: 100%;
} }
/* line 28, ../../../../../../var/lib/gems/2.1.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */ /* line 28, ../../../../../../var/lib/gems/2.1.0/gems/compass-core-1.0.3/stylesheets/compass/reset/_utilities.scss */

View File

@ -31,6 +31,7 @@ ol, ul {
table { table {
border-collapse: collapse; border-collapse: collapse;
border-spacing: 0; border-spacing: 0;
width: 100%;
} }
caption, th, td { caption, th, td {