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);
}
}
});
@@ -5,6 +5,7 @@
{{i18n 'admin.dashboard.reports.end_date'}} {{input type="date" value=endDate}}
{{combo-box valueAttribute="value" content=categoryOptions value=categoryId}}
{{d-button action="refreshReport" class="btn-primary" label="admin.dashboard.reports.refresh_report" icon="refresh"}}
{{d-button action="exportCsv" label="admin.export_csv.button_text"}}
</div>
<div class='view-options'>