From 4818599a938431240a3970a5d7cbaeb65cf99dbd Mon Sep 17 00:00:00 2001 From: Eduard Gert Date: Tue, 26 May 2026 09:50:18 +0200 Subject: [PATCH] sort peers --- client/ui/frontend/src/modules/peers/Peers.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/client/ui/frontend/src/modules/peers/Peers.tsx b/client/ui/frontend/src/modules/peers/Peers.tsx index f71d7ac3b..be5ae5e1c 100644 --- a/client/ui/frontend/src/modules/peers/Peers.tsx +++ b/client/ui/frontend/src/modules/peers/Peers.tsx @@ -36,7 +36,7 @@ export const Peers = () => { const filtered = useMemo(() => { const q = search.trim().toLowerCase(); - return peers.filter((p) => { + const matches = peers.filter((p) => { if (statusFilter === "online" && !isOnline(p.connStatus)) return false; if (statusFilter === "offline" && isOnline(p.connStatus)) return false; if (q && !p.fqdn.toLowerCase().includes(q) && !p.ip.includes(q)) { @@ -44,6 +44,14 @@ export const Peers = () => { } return true; }); + return matches.sort((a, b) => { + const aOnline = isOnline(a.connStatus); + const bOnline = isOnline(b.connStatus); + if (aOnline !== bOnline) return aOnline ? -1 : 1; + const aName = (a.fqdn || a.ip).toLowerCase(); + const bName = (b.fqdn || b.ip).toLowerCase(); + return aName.localeCompare(bName); + }); }, [peers, search, statusFilter]); return (