Admin controls to select a date range for reports

This commit is contained in:
Robin Ward
2014-11-05 14:46:27 -05:00
parent a5616146eb
commit 2d9187cd9d
6 changed files with 59 additions and 21 deletions

View File

@ -2,17 +2,27 @@ export default Ember.ObjectController.extend({
viewMode: 'table',
viewingTable: Em.computed.equal('viewMode', 'table'),
viewingBarChart: Em.computed.equal('viewMode', 'barChart'),
startDate: null,
endDate: null,
refreshing: false,
actions: {
// Changes the current view mode to 'table'
refreshReport: function() {
var self = this;
this.set('refreshing', true);
Discourse.Report.find(this.get('type'), this.get('startDate'), this.get('endDate')).then(function(r) {
self.set('model', r);
}).finally(function() {
self.set('refreshing', false);
});
},
viewAsTable: function() {
this.set('viewMode', 'table');
},
// Changes the current view mode to 'barChart'
viewAsBarChart: function() {
this.set('viewMode', 'barChart');
}
}
});