FEATURE: export dashboard reports to csv file
This commit is contained in:
@@ -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'>
|
||||
|
||||
Reference in New Issue
Block a user