sort disabled to bot
parent
3f7c13a6be
commit
ce0750db66
2
go.mod
2
go.mod
|
|
@ -1,6 +1,6 @@
|
|||
module gitea.inhome.blapointe.com/local/firestormy
|
||||
|
||||
go 1.17
|
||||
go 1.22
|
||||
|
||||
require (
|
||||
gitea.inhome.blapointe.com/local/args v0.0.0-20240109214601-658deda479a4
|
||||
|
|
|
|||
|
|
@ -2,12 +2,13 @@ package server
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"sort"
|
||||
|
||||
"gitea.inhome.blapointe.com/local/firestormy/config"
|
||||
"gitea.inhome.blapointe.com/local/firestormy/config/ns"
|
||||
"gitea.inhome.blapointe.com/local/firestormy/scheduler"
|
||||
"gitea.inhome.blapointe.com/local/logb"
|
||||
"net/http"
|
||||
"sort"
|
||||
)
|
||||
|
||||
func (s *Server) list(w http.ResponseWriter, r *http.Request) {
|
||||
|
|
@ -34,6 +35,12 @@ func (s *Server) list(w http.ResponseWriter, r *http.Request) {
|
|||
out[i] = toMap(j, false)
|
||||
}
|
||||
sort.Slice(out, func(i, j int) bool {
|
||||
if out[i]["disabled"].(bool) == out[j]["disabled"].(bool) {
|
||||
} else if out[i]["disabled"].(bool) {
|
||||
return false
|
||||
} else if out[j]["disabled"].(bool) {
|
||||
return true
|
||||
}
|
||||
return out[i]["title"].(string) < out[j]["title"].(string)
|
||||
})
|
||||
json.NewEncoder(w).Encode(out)
|
||||
|
|
|
|||
Loading…
Reference in New Issue