discourse/app/assets/javascripts/admin/routes/admin-reports.js.es6

36 lines
770 B
Plaintext
Raw Normal View History

2018-06-15 23:03:24 +08:00
import Report from "admin/models/report";
export default Discourse.Route.extend({
2018-06-15 23:03:24 +08:00
queryParams: {
mode: {},
start_date: {},
end_date: {},
category_id: {},
group_id: {}
},
2017-07-06 04:47:01 +08:00
model(params) {
2018-06-15 23:03:24 +08:00
return Report.find(
params.type,
params["start_date"],
params["end_date"],
params["category_id"],
params["group_id"]
);
},
setupController: function(controller, model) {
controller.setProperties({
model: model,
2018-06-15 23:03:24 +08:00
categoryId: model.get("category_id") || "all",
groupId: model.get("group_id"),
startDate: moment(model.get("start_date"))
.utc()
.format("YYYY-MM-DD"),
endDate: moment(model.get("end_date"))
.utc()
.format("YYYY-MM-DD")
});
}
});