Add totals to admin page.

This commit is contained in:
Mihai Parparita 2014-12-14 16:16:12 -08:00
parent 8cb1302b1d
commit f39b6e5e17
2 changed files with 9 additions and 1 deletions

View file

@ -541,14 +541,18 @@ func usersAdminHandler(w http.ResponseWriter, r *http.Request) *AppError {
}
users := make([]*AdminUserData, 0)
totalRepos := 0
for _ = range accounts {
select {
case r := <-ch:
users = append(users, r)
totalRepos += len(r.Repos.AllRepos)
}
}
var data = map[string]interface{}{
"Users": users,
"Users": users,
"TotalUsers": len(users),
"TotalRepos": totalRepos,
}
return templates["users-admin"].Render(w, data)
}

View file

@ -4,6 +4,10 @@
<link rel="stylesheet" href="/static/admin.css">
<div class="blurb">
{{.TotalUsers}} users with {{.TotalRepos}} repositories.
</div>
<table id="users-table">
<thead>
<tr>