mirror of
https://github.com/discourse/discourse.git
synced 2024-11-28 01:54:04 +08:00
2b2a506a7b
This commit is an attempt to limit cases where the dashboard will generate a full exception page and also make it easier to track the error.
28 lines
417 B
Ruby
28 lines
417 B
Ruby
class AdminDashboardNextData
|
|
include StatsCacheable
|
|
|
|
def initialize(opts = {})
|
|
@opts = opts
|
|
end
|
|
|
|
def self.fetch_stats
|
|
new.as_json
|
|
end
|
|
|
|
def get_json
|
|
{}
|
|
end
|
|
|
|
def as_json(_options = nil)
|
|
@json ||= get_json
|
|
end
|
|
|
|
def self.reports(source)
|
|
source.map { |type| Report.find(type).as_json }
|
|
end
|
|
|
|
def self.stats_cache_key
|
|
"dashboard-next-data-#{Report::SCHEMA_VERSION}"
|
|
end
|
|
end
|