Added UI for client error reports
This commit is contained in:
parent
bb80359432
commit
5eaf0db4a5
@ -2,6 +2,7 @@ component AdminTabs
|
|||||||
.tabs
|
.tabs
|
||||||
Tab("Server", "server", "/admin")
|
Tab("Server", "server", "/admin")
|
||||||
Tab("WebDev", "html5", "/admin/webdev")
|
Tab("WebDev", "html5", "/admin/webdev")
|
||||||
|
Tab("Client errors", "exclamation", "/admin/errors/client")
|
||||||
Tab("Registrations", "user-plus", "/admin/registrations")
|
Tab("Registrations", "user-plus", "/admin/registrations")
|
||||||
Tab("Purchases", "shopping-cart", "/admin/purchases")
|
Tab("Purchases", "shopping-cart", "/admin/purchases")
|
||||||
|
|
||||||
|
26
pages/admin/clienterrors.go
Normal file
26
pages/admin/clienterrors.go
Normal 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))
|
||||||
|
}
|
19
pages/admin/clienterrors.pixy
Normal file
19
pages/admin/clienterrors.pixy
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
component ClientErrors(reports []*arn.ClientErrorReport)
|
||||||
|
AdminTabs
|
||||||
|
h1.mountable Client-side errors
|
||||||
|
|
||||||
|
table
|
||||||
|
tbody
|
||||||
|
each report in reports
|
||||||
|
tr.mountable
|
||||||
|
td
|
||||||
|
a(href="/api/clienterrorreport/" + report.ID, target="_blank")= report.Message
|
||||||
|
td
|
||||||
|
each line in strings.Split(report.Stack, "\n")
|
||||||
|
p= line
|
||||||
|
td.utc-date(data-date=report.Created)
|
||||||
|
td.edit-log-user
|
||||||
|
if report.CreatedBy != ""
|
||||||
|
Avatar(report.Creator())
|
||||||
|
else
|
||||||
|
span anonymous
|
@ -278,6 +278,7 @@ func Configure(app *aero.Application) {
|
|||||||
l.Page("/admin", admin.Get)
|
l.Page("/admin", admin.Get)
|
||||||
l.Page("/admin/webdev", admin.WebDev)
|
l.Page("/admin/webdev", admin.WebDev)
|
||||||
l.Page("/admin/registrations", admin.UserRegistrations)
|
l.Page("/admin/registrations", admin.UserRegistrations)
|
||||||
|
l.Page("/admin/errors/client", admin.ClientErrors)
|
||||||
l.Page("/admin/purchases", admin.PurchaseHistory)
|
l.Page("/admin/purchases", admin.PurchaseHistory)
|
||||||
|
|
||||||
// Editor
|
// Editor
|
||||||
|
@ -75,7 +75,7 @@ calendar-entry-seen-background = ui-background
|
|||||||
calendar-entry-seen-hover-background = ui-background
|
calendar-entry-seen-hover-background = ui-background
|
||||||
|
|
||||||
// Tables
|
// Tables
|
||||||
table-width-normal = 900px
|
table-width-normal = 1100px
|
||||||
|
|
||||||
// Feature cards
|
// Feature cards
|
||||||
const feature-card-saturation = 83%
|
const feature-card-saturation = 83%
|
||||||
|
Loading…
Reference in New Issue
Block a user