Browse Source

implement connection info

twisterarmy
twisterarmy 5 months ago
parent
commit
712bfc1e3e
  1. 1
      css/style.css
  2. 37
      js/twister_network.js
  3. 12
      network.html
  4. 1
      theme_nin/css/style.css
  5. 1
      theme_nin_night/css/style.css
  6. 1
      theme_nin_original/css/style.css

1
css/style.css

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

37
js/twister_network.js

@ -92,6 +92,43 @@ function requestNetInfo(cbFunc, cbArg) { @@ -92,6 +92,43 @@ function requestNetInfo(cbFunc, cbArg) {
function(args, ret) {
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() {

12
network.html

@ -81,6 +81,18 @@ @@ -81,6 +81,18 @@
<li class="connections">
<label>Connections: </label>
<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>
<label>Known peers: </label>

1
theme_nin/css/style.css

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

1
theme_nin_night/css/style.css

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

1
theme_nin_original/css/style.css

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

Loading…
Cancel
Save