Added in some display for the node_info
And cleaned up a couple of things. Started on the pretty printing of some of the Monerod stuff
This commit is contained in:
11
src/main.rs
11
src/main.rs
@@ -100,12 +100,11 @@ fn get_node_info() -> NodeInfoInner {
|
|||||||
|
|
||||||
let node_info = task::block_in_place(move || {
|
let node_info = task::block_in_place(move || {
|
||||||
let client = reqwest::blocking::Client::new();
|
let client = reqwest::blocking::Client::new();
|
||||||
// TODO: Properly handle this unwrap - half the point of this is to capture
|
// TODO: Properly handle this unwrap - half the point of this is to capture
|
||||||
// when the node is down
|
// when the node is down
|
||||||
let resp = client.post("http://127.0.0.1:18081/json_rpc").json(&map).send().unwrap();
|
let resp = client.post("http://127.0.0.1:18081/json_rpc").json(&map).send().unwrap();
|
||||||
// TODO: Make this resp.json - I need to build a deserializer I think
|
// TODO: Figure out _why_ this part needs to be inside this closure
|
||||||
// TODO: Figure out _why_ this part needs to be inside this closure
|
resp.json::<NodeInfo>()
|
||||||
resp.json::<NodeInfo>()
|
|
||||||
}).unwrap();
|
}).unwrap();
|
||||||
node_info.result
|
node_info.result
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,5 +51,15 @@ pub struct NodeInfoInner {
|
|||||||
was_bootstrap_ever_used: bool,
|
was_bootstrap_ever_used: bool,
|
||||||
white_peerlist_size: u64,
|
white_peerlist_size: u64,
|
||||||
wide_cumulative_difficulty: String,
|
wide_cumulative_difficulty: String,
|
||||||
wide_difficulty: String
|
wide_difficulty: String,
|
||||||
|
#[serde(skip_deserializing, default = "none")]
|
||||||
|
time_up_pretty: Option<String>,
|
||||||
|
#[serde(skip_deserializing, default = "none")]
|
||||||
|
space_left_pretty: Option<String>,
|
||||||
|
#[serde(skip_deserializing, default = "none")]
|
||||||
|
db_size_pretty: Option<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn none() -> Option<String> {
|
||||||
|
None
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,13 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
span.success {
|
||||||
|
font-weight: bold;
|
||||||
|
color: green;
|
||||||
|
}
|
||||||
|
.warning {
|
||||||
|
color: yellow;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -61,7 +68,30 @@
|
|||||||
</div>
|
</div>
|
||||||
<h1>Monerod Status</h1>
|
<h1>Monerod Status</h1>
|
||||||
<div class="monerodstatus">
|
<div class="monerodstatus">
|
||||||
<
|
<div class="monerodinfocard">
|
||||||
|
{% if node_info.synchronized %}
|
||||||
|
<p><span class="success">Synchronised</span> to {{ node_info.nettype }}</p>
|
||||||
|
{% else %}
|
||||||
|
<p><span class="warning">Synchronising</span> to {{ node_info.nettype }}</p>
|
||||||
|
{% endif %}
|
||||||
|
<p> Running version {{ node_info.version }}
|
||||||
|
{% if node_info.update_available %}
|
||||||
|
<p class="warning">Which can be updated</p>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
|
<div class="monerodinfocard">
|
||||||
|
<p>Txs in pool: <span>{{ node_info.tx_pool_size }}</span></p>
|
||||||
|
<p>Total Txs: <span>{{ node_info.tx_count }}</span></p>
|
||||||
|
</div>
|
||||||
|
<div class="moneroinfocard">
|
||||||
|
<p>Incoming Connections: <span>{{ node_info.incoming_connections_count }}</span></p>
|
||||||
|
<p>Outgoing Connections: <span>{{ node_info.outgoing_connections_count }}</span></p>
|
||||||
|
<p>RPC Connections: <span>{{ node_info.rpc_connections_count }}</span></p>
|
||||||
|
</div>
|
||||||
|
<div class="moneroinfocard">
|
||||||
|
<p>Blockheight: <span>{{ node_info.height }}</span></p>
|
||||||
|
<p>Latest block hash: <span>{{ node_info.top_block_hash }}</span></p>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1>Node Peers</h1>
|
<h1>Node Peers</h1>
|
||||||
|
|||||||
Reference in New Issue
Block a user