Added UI for client error reports

This commit is contained in:
2018-04-17 18:20:53 +02:00
parent bb80359432
commit 5eaf0db4a5
5 changed files with 48 additions and 1 deletions

View File

@ -0,0 +1,26 @@
package admin
import (
"sort"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
)
const maxReports = 80
// ClientErrors shows client-side errors.
func ClientErrors(ctx *aero.Context) string {
reports := arn.AllClientErrorReports()
sort.Slice(reports, func(i, j int) bool {
return reports[i].Created > reports[j].Created
})
if len(reports) > maxReports {
reports = reports[:maxReports]
}
return ctx.HTML(components.ClientErrors(reports))
}