Skip to content
This repository has been archived by the owner on Oct 22, 2024. It is now read-only.

Commit

Permalink
feat(dynamic): sort instances by name
Browse files Browse the repository at this point in the history
To keep a stable order, instances are sorted by name
  • Loading branch information
acouvreur committed Nov 3, 2022
1 parent e32425c commit 160faaa
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/http/routes/strategies.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package routes
import (
"fmt"
"net/http"
"sort"
"strings"
"time"

log "github.com/sirupsen/logrus"
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 160faaa

Please sign in to comment.