mirror of
https://github.com/discourse/discourse.git
synced 2025-09-06 10:50:21 +08:00
FEATURE: add graph support to admin reports
thanks to graph js, this runs latest beta cause we needed support for smarter X axis legend
This commit is contained in:
parent
46487f095e
commit
4bc860652b
6 changed files with 86 additions and 18 deletions
|
@ -4,9 +4,10 @@ import Report from 'admin/models/report';
|
|||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
export default Ember.Controller.extend({
|
||||
viewMode: 'table',
|
||||
queryParams: ["mode", "start-date", "end-date", "category-id", "group-id"],
|
||||
viewMode: 'graph',
|
||||
viewingTable: Em.computed.equal('viewMode', 'table'),
|
||||
viewingBarChart: Em.computed.equal('viewMode', 'barChart'),
|
||||
viewingGraph: Em.computed.equal('viewMode', 'graph'),
|
||||
startDate: null,
|
||||
endDate: null,
|
||||
categoryId: null,
|
||||
|
@ -35,6 +36,16 @@ export default Ember.Controller.extend({
|
|||
var q;
|
||||
this.set("refreshing", true);
|
||||
|
||||
this.setProperties({
|
||||
'start-date': this.get('startDate'),
|
||||
'end-date': this.get('endDate'),
|
||||
'category-id': this.get('categoryId'),
|
||||
});
|
||||
|
||||
if (this.get('groupId')){
|
||||
this.set('group-id', this.get('groupId'));
|
||||
}
|
||||
|
||||
q = Report.find(this.get("model.type"), this.get("startDate"), this.get("endDate"), this.get("categoryId"), this.get("groupId"));
|
||||
q.then(m => this.set("model", m)).finally(() => this.set("refreshing", false));
|
||||
},
|
||||
|
@ -43,8 +54,8 @@ export default Ember.Controller.extend({
|
|||
this.set('viewMode', 'table');
|
||||
},
|
||||
|
||||
viewAsBarChart() {
|
||||
this.set('viewMode', 'barChart');
|
||||
viewAsGraph() {
|
||||
this.set('viewMode', 'graph');
|
||||
},
|
||||
|
||||
exportCsv() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue