Keegan George 879faa82b3
DEV: Add value transformer for admin reports show query params (#31597)
## 🔍 Overview
This update adds a new value transformer to the `queryParams` property
on the `AdminReportsShowController`. This is necessary so that plugins
can add additional `queryParams` to the route and have it reflected when
the route is transitioned.
2025-03-04 13:33:08 +11:00

37 lines
907 B
JavaScript

import Controller from "@ember/controller";
import discourseComputed from "discourse/lib/decorators";
import { applyValueTransformer } from "discourse/lib/transformer";
export default class AdminReportsShowController extends Controller {
queryParams = applyValueTransformer("admin-reports-show-query-params", [
"start_date",
"end_date",
"filters",
"chart_grouping",
"mode",
]);
start_date = null;
end_date = null;
filters = null;
chart_grouping = null;
@discourseComputed("model.type")
reportOptions(type) {
let options = { table: { perPage: 50, limit: 50 } };
if (type === "top_referred_topics") {
options.table.limit = 10;
}
if (type === "site_traffic") {
options.stackedChart = {
hiddenLabels: ["page_view_other", "page_view_crawler"],
};
}
options.chartGrouping = this.chart_grouping;
return options;
}
}