diff --git a/common/pages.go b/common/pages.go index 94261c59..782e55ac 100644 --- a/common/pages.go +++ b/common/pages.go @@ -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 { diff --git a/langs/english.json b/langs/english.json index 93d68596..ee98a84f 100644 --- a/langs/english.json +++ b/langs/english.json @@ -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", diff --git a/routes/panel/dashboard.go b/routes/panel/dashboard.go index edfc4ef4..1cbca906 100644 --- a/routes/panel/dashboard.go +++ b/routes/panel/dashboard.go @@ -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"*/) diff --git a/routes/panel/debug.go b/routes/panel/debug.go index a92dc207..08dfc2c0 100644 --- a/routes/panel/debug.go +++ b/routes/panel/debug.go @@ -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 { diff --git a/templates/panel_dashboard.html b/templates/panel_dashboard.html index c7f0990e..af4b5c24 100644 --- a/templates/panel_dashboard.html +++ b/templates/panel_dashboard.html @@ -3,7 +3,7 @@
{{range .}} -
+
{{if .Href}}{{.Body}}{{else}}{{.Body}}{{end}}
{{end}} diff --git a/templates/panel_debug.html b/templates/panel_debug.html index bd329125..2b2333f8 100644 --- a/templates/panel_debug.html +++ b/templates/panel_debug.html @@ -105,11 +105,38 @@
Profile Replies
Activity Stream
-
???
+
Likes
{{.Database.ProfileReplies}}
{{.Database.ActivityStream}}
+
{{.Database.Likes}}
+ + +
Attachments
+
Polls
+
???
+ +
{{.Database.Attachments}}
+
{{.Database.Polls}}
?
+ + +
Views
+
Views Agents
+
Views Forums
+ +
{{.Database.Views}}
+
{{.Database.ViewsAgents}}
+
{{.Database.ViewsForums}}
+ + +
Views Langs
+
Views Referrers
+
Views Systems
+ +
{{.Database.ViewsLangs}}
+
{{.Database.ViewsReferrers}}
+
{{.Database.ViewsSystems}}

Disk