ui: relays page: sorted

This commit is contained in:
Mike Dilger 2022-12-26 09:50:48 +13:00
parent 3fc0221413
commit 90563d4da6

View File

@ -1,4 +1,5 @@
use super::GossipUi;
use crate::db::DbRelay;
use crate::globals::GLOBALS;
use eframe::egui;
use egui::{Align, Context, Layout, ScrollArea, Ui};
@ -8,10 +9,12 @@ pub(super) fn update(_app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::F
ui.heading("Relays known");
ui.add_space(18.0);
let relays = GLOBALS.relays.blocking_lock().clone();
let mut relays = GLOBALS.relays.blocking_lock().clone();
let mut relays: Vec<DbRelay> = relays.drain().map(|(_,relay)| relay).collect();
relays.sort_by(|a,b| a.url.cmp(&b.url));
ScrollArea::vertical().show(ui, |ui| {
for (_, relay) in relays.iter() {
for relay in relays.iter() {
ui.horizontal(|ui| {
ui.label(&relay.url);