aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGibheer <gibheer+git@zero-knowledge.org>2019-01-10 07:10:02 +0100
committerGibheer <gibheer+git@zero-knowledge.org>2019-01-10 07:10:02 +0100
commit73c735308242ab9d47227b6b64bf0fff393f756c (patch)
treeb6d3d75576fdbc2e87ec5229b8f0c6faeff41a62
parentea658177eea72175ab23d08f3064b4f346133c46 (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.go12
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{}