discourse/app/assets/javascripts/admin/controllers/admin-reports.js.es6
2015-06-24 15:19:39 +02:00

30 lines
724 B
JavaScript

export default Ember.ObjectController.extend({
viewMode: 'table',
viewingTable: Em.computed.equal('viewMode', 'table'),
viewingBarChart: Em.computed.equal('viewMode', 'barChart'),
startDate: null,
endDate: null,
categoryId: null,
refreshing: false,
actions: {
refreshReport() {
this.set("refreshing", true);
Discourse.Report.find(
this.get("type"),
this.get("startDate"),
this.get("endDate"),
this.get("categoryId")
).then(m => this.set("model", m)
).finally(() => this.set("refreshing", false));
},
viewAsTable() {
this.set('viewMode', 'table');
},
viewAsBarChart() {
this.set('viewMode', 'barChart');
}
}
});