From f377f90cbe5d9ebec0e0344b3afdce744c289623 Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Sat, 29 Feb 2020 17:01:13 +0000 Subject: [PATCH] Sort the node list in the debug status page --- node/debug.go | 9 +++++++++ node/templates/index.html | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/node/debug.go b/node/debug.go index 89efa48c..23826503 100644 --- a/node/debug.go +++ b/node/debug.go @@ -37,6 +37,14 @@ func newMountStatus(m *pb.Mount, nodes []*nodeInfo, icecastMounts map[string]*pb } } +type statusList []*pb.Status + +func (l statusList) Len() int { return len(l) } +func (l statusList) Swap(i, j int) { l[i], l[j] = l[j], l[i] } +func (l statusList) Less(i, j int) bool { + return l[i].Name < l[j].Name +} + type mountStatusList []*mountStatus func (l mountStatusList) Len() int { return len(l) } @@ -100,6 +108,7 @@ func serveStatusPage(n *Node, w http.ResponseWriter, r *http.Request, tpl *templ } } } + sort.Sort(statusList(statuses)) ms := mountsToStatus(n.mounts.GetMounts(), nodes, exemplary) ctx := struct { diff --git a/node/templates/index.html b/node/templates/index.html index 565bae2b..308f64b3 100644 --- a/node/templates/index.html +++ b/node/templates/index.html @@ -70,7 +70,7 @@ <div class="row"> <p> <small> - Click on a stream to listen to it.<br> + Click on a stream to listen to it. Hover on a stream to see more details. </small> </p> -- GitLab