diff options
author | Gibheer <gibheer+git@zero-knowledge.org> | 2019-01-10 07:10:02 +0100 |
---|---|---|
committer | Gibheer <gibheer+git@zero-knowledge.org> | 2019-01-10 07:10:02 +0100 |
commit | 73c735308242ab9d47227b6b64bf0fff393f756c (patch) | |
tree | b6d3d75576fdbc2e87ec5229b8f0c6faeff41a62 | |
parent | ea658177eea72175ab23d08f3064b4f346133c46 (diff) |
monfront - sort result list
The result list should be ordered for the state when unhandled entries
should be returned. Else it is getting weird to figure out, which issue
is the most important to fix.
-rw-r--r-- | cmd/monfront/main.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/cmd/monfront/main.go b/cmd/monfront/main.go index 9cb906a..f7bdaa4 100644 --- a/cmd/monfront/main.go +++ b/cmd/monfront/main.go @@ -270,7 +270,11 @@ func showChecks(w http.ResponseWriter, r *http.Request) { if len(where) > 0 { query += " where " + strings.Join(where, " and ") } - query += ` order by n.name, co.name` + if strings.HasPrefix(r.URL.Path, "/unhandled") { + query += ` order by ac.states[1] desc, n.name, co.name` + } else { + query += ` order by n.name, co.name` + } rows, err := DB.Query(query, params...) if err != nil { w.WriteHeader(http.StatusInternalServerError) @@ -335,6 +339,12 @@ func showGroups(w http.ResponseWriter, r *http.Request) { return } + if strings.HasPrefix(r.URL.Path, "/unhandled") { + query += ` order by maxstate desc, g.name, n.name` + } else { + query += ` order by g.name, n.name` + } + groups := []group{} for rows.Next() { g := group{} |