P2: peers CRUD and aggregated stats
Backend - api/peers.rs: list/add/remove + aggregate() that derives totals, per-state counts, and tx/rx sums in one pass over the peer list - poller.rs spawns a 3s tokio loop that emits peers://updated and stats://updated; cancelled via abort() on stop_daemon - DELETE peer URL-encodes the endpoint (the path includes ://) with a small inline percent-encoder to avoid a url crate dep - Tauri commands: peers_list, peer_add (with empty-string guard), peer_remove, peers_stats Frontend - peers store subscribes to the two events and refreshes after add/remove for immediate UI feedback - Peers view renders endpoint, type, color-coded state badge, and formatBytes-formatted rx/tx; the four stat cards re-use a reusable Stat component - AddPeerDialog uses radix-vue's Dialog primitive with regex validation for tcp:// and quic:// schemes
This commit is contained in:
@@ -2,6 +2,7 @@ pub mod api;
|
||||
pub mod commands;
|
||||
pub mod elevation;
|
||||
pub mod error;
|
||||
pub mod poller;
|
||||
pub mod sidecar;
|
||||
pub mod state;
|
||||
|
||||
@@ -34,6 +35,10 @@ pub fn run() {
|
||||
commands::stop_daemon,
|
||||
commands::node_info,
|
||||
commands::sidecar_logs,
|
||||
commands::peers_list,
|
||||
commands::peer_add,
|
||||
commands::peer_remove,
|
||||
commands::peers_stats,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("error while running tauri application");
|
||||
|
||||
Reference in New Issue
Block a user