mirror of
https://github.com/threefoldtech/mycelium.git
synced 2026-03-29 07:39:51 +00:00
Added all field to sort on in peer table + rearranged order of derived traits to be the same everywhere
This commit is contained in:
committed by
Lee Smet
parent
109cc80ca0
commit
125060be9f
@@ -148,8 +148,11 @@ fn sort_peers(
|
||||
) {
|
||||
peers.sort_by(|a, b| {
|
||||
let cmp = match column {
|
||||
//"Endpoint" => a.endpoint.cmp(&b.endpoint),
|
||||
"Endpoint" => a.endpoint.cmp(&b.endpoint),
|
||||
"Type" => PeerTypeWrapper(a.pt.clone()).cmp(&PeerTypeWrapper(b.pt.clone())),
|
||||
"Connection State" => a.connection_state.cmp(&b.connection_state),
|
||||
"Tx bytes" => a.tx_bytes.cmp(&b.tx_bytes),
|
||||
"Rx bytes" => a.rx_bytes.cmp(&b.rx_bytes),
|
||||
_ => Ordering::Equal,
|
||||
};
|
||||
match direction {
|
||||
@@ -212,9 +215,18 @@ fn PeersTable(peers: Vec<mycelium::peer_manager::PeerStats>) -> Element {
|
||||
onclick: move |_| sort_peers_signal("Type".to_string()),
|
||||
"Type {get_sort_indicator(sort_column, sort_direction, \"Type\".to_string())}"
|
||||
}
|
||||
th { "Connection State" }
|
||||
th { "Tx bytes" }
|
||||
th { "Rx bytes" }
|
||||
th {
|
||||
onclick: move |_| sort_peers_signal("Connection State".to_string()),
|
||||
"Connection State {get_sort_indicator(sort_column, sort_direction, \"Connection State\".to_string())}"
|
||||
}
|
||||
th {
|
||||
onclick: move |_| sort_peers_signal("Tx bytes".to_string()),
|
||||
"Tx bytes {get_sort_indicator(sort_column, sort_direction, \"Tx bytes\".to_string())}"
|
||||
}
|
||||
th {
|
||||
onclick: move |_| sort_peers_signal("Rx bytes".to_string()),
|
||||
"Rx bytes {get_sort_indicator(sort_column, sort_direction, \"Rx bytes\".to_string())}"
|
||||
}
|
||||
}
|
||||
}
|
||||
tbody {
|
||||
|
||||
@@ -30,7 +30,7 @@ pub enum Protocol {
|
||||
}
|
||||
|
||||
/// An endpoint defines a address and a protocol to use when communicating with it.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Endpoint {
|
||||
proto: Protocol,
|
||||
|
||||
@@ -64,7 +64,7 @@ pub struct PeerManager<M> {
|
||||
}
|
||||
|
||||
/// Details how the PeerManager learned about a remote.
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum PeerType {
|
||||
/// Statically configured peer.
|
||||
@@ -100,7 +100,7 @@ struct ConnectionTraffic {
|
||||
}
|
||||
|
||||
/// General state about a connection to a [`Peer`].
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub enum ConnectionState {
|
||||
/// There is a working connection to the [`Peer`].
|
||||
@@ -112,7 +112,7 @@ pub enum ConnectionState {
|
||||
}
|
||||
|
||||
/// Identification and information/statistics for a specific [`Peer`]
|
||||
#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
|
||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PeerStats {
|
||||
/// The endpoint of the [`Peer`].
|
||||
|
||||
Reference in New Issue
Block a user