Skip to content

Commit

Permalink
feat: use a dash to mark an unknown node info value
Browse files Browse the repository at this point in the history
  • Loading branch information
bochaco committed Dec 10, 2024
1 parent cfe329d commit b8e5877
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions src/nodes_list_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,13 @@ fn NodeInstanceView(
let peer_id = move || {
info.read()
.short_peer_id()
.unwrap_or_else(|| "unknown".to_string())
.unwrap_or_else(|| " -".to_string())
};

let rewards_addr = move || {
info.read()
.short_rewards_addr()
.unwrap_or_else(|| "unknown".to_string())
.unwrap_or_else(|| " -".to_string())
};

let node_card_clicked = move || {
Expand Down Expand Up @@ -312,24 +312,20 @@ fn NodeInstanceView(
</p>
<p>
<span class="node-info-item">"Version: "</span>
{move || info.get().bin_version.unwrap_or_else(|| "unknown".to_string())}
{move || info.get().bin_version.unwrap_or_else(|| " -".to_string())}
</p>
<p>
<div class="flex flex-row">
<div class="basis-1/2">
<span class="node-info-item">"Balance: "</span>
{move || {
info.read()
.balance
.map_or("unknown".to_string(), |v| v.to_string())
info.read().balance.map_or(" -".to_string(), |v| v.to_string())
}}
</div>
<div class="basis-1/2">
<span class="node-info-item">"Rewards: "</span>
{move || {
info.read()
.rewards
.map_or("unknown".to_string(), |v| v.to_string())
info.read().rewards.map_or(" -".to_string(), |v| v.to_string())
}}
</div>
</div>
Expand All @@ -343,43 +339,39 @@ fn NodeInstanceView(
<div class="basis-1/3">
<span class="node-info-item">"Port: "</span>
{move || {
info.read()
.port
.map_or("unknown".to_string(), |v| v.to_string())
info.read().port.map_or(" -".to_string(), |v| v.to_string())
}}
</div>
<div class="basis-2/3">
<span class="node-info-item">"Node metrics Port: "</span>
{move || {
info.read()
.metrics_port
.map_or("unknown".to_string(), |v| v.to_string())
.map_or(" -".to_string(), |v| v.to_string())
}}
</div>
</div>
</p>
<p>
<span class="node-info-item">"Store cost: "</span>
{move || {
info.read().store_cost.map_or("unknown".to_string(), |v| v.to_string())
info.read().store_cost.map_or(" -".to_string(), |v| v.to_string())
}}
</p>
<p>
<div class="flex flex-row">
<div class="basis-1/2">
<span class="node-info-item">"Records: "</span>
{move || {
info.read()
.records
.map_or("unknown".to_string(), |v| v.to_string())
info.read().records.map_or(" -".to_string(), |v| v.to_string())
}}
</div>
<div class="basis-1/2">
<span class="node-info-item">"Relevant: "</span>
{move || {
info.read()
.relevant_records
.map_or("unknown".to_string(), |v| v.to_string())
.map_or(" -".to_string(), |v| v.to_string())
}}
</div>
</div>
Expand All @@ -391,25 +383,23 @@ fn NodeInstanceView(
{move || {
info.read()
.connected_peers
.map_or("unknown".to_string(), |v| v.to_string())
.map_or(" -".to_string(), |v| v.to_string())
}}
</div>
<div class="basis-1/2">
<span class="node-info-item">"Shunned by: "</span>
{move || {
info.read()
.shunned_count
.map_or("unknown".to_string(), |v| v.to_string())
.map_or(" -".to_string(), |v| v.to_string())
}}
</div>
</div>
</p>
<p>
<span class="node-info-item">"kBuckets peers: "</span>
{move || {
info.read()
.kbuckets_peers
.map_or("unknown".to_string(), |v| v.to_string())
info.read().kbuckets_peers.map_or(" -".to_string(), |v| v.to_string())
}}
</p>
<p>
Expand Down

0 comments on commit b8e5877

Please sign in to comment.