Add more tables to the Debug Page.

Localise more parts of the Control Panel Dashboard.

Added 11 new phrases.
This commit is contained in:
Azareal 2019-06-03 10:35:25 +10:00
parent 05c2ac3ce4
commit 9caef90d72
6 changed files with 100 additions and 11 deletions

View File

@ -612,6 +612,16 @@ type DebugPageDatabase struct {
Replies int
ProfileReplies int
ActivityStream int
Likes int
Attachments int
Polls int
Views int
ViewsAgents int
ViewsForums int
ViewsLangs int
ViewsReferrers int
ViewsSystems int
}
type DebugPageDisk struct {

View File

@ -768,9 +768,20 @@
"panel_dashboard_guests_online_desc":"The number of guests who are currently online",
"panel_dashboard_users_online":"%d%s users online",
"panel_dashboard_users_online_desc":"The number of logged-in users who are currently online",
"panel_dashboard_posts":"%d posts %s",
"panel_dashboard_posts_desc":"The number of new posts over the last 24 hours",
"panel_dashboard_topics":"%d topics %s",
"panel_dashboard_topics_desc":"The number of new topics over the last 24 hours",
"panel_dashboard_online_day": "?? online / day",
"panel_dashboard_searches_day": "?? searches / week",
"panel_dashboard_new_users":"%d new users %s",
"panel_dashboard_new_users_desc":"The number of new users over the last 7 days",
"panel_dashboard_reports":"%d reports %s",
"panel_dashboard_reports_desc":"The number of reports over the last 7 days",
"panel_dashboard_day_suffix":" / day",
"panel_dashboard_week_suffix":" / week",
"panel_dashboard_coming_soon":"Coming Soon!",
"panel_dashboard_unknown":"Unknown",
"panel_users_head":"Users",
"panel_users_profile":"Profile",

View File

@ -73,9 +73,10 @@ func Dashboard(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError
if ferr != nil {
return ferr
}
var unknown = p.GetTmplPhrase("panel_dashboard_unknown")
// We won't calculate this on the spot anymore, as the system doesn't seem to like it if we do multiple fetches simultaneously. Should we constantly calculate this on a background thread? Perhaps, the watchdog to scale back heavy features under load? One plus side is that we'd get immediate CPU percentages here instead of waiting it to kick in with WebSockets
var cpustr = "Unknown"
var cpustr = unknown
var cpuColour string
lessThanSwitch := func(number int, lowerBound int, midBound int) string {
@ -91,7 +92,7 @@ func Dashboard(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError
var ramstr, ramColour string
memres, err := mem.VirtualMemory()
if err != nil {
ramstr = "Unknown"
ramstr = unknown
} else {
totalCount, totalUnit := c.ConvertByteUnit(float64(memres.Total))
usedCount := c.ConvertByteInUnit(float64(memres.Total-memres.Available), totalUnit)
@ -205,13 +206,13 @@ func Dashboard(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError
//addElem("dash-reqs","", strconv.Itoa(reqCount) + " reqs / second", 7, "grid_stat grid_end_group " + topicColour, "", "", "The number of requests over the last 24 hours")
}
addElem("dash-postsperday", "",strconv.Itoa(postCount) + " posts" + postInterval, 6, "grid_stat " + postColour, "", "", "The number of new posts over the last 24 hours")
addElem("dash-topicsperday", "",strconv.Itoa(topicCount) + " topics" + topicInterval, 7, "grid_stat " + topicColour, "", "", "The number of new topics over the last 24 hours")
addElem("dash-totonlineperday","", "?? online / day", 8, "grid_stat stat_disabled", "", "", p.GetTmplPhrase("panel_dashboard_coming_soon") /*, "The people online over the last 24 hours"*/)
addElem("dash-postsperday", "",p.GetTmplPhrasef("panel_dashboard_posts", postCount, postInterval), 6, "grid_stat " + postColour, "", "", p.GetTmplPhrase("panel_dashboard_posts_desc"))
addElem("dash-topicsperday", "",p.GetTmplPhrasef("panel_dashboard_topics", topicCount, topicInterval), 7, "grid_stat " + topicColour, "", "", p.GetTmplPhrase("panel_dashboard_topics_desc"))
addElem("dash-totonlineperday","", p.GetTmplPhrasef("panel_dashboard_online_day"), 8, "grid_stat stat_disabled", "", "", p.GetTmplPhrase("panel_dashboard_coming_soon") /*, "The people online over the last 24 hours"*/)
addElem("dash-searches","", "?? searches / week", 9, "grid_stat stat_disabled", "", "", p.GetTmplPhrase("panel_dashboard_coming_soon") /*"The number of searches over the last 7 days"*/)
addElem("dash-newusers","", strconv.Itoa(newUserCount) + " new users" + newUserInterval, 10, "grid_stat", "", "", "The number of new users over the last 7 days")
addElem("dash-reports","", strconv.Itoa(reportCount) + " reports" + reportInterval, 11, "grid_stat", "", "", "The number of reports over the last 7 days")
addElem("dash-searches","", p.GetTmplPhrasef("panel_dashboard_searches_day"), 9, "grid_stat stat_disabled", "", "", p.GetTmplPhrase("panel_dashboard_coming_soon") /*"The number of searches over the last 7 days"*/)
addElem("dash-newusers","", p.GetTmplPhrasef("panel_dashboard_new_users", newUserCount, newUserInterval), 10, "grid_stat", "", "", p.GetTmplPhrasef("panel_dashboard_new_users_desc"))
addElem("dash-reports","", p.GetTmplPhrasef("panel_dashboard_reports", reportCount, reportInterval), 11, "grid_stat", "", "", p.GetTmplPhrasef("panel_dashboard_reports_desc"))
if false {
addElem("dash-minperuser","", "?? minutes / user / week", 12, "grid_stat stat_disabled", "", "", p.GetTmplPhrase("panel_dashboard_coming_soon") /*"The average number of number of minutes spent by each active user over the last 7 days"*/)

View File

@ -61,7 +61,47 @@ func Debug(w http.ResponseWriter, r *http.Request, user c.User) c.RouteError {
topicListThawed := c.TopicListThaw.Thawed()
debugCache := c.DebugPageCache{tlen, ulen, rlen, tcap, ucap, rcap, topicListThawed}
debugDatabase := c.DebugPageDatabase{c.Topics.Count(),c.Users.Count(),c.Rstore.Count(),c.Prstore.Count(),c.Activity.Count()}
// TODO: Implement a LikeStore and call Count on that instead
likes, err := qgen.NewAcc().Count("likes").Total()
if err != nil {
return c.InternalError(err,w,r)
}
// TODO: Call Count on an attachment store
attachs, err := qgen.NewAcc().Count("attachments").Total()
if err != nil {
return c.InternalError(err,w,r)
}
// TODO: Implement a PollStore and call Count on that instead
polls, err := qgen.NewAcc().Count("polls").Total()
if err != nil {
return c.InternalError(err,w,r)
}
views, err := qgen.NewAcc().Count("viewchunks").Total()
if err != nil {
return c.InternalError(err,w,r)
}
viewsAgents, err := qgen.NewAcc().Count("viewchunks_agents").Total()
if err != nil {
return c.InternalError(err,w,r)
}
viewsForums, err := qgen.NewAcc().Count("viewchunks_forums").Total()
if err != nil {
return c.InternalError(err,w,r)
}
viewsLangs, err := qgen.NewAcc().Count("viewchunks_langs").Total()
if err != nil {
return c.InternalError(err,w,r)
}
viewsReferrers, err := qgen.NewAcc().Count("viewchunks_referrers").Total()
if err != nil {
return c.InternalError(err,w,r)
}
viewsSystems, err := qgen.NewAcc().Count("viewchunks_systems").Total()
if err != nil {
return c.InternalError(err,w,r)
}
debugDatabase := c.DebugPageDatabase{c.Topics.Count(),c.Users.Count(),c.Rstore.Count(),c.Prstore.Count(),c.Activity.Count(),likes,attachs,polls,views,viewsAgents,viewsForums,viewsLangs,viewsReferrers,viewsSystems}
staticSize, err := c.DirSize("./public/")
if err != nil {

View File

@ -3,7 +3,7 @@
</div>
<div id="panel_dashboard" class="colstack_grid">
{{range .}}
<div id="{{.ID}}" class="grid_item {{.Class}}" title="{{.Note}}" style="{{if .TextColour}}color: {{.TextColour}};{{end}}{{if .Background}}background-color: {{.Background}};{{end}}">
<div id="{{.ID}}" class="grid_item {{.Class}}" title="{{.Note}}" style="{{if .TextColour}}color:{{.TextColour}};{{end}}{{if .Background}}background-color:{{.Background}};{{end}}">
{{if .Href}}<a href="{{.Href}}">{{.Body}}</a>{{else}}<span>{{.Body}}</span>{{end}}
</div>
{{end}}

View File

@ -105,11 +105,38 @@
<div class="grid_item grid_stat grid_stat_head"><span>Profile Replies</span></div>
<div class="grid_item grid_stat grid_stat_head"><span>Activity Stream</span></div>
<div class="grid_item grid_stat grid_stat_head"><span>???</span></div>
<div class="grid_item grid_stat grid_stat_head"><span>Likes</span></div>
<div class="grid_item grid_stat"><span>{{.Database.ProfileReplies}}</span></div>
<div class="grid_item grid_stat"><span>{{.Database.ActivityStream}}</span></div>
<div class="grid_item grid_stat"><span>{{.Database.Likes}}</span></div>
<div class="grid_item grid_stat grid_stat_head"><span>Attachments</span></div>
<div class="grid_item grid_stat grid_stat_head"><span>Polls</span></div>
<div class="grid_item grid_stat grid_stat_head"><span>???</span></div>
<div class="grid_item grid_stat"><span>{{.Database.Attachments}}</span></div>
<div class="grid_item grid_stat"><span>{{.Database.Polls}}</span></div>
<div class="grid_item grid_stat"><span>?</span></div>
<div class="grid_item grid_stat grid_stat_head"><span>Views</span></div>
<div class="grid_item grid_stat grid_stat_head"><span>Views Agents</span></div>
<div class="grid_item grid_stat grid_stat_head"><span>Views Forums</span></div>
<div class="grid_item grid_stat"><span>{{.Database.Views}}</span></div>
<div class="grid_item grid_stat"><span>{{.Database.ViewsAgents}}</span></div>
<div class="grid_item grid_stat"><span>{{.Database.ViewsForums}}</span></div>
<div class="grid_item grid_stat grid_stat_head"><span>Views Langs</span></div>
<div class="grid_item grid_stat grid_stat_head"><span>Views Referrers</span></div>
<div class="grid_item grid_stat grid_stat_head"><span>Views Systems</span></div>
<div class="grid_item grid_stat"><span>{{.Database.ViewsLangs}}</span></div>
<div class="grid_item grid_stat"><span>{{.Database.ViewsReferrers}}</span></div>
<div class="grid_item grid_stat"><span>{{.Database.ViewsSystems}}</span></div>
</div>
<div class="colstack_item colstack_head colstack_sub_head">
<div class="rowitem"><h2>Disk</h2></div>