mirror of
https://github.com/samsonjs/retrogit.git
synced 2026-04-27 15:07:43 +00:00
Add totals to admin page.
This commit is contained in:
parent
8cb1302b1d
commit
f39b6e5e17
2 changed files with 9 additions and 1 deletions
|
|
@ -541,14 +541,18 @@ func usersAdminHandler(w http.ResponseWriter, r *http.Request) *AppError {
|
||||||
}
|
}
|
||||||
|
|
||||||
users := make([]*AdminUserData, 0)
|
users := make([]*AdminUserData, 0)
|
||||||
|
totalRepos := 0
|
||||||
for _ = range accounts {
|
for _ = range accounts {
|
||||||
select {
|
select {
|
||||||
case r := <-ch:
|
case r := <-ch:
|
||||||
users = append(users, r)
|
users = append(users, r)
|
||||||
|
totalRepos += len(r.Repos.AllRepos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var data = map[string]interface{}{
|
var data = map[string]interface{}{
|
||||||
"Users": users,
|
"Users": users,
|
||||||
|
"TotalUsers": len(users),
|
||||||
|
"TotalRepos": totalRepos,
|
||||||
}
|
}
|
||||||
return templates["users-admin"].Render(w, data)
|
return templates["users-admin"].Render(w, data)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,10 @@
|
||||||
|
|
||||||
<link rel="stylesheet" href="/static/admin.css">
|
<link rel="stylesheet" href="/static/admin.css">
|
||||||
|
|
||||||
|
<div class="blurb">
|
||||||
|
{{.TotalUsers}} users with {{.TotalRepos}} repositories.
|
||||||
|
</div>
|
||||||
|
|
||||||
<table id="users-table">
|
<table id="users-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue