release: NX9-WG v1.0.0

This commit is contained in:
thakares committed 2026-08-18 17:32:56 +05:30
1 parent c8a9b7cde6
commit 4dfe42fe68
42 files changed
+4689 -336

No files matched your search

+18 -4
View File
@@ -38,9 +38,10 @@ impl PeerRowView {
let is_expired =
peer.state == PeerState::Expired || peer.expires_at.is_some_and(|exp| exp <= now);
let maybe_hs = last_handshake.or(peer.last_handshake_at);
let is_online = if is_expired || peer.state != PeerState::Active {
false
} else if let Some(hs) = last_handshake.or(peer.last_handshake_at) {
} else if let Some(hs) = maybe_hs {
let diff = now.signed_duration_since(hs);
diff.num_seconds() >= 0 && diff.num_seconds() < 180
} else {
@@ -53,9 +54,14 @@ impl PeerRowView {
match peer.state {
PeerState::Active => {
if is_online {
("Online".to_string(), "status-pass".to_string())
("Connected".to_string(), "status-pass".to_string())
} else if maybe_hs.is_some() {
("Disconnected".to_string(), "status-fail".to_string())
} else {
("Offline".to_string(), "status-neutral".to_string())
(
"Awaiting Handshake".to_string(),
"status-warning".to_string(),
)
}
}
PeerState::Disabled => ("Disabled".to_string(), "status-warning".to_string()),
@@ -216,10 +222,18 @@ mod tests {
let row = PeerRowView::from_peer_and_telemetry(&peer, 1024, 2048, None);
assert_eq!(row.name, "alice-laptop");
assert_eq!(row.status_label, "Offline");
assert_eq!(row.status_label, "Awaiting Handshake");
assert_eq!(row.rx_bytes_formatted, "1.0 KB");
assert_eq!(row.tx_bytes_formatted, "2.0 KB");
let recent_hs = Utc::now().naive_utc() - chrono::Duration::seconds(30);
let row_online = PeerRowView::from_peer_and_telemetry(&peer, 1024, 2048, Some(recent_hs));
assert_eq!(row_online.status_label, "Connected");
let stale_hs = Utc::now().naive_utc() - chrono::Duration::seconds(300);
let row_stale = PeerRowView::from_peer_and_telemetry(&peer, 1024, 2048, Some(stale_hs));
assert_eq!(row_stale.status_label, "Disconnected");
let filter = PeerTableFilter {
search_query: "alice".to_string(),
status_filter: None,