-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnodes.php
54 lines (50 loc) · 1.63 KB
/
nodes.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<?php
// include required files
require_once __DIR__.'/modules/includes.php';
require_once __DIR__.'/modules/api-nodes.php';
include 'modules/header.php';
?>
<h2>Nodes</h2>
red nodes = more than 5k blocks behind, orange nodes = 2k - 5k blocks behind<br>
To sort click on a header!
<div class="table-responsive">
<table class="table table-dark table-hover table-sm" id="nodes">
<thead class="">
<tr>
<th scope="col" >Name</th>
<th scope="col" >Blockcount</th>
<th scope="col" >Unchecked</th>
<th scope="col" >Peers</th>
<th scope="col" >Version</th>
<th scope="col" >Block diff</th>
</tr>
</thead>
<tbody>
<?php foreach($data->nodes as $name=>$node): ?>
<?php $diff = $data->currentBlock - $node->currentBlock;
if ($diff > 5000) {
$row = "bg-danger";
} else if ($diff > 2000) {
$row = "bg-warning";
} else {
$row = "";
};
?>
<tr class="<?php echo $row?>">
<th scope="row"><a href="<?php echo $node->url; ?>"><?php echo $name; ?></a></th>
<td class="no-wrap"><?php echo intval($node->currentBlock); ?></td>
<td class="no-wrap"><?php echo intval($node->uncheckedBlocks); ?></td>
<td class="no-wrap"><?php echo intval($node->numPeers); ?></td>
<td class="no-wrap"><?php echo $node->version; ?></td>
<td class="no-wrap"><?php echo $diff ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<script src='static/js/tablesort/tablesort.js'></script>
<script src='static/js/tablesort/sorts/tablesort.number.js'></script>
<script>
new Tablesort(document.getElementById('nodes'));
</script>
<?php include 'modules/footer.php'; ?>