discourse/app/controllers/admin/dashboard_next_controller.rb
Joffrey JAFFEUX 1a78e12f4e
FEATURE: part 2 of dashboard improvements
- moderation tab
- sorting/pagination
- improved third party reports support
- trending charts
- better perf
- many fixes
- refactoring
- new reports

Co-Authored-By: Simon Cossar <scossar@users.noreply.github.com>
2018-07-19 14:33:11 -04:00

37 lines
779 B
Ruby

require 'disk_space'
class Admin::DashboardNextController < Admin::AdminController
def index
data = AdminDashboardNextIndexData.fetch_cached_stats
if SiteSetting.version_checks?
data.merge!(version_check: DiscourseUpdates.check_version.as_json)
end
render json: data
end
def moderation
render json: AdminDashboardNextModerationData.fetch_cached_stats
end
def general
data = AdminDashboardNextGeneralData.fetch_cached_stats
if SiteSetting.enable_backups
data[:last_backup_taken_at] = last_backup_taken_at
data[:disk_space] = DiskSpace.cached_stats
end
render json: data
end
private
def last_backup_taken_at
if last_backup = Backup.all.last
File.ctime(last_backup.path).utc
end
end
end