mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
Add stats to the admin dashboard
This commit is contained in:
@@ -11,6 +11,9 @@ Discourse.AdminDashboardRoute = Discourse.Route.extend({
|
||||
if( !c.get('versionCheckedAt') || Date.create('12 hours ago') > c.get('versionCheckedAt') ) {
|
||||
this.checkVersion(c);
|
||||
}
|
||||
if( !c.get('reportsCheckedAt') || Date.create('1 hour ago') > c.get('reportsCheckedAt') ) {
|
||||
this.fetchReports(c);
|
||||
}
|
||||
},
|
||||
|
||||
renderTemplate: function() {
|
||||
@@ -19,12 +22,20 @@ Discourse.AdminDashboardRoute = Discourse.Route.extend({
|
||||
|
||||
checkVersion: function(c) {
|
||||
if( Discourse.SiteSettings.version_checks ) {
|
||||
c.set('versionCheckedAt', new Date());
|
||||
Discourse.VersionCheck.find().then(function(vc) {
|
||||
c.set('versionCheck', vc);
|
||||
c.set('versionCheckedAt', new Date());
|
||||
c.set('loading', false);
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
fetchReports: function(c) {
|
||||
// TODO: use one request to get all reports, or maybe one request for all dashboard data including version check.
|
||||
c.set('reportsCheckedAt', new Date());
|
||||
['visits', 'signups', 'topics', 'posts'].each(function(reportType){
|
||||
c.set(reportType, Discourse.Report.find(reportType));
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user