Improved admin dashboard

This commit is contained in:
Eduard Urbach 2017-06-18 17:44:18 +02:00
parent e99225ce10
commit 130cfca211
3 changed files with 65 additions and 6 deletions

View File

@ -1,7 +1,10 @@
package admin package admin
import ( import (
"sort"
"github.com/aerogo/aero" "github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components" "github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils" "github.com/animenotifier/notify.moe/utils"
) )
@ -14,5 +17,13 @@ func Get(ctx *aero.Context) string {
return ctx.Redirect("/") return ctx.Redirect("/")
} }
return ctx.HTML(components.Admin(user)) types := []string{}
for typeName := range arn.DB.Types() {
types = append(types, typeName)
}
sort.Strings(types)
return ctx.HTML(components.Admin(user, types))
} }

View File

@ -1,6 +1,31 @@
component Admin(user *arn.User) component Admin(user *arn.User, types []string)
h2.page-title Admin h2.page-title Admin Panel
h3 Server
table table
tr //- thead
td Go version: //- tr
td= runtime.Version() //- th Metric
//- th Value
tbody
tr
td CPU count:
td= runtime.NumCPU()
tr
td Goroutines:
td= runtime.NumGoroutine()
tr
td Go version:
td= runtime.Version()
h3 Types
table
//- thead
//- tr
//- th Table
tbody
each typeName in types
tr
td= typeName
td
a(href="/api/" + strings.ToLower(typeName) + "/")= "/api/" + strings.ToLower(typeName) + "/"

23
styles/table.scarlet Normal file
View File

@ -0,0 +1,23 @@
table
width 100%
tr
border-bottom-width 1px
border-bottom-style solid
border-bottom-color rgba(0, 0, 0, 0.05)
:last-child
border none
td
padding 0.5rem 1rem
th
font-size 1.2em
text-align left
padding 0.5rem 1rem
font-weight bold
tbody
tr
:hover
background-color rgba(0, 0, 0, 0.03)