mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-28 03:00:03 +02:00
Continue working on new admin pages
This commit is contained in:
parent
904bf1a50b
commit
d2aff9a46a
27 changed files with 669 additions and 539 deletions
|
@ -23,8 +23,6 @@ import (
|
|||
|
||||
const (
|
||||
DASHBOARD base.TplName = "admin/dashboard"
|
||||
REPOS base.TplName = "admin/repos"
|
||||
AUTHS base.TplName = "admin/auths"
|
||||
CONFIG base.TplName = "admin/config"
|
||||
MONITOR_PROCESS base.TplName = "admin/monitor/process"
|
||||
MONITOR_CRON base.TplName = "admin/monitor/cron"
|
||||
|
@ -156,48 +154,6 @@ func Dashboard(ctx *middleware.Context) {
|
|||
ctx.HTML(200, DASHBOARD)
|
||||
}
|
||||
|
||||
func Repositories(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = "Repository Management"
|
||||
ctx.Data["PageIsRepos"] = true
|
||||
|
||||
p := com.StrTo(ctx.Query("p")).MustInt()
|
||||
if p < 1 {
|
||||
p = 1
|
||||
}
|
||||
pageNum := 50
|
||||
count := models.CountRepositories()
|
||||
curCount := int64((p-1)*pageNum + pageNum)
|
||||
if curCount > count {
|
||||
p = int(count) / pageNum
|
||||
} else if count > curCount {
|
||||
ctx.Data["NextPageNum"] = p + 1
|
||||
}
|
||||
if p > 1 {
|
||||
ctx.Data["LastPageNum"] = p - 1
|
||||
}
|
||||
|
||||
var err error
|
||||
ctx.Data["Repos"], err = models.GetRepositoriesWithUsers(pageNum, (p-1)*pageNum)
|
||||
if err != nil {
|
||||
ctx.Handle(500, "admin.Repositories", err)
|
||||
return
|
||||
}
|
||||
ctx.HTML(200, REPOS)
|
||||
}
|
||||
|
||||
func Auths(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = "Auth Sources"
|
||||
ctx.Data["PageIsAuths"] = true
|
||||
|
||||
var err error
|
||||
ctx.Data["Sources"], err = models.GetAuths()
|
||||
if err != nil {
|
||||
ctx.Handle(500, "admin.Auths", err)
|
||||
return
|
||||
}
|
||||
ctx.HTML(200, AUTHS)
|
||||
}
|
||||
|
||||
func Config(ctx *middleware.Context) {
|
||||
ctx.Data["Title"] = "Server Configuration"
|
||||
ctx.Data["PageIsConfig"] = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue