mirror of
https://github.com/discourse/discourse.git
synced 2024-12-05 13:23:38 +08:00
29 lines
775 B
JavaScript
29 lines
775 B
JavaScript
import EmberObject from "@ember/object";
|
|
import { ajax } from "discourse/lib/ajax";
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
|
|
|
export default class AdminSearchLogsIndexRoute extends DiscourseRoute {
|
|
queryParams = {
|
|
period: { refreshModel: true },
|
|
searchType: { refreshModel: true },
|
|
};
|
|
|
|
async model(params) {
|
|
this._params = params;
|
|
const searchLogs = await ajax("/admin/logs/search_logs.json", {
|
|
data: { period: params.period, search_type: params.searchType },
|
|
});
|
|
|
|
return searchLogs.map((log) => EmberObject.create(log));
|
|
}
|
|
|
|
setupController(controller, model) {
|
|
const params = this._params;
|
|
controller.setProperties({
|
|
model,
|
|
period: params.period,
|
|
searchType: params.searchType,
|
|
});
|
|
}
|
|
}
|