mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-18 22:48:32 +08:00
Adds the frontend for the Reports section on the redesigned admin dashboard. Admins can choose which reports appear on their dashboard, reorder them, and add/remove cards via a "Manage reports" modal. A plugin API lets plugins ship their own report providers and custom card renderers — used by Data Explorer to surface DE queries alongside core reports. Follow-up to backend PR: https://github.com/discourse/discourse/pull/40017
27 lines
750 B
Ruby
Vendored
27 lines
750 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module AdminDashboard
|
|
module Reports
|
|
class BulkFetch
|
|
def self.call(items:, filters:, guardian:)
|
|
per_source =
|
|
AdminDashboard::Reports::Registry.dispatch_per_source(items) do |provider, group|
|
|
identifiers = group.map { |i| i[:identifier] }
|
|
provider.fetch_many(identifiers, guardian:, filters:)
|
|
end
|
|
|
|
results =
|
|
items.map do |item|
|
|
{
|
|
source: item[:source],
|
|
identifier: item[:identifier],
|
|
key: "#{item[:source]}:#{item[:identifier]}",
|
|
data: per_source.dig(item[:source], item[:identifier]),
|
|
}
|
|
end
|
|
|
|
{ items: results }
|
|
end
|
|
end
|
|
end
|
|
end
|