fix: Add some more stats to basic status page of TUI (disk usage, chain timestamp, tx pool size) (#3046)
* fix: Add some more stats to basic status page of TUI (disk usage, chain timestamp, tx pool size) * chore: add latest header timestamp to TUI * fix: calculate total disk usage of database to show in TUI
This commit is contained in:
committed by
Antioch Peverell
parent
f3baceb51b
commit
02cee80229
@@ -166,7 +166,10 @@ impl TUIStatusListener for TUIPeerView {
|
||||
let lp_str = match lp {
|
||||
Some(l) => format!(
|
||||
"{} D @ {} H vs Us: {} D @ {} H",
|
||||
l.total_difficulty, l.height, stats.head.total_difficulty, stats.head.height
|
||||
l.total_difficulty,
|
||||
l.height,
|
||||
stats.chain_stats.total_difficulty,
|
||||
stats.chain_stats.height
|
||||
)
|
||||
.to_string(),
|
||||
None => "".to_string(),
|
||||
|
||||
+54
-9
@@ -46,9 +46,14 @@ impl TUIStatusListener for TUIStatusView {
|
||||
.child(TextView::new("Connected Peers: "))
|
||||
.child(TextView::new("0").with_id("connected_peers")),
|
||||
)
|
||||
.child(
|
||||
LinearLayout::new(Orientation::Horizontal)
|
||||
.child(TextView::new("Disk Usage (GB): "))
|
||||
.child(TextView::new("0").with_id("disk_usage")),
|
||||
)
|
||||
.child(
|
||||
LinearLayout::new(Orientation::Horizontal).child(TextView::new(
|
||||
"------------------------------------------------",
|
||||
"--------------------------------------------------------",
|
||||
)),
|
||||
)
|
||||
.child(
|
||||
@@ -66,9 +71,14 @@ impl TUIStatusListener for TUIStatusView {
|
||||
.child(TextView::new("Header Cumulative Difficulty: "))
|
||||
.child(TextView::new(" ").with_id("basic_header_total_difficulty")),
|
||||
)
|
||||
.child(
|
||||
LinearLayout::new(Orientation::Horizontal)
|
||||
.child(TextView::new("Header Tip Timestamp: "))
|
||||
.child(TextView::new(" ").with_id("basic_header_timestamp")),
|
||||
)
|
||||
.child(
|
||||
LinearLayout::new(Orientation::Horizontal).child(TextView::new(
|
||||
"------------------------------------------------",
|
||||
"--------------------------------------------------------",
|
||||
)),
|
||||
)
|
||||
.child(
|
||||
@@ -86,9 +96,29 @@ impl TUIStatusListener for TUIStatusView {
|
||||
.child(TextView::new("Chain Cumulative Difficulty: "))
|
||||
.child(TextView::new(" ").with_id("basic_total_difficulty")),
|
||||
)
|
||||
.child(
|
||||
LinearLayout::new(Orientation::Horizontal)
|
||||
.child(TextView::new("Chain Tip Timestamp: "))
|
||||
.child(TextView::new(" ").with_id("chain_timestamp")),
|
||||
)
|
||||
.child(
|
||||
LinearLayout::new(Orientation::Horizontal).child(TextView::new(
|
||||
"------------------------------------------------",
|
||||
"--------------------------------------------------------",
|
||||
)),
|
||||
)
|
||||
.child(
|
||||
LinearLayout::new(Orientation::Horizontal)
|
||||
.child(TextView::new("Transaction Pool Size: "))
|
||||
.child(TextView::new(" ").with_id("tx_pool_size")),
|
||||
)
|
||||
.child(
|
||||
LinearLayout::new(Orientation::Horizontal)
|
||||
.child(TextView::new("Stem Pool Size: "))
|
||||
.child(TextView::new(" ").with_id("stem_pool_size")),
|
||||
)
|
||||
.child(
|
||||
LinearLayout::new(Orientation::Horizontal).child(TextView::new(
|
||||
"--------------------------------------------------------",
|
||||
)),
|
||||
)
|
||||
.child(
|
||||
@@ -244,23 +274,38 @@ impl TUIStatusListener for TUIStatusView {
|
||||
c.call_on_id("connected_peers", |t: &mut TextView| {
|
||||
t.set_content(stats.peer_count.to_string());
|
||||
});
|
||||
c.call_on_id("disk_usage", |t: &mut TextView| {
|
||||
t.set_content(stats.disk_usage_gb.clone());
|
||||
});
|
||||
c.call_on_id("tip_hash", |t: &mut TextView| {
|
||||
t.set_content(stats.head.last_block_h.to_string() + "...");
|
||||
t.set_content(stats.chain_stats.last_block_h.to_string() + "...");
|
||||
});
|
||||
c.call_on_id("chain_height", |t: &mut TextView| {
|
||||
t.set_content(stats.head.height.to_string());
|
||||
t.set_content(stats.chain_stats.height.to_string());
|
||||
});
|
||||
c.call_on_id("basic_total_difficulty", |t: &mut TextView| {
|
||||
t.set_content(stats.head.total_difficulty.to_string());
|
||||
t.set_content(stats.chain_stats.total_difficulty.to_string());
|
||||
});
|
||||
c.call_on_id("chain_timestamp", |t: &mut TextView| {
|
||||
t.set_content(stats.chain_stats.latest_timestamp.to_string());
|
||||
});
|
||||
c.call_on_id("basic_header_tip_hash", |t: &mut TextView| {
|
||||
t.set_content(stats.header_head.last_block_h.to_string() + "...");
|
||||
t.set_content(stats.header_stats.last_block_h.to_string() + "...");
|
||||
});
|
||||
c.call_on_id("basic_header_chain_height", |t: &mut TextView| {
|
||||
t.set_content(stats.header_head.height.to_string());
|
||||
t.set_content(stats.header_stats.height.to_string());
|
||||
});
|
||||
c.call_on_id("basic_header_total_difficulty", |t: &mut TextView| {
|
||||
t.set_content(stats.header_head.total_difficulty.to_string());
|
||||
t.set_content(stats.header_stats.total_difficulty.to_string());
|
||||
});
|
||||
c.call_on_id("basic_header_timestamp", |t: &mut TextView| {
|
||||
t.set_content(stats.header_stats.latest_timestamp.to_string());
|
||||
});
|
||||
c.call_on_id("tx_pool_size", |t: &mut TextView| {
|
||||
t.set_content(stats.tx_stats.tx_pool_size.to_string());
|
||||
});
|
||||
c.call_on_id("stem_pool_size", |t: &mut TextView| {
|
||||
t.set_content(stats.tx_stats.stem_pool_size.to_string());
|
||||
});
|
||||
/*c.call_on_id("basic_mining_config_status", |t: &mut TextView| {
|
||||
t.set_content(basic_mining_config_status);
|
||||
|
||||
Reference in New Issue
Block a user