This commit is contained in:
John Smith 2023-03-14 17:44:32 -04:00
parent e91044e33d
commit ce1eca606c
4 changed files with 6 additions and 20 deletions

View File

@ -52,8 +52,8 @@ impl TableViewItem<PeerTableColumn> for PeerTableData {
match column {
PeerTableColumn::NodeId => self
.node_ids
.best()
.map(|n| n.value.encode())
.first()
.cloned()
.unwrap_or_else(|| "???".to_owned()),
PeerTableColumn::Address => format!(
"{:?}:{}",
@ -78,21 +78,7 @@ impl TableViewItem<PeerTableColumn> for PeerTableData {
Self: Sized,
{
match column {
PeerTableColumn::NodeId => {
let n1 = self
.node_ids
.best()
.map(|n| n.value.encode())
.unwrap_or_else(|| "???".to_owned());
let n2 = other
.node_ids
.best()
.map(|n| n.value.encode())
.unwrap_or_else(|| "???".to_owned());
n1.cmp(&n2)
}
PeerTableColumn::NodeId => self.to_column(column).cmp(&other.to_column(column)),
PeerTableColumn::Address => self.to_column(column).cmp(&other.to_column(column)),
PeerTableColumn::LatencyAvg => self
.peer_stats

View File

@ -753,7 +753,7 @@ impl UI {
.full_screen();
let peers_table_view = PeersTableView::new()
.column(PeerTableColumn::NodeId, "Node Id", |c| c.width(43))
.column(PeerTableColumn::NodeId, "Node Id", |c| c.width(48))
.column(PeerTableColumn::Address, "Address", |c| c)
.column(PeerTableColumn::LatencyAvg, "Ping", |c| c.width(8))
.column(PeerTableColumn::TransferDownAvg, "Down", |c| c.width(8))

View File

@ -1551,7 +1551,7 @@ impl NetworkManager {
if let Some(nr) = routing_table.lookup_node_ref(k) {
let peer_stats = nr.peer_stats();
let peer = PeerTableData {
node_ids: nr.node_ids(),
node_ids: nr.node_ids().iter().map(|x| x.to_string()).collect(),
peer_address: v.last_connection.remote(),
peer_stats,
};

View File

@ -267,7 +267,7 @@ pub struct VeilidStateAttachment {
)]
#[archive_attr(repr(C), derive(CheckBytes))]
pub struct PeerTableData {
pub node_ids: TypedKeySet,
pub node_ids: Vec<String>,
pub peer_address: PeerAddress,
pub peer_stats: PeerStats,
}