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

View File

@ -753,7 +753,7 @@ impl UI {
.full_screen(); .full_screen();
let peers_table_view = PeersTableView::new() 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::Address, "Address", |c| c)
.column(PeerTableColumn::LatencyAvg, "Ping", |c| c.width(8)) .column(PeerTableColumn::LatencyAvg, "Ping", |c| c.width(8))
.column(PeerTableColumn::TransferDownAvg, "Down", |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) { if let Some(nr) = routing_table.lookup_node_ref(k) {
let peer_stats = nr.peer_stats(); let peer_stats = nr.peer_stats();
let peer = PeerTableData { 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_address: v.last_connection.remote(),
peer_stats, peer_stats,
}; };

View File

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