FEATURE: export dashboard reports to csv file

This commit is contained in:
Neil Lalonde
2015-09-15 16:45:01 -04:00
parent b12ace5f9d
commit b4a724e80a
5 changed files with 40 additions and 9 deletions
@@ -1,3 +1,6 @@
import { exportEntity } from 'discourse/lib/export-csv';
import { outputExportResult } from 'discourse/lib/export-result';
export default Ember.Controller.extend({
viewMode: 'table',
viewingTable: Em.computed.equal('viewMode', 'table'),
@@ -30,6 +33,15 @@ export default Ember.Controller.extend({
viewAsBarChart() {
this.set('viewMode', 'barChart');
},
exportCsv() {
exportEntity('report', {
name: this.get("model.type"),
start_date: this.get('startDate'),
end_date: this.get('endDate'),
category_id: this.get('categoryId') == 'all' ? undefined : this.get('categoryId')
}).then(outputExportResult);
}
}
});