mirror of
https://github.com/ipnet-mesh/meshcore-hub.git
synced 2026-03-28 17:42:56 +01:00
Sort node dropdown alphabetically in admin interface
Nodes in the dropdown are now sorted alphabetically by name, with unnamed nodes appearing at the end.
This commit is contained in:
@@ -97,6 +97,10 @@ async def admin_node_tags(
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
nodes = data.get("items", [])
|
||||
# Sort nodes alphabetically by name (unnamed nodes at the end)
|
||||
nodes.sort(
|
||||
key=lambda n: (n.get("name") is None, (n.get("name") or "").lower())
|
||||
)
|
||||
except Exception as e:
|
||||
logger.exception("Failed to fetch nodes: %s", e)
|
||||
context["error"] = "Failed to fetch nodes"
|
||||
|
||||
Reference in New Issue
Block a user