From 73c735308242ab9d47227b6b64bf0fff393f756c Mon Sep 17 00:00:00 2001 From: Gibheer Date: Thu, 10 Jan 2019 07:10:02 +0100 Subject: 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. --- cmd/monfront/main.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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{} -- cgit v1.2.3-70-g09d2