diff --git a/cmd/monfront/main.go b/cmd/monfront/main.go index f7bdaa4..e600a9e 100644 --- a/cmd/monfront/main.go +++ b/cmd/monfront/main.go @@ -331,6 +331,13 @@ func showGroups(w http.ResponseWriter, r *http.Request) { if strings.HasPrefix(r.URL.Path, "/unhandled") { query += ` and state > 0` } + + if strings.HasPrefix(r.URL.Path, "/unhandled") { + query += ` order by state desc, groupname, nodename` + } else { + query += ` order by groupname, nodename` + } + rows, err := DB.Query(query) if err != nil { w.WriteHeader(http.StatusInternalServerError) @@ -339,12 +346,6 @@ 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{} @@ -388,7 +389,7 @@ func showCheck(w http.ResponseWriter, r *http.Request) { } query := `select c.id, c.message, c.enabled, c.updated, c.last_refresh, m.id, m.name, n.id, n.name, n.message, co.id, co.Name, co.message, - ac.cmdline, ac.states, ac.msg + ac.cmdline, ac.states, ac.msg, ac.next_time from checks c join active_checks ac on c.id = ac.check_id join nodes n on c.node_id = n.id @@ -398,7 +399,7 @@ func showCheck(w http.ResponseWriter, r *http.Request) { err := DB.QueryRow(query, id[0]).Scan(&cd.Id, &cd.Message, &cd.Enabled, &cd.Updated, &cd.LastRefresh, &cd.MappingId, &cd.MappingName, &cd.NodeId, &cd.NodeName, &cd.NodeMessage, &cd.CommandId, &cd.CommandName, &cd.CommandMessage, - pq.Array(&cd.CommandLine), pq.Array(&cd.States), &cd.Notice) + pq.Array(&cd.CommandLine), pq.Array(&cd.States), &cd.Notice, &cd.NextTime) if err != nil { w.WriteHeader(http.StatusInternalServerError) w.Write([]byte("problems with the database"))