From 160faaad0fe9d49fcb6a8b09795cd4448bf365de Mon Sep 17 00:00:00 2001 From: Alexis Couvreur Date: Thu, 27 Oct 2022 15:38:48 +0000 Subject: [PATCH] feat(dynamic): sort instances by name To keep a stable order, instances are sorted by name --- app/http/routes/strategies.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/http/routes/strategies.go b/app/http/routes/strategies.go index aced851..d2f6317 100644 --- a/app/http/routes/strategies.go +++ b/app/http/routes/strategies.go @@ -3,6 +3,8 @@ package routes import ( "fmt" "net/http" + "sort" + "strings" "time" log "github.com/sirupsen/logrus" @@ -78,6 +80,10 @@ func sessionStateToRenderOptionsInstanceState(sessionState *sessions.SessionStat return true }) + sort.SliceStable(instances, func(i, j int) bool { + return strings.Compare(instances[i].Name, instances[j].Name) == -1 + }) + return }