2018-04-17 16:20:53 +00:00
|
|
|
package admin
|
|
|
|
|
|
|
|
import (
|
|
|
|
"sort"
|
|
|
|
|
|
|
|
"github.com/aerogo/aero"
|
2019-06-03 09:32:43 +00:00
|
|
|
"github.com/animenotifier/notify.moe/arn"
|
2018-04-17 16:20:53 +00:00
|
|
|
"github.com/animenotifier/notify.moe/components"
|
|
|
|
)
|
|
|
|
|
|
|
|
const maxReports = 80
|
|
|
|
|
|
|
|
// ClientErrors shows client-side errors.
|
2019-06-01 04:55:49 +00:00
|
|
|
func ClientErrors(ctx aero.Context) error {
|
2018-04-17 16:20:53 +00:00
|
|
|
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))
|
|
|
|
}
|