mirror of
https://github.com/discourse/discourse.git
synced 2025-05-26 11:32:11 +08:00
EXPERIMENTAL: new dashboard UI
This is the first iteration of an effort towards making a very good dashboard. Until we feel confident this is good, this dashboard will only be accessible through /admin/dashboard_next
This commit is contained in:
43
app/assets/javascripts/admin/components/mini-table.js.es6
Normal file
43
app/assets/javascripts/admin/components/mini-table.js.es6
Normal file
@ -0,0 +1,43 @@
|
||||
import { ajax } from 'discourse/lib/ajax';
|
||||
import computed from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
export default Ember.Component.extend({
|
||||
classNames: ["mini-table"],
|
||||
|
||||
total: null,
|
||||
labels: null,
|
||||
title: null,
|
||||
chartData: null,
|
||||
isLoading: false,
|
||||
help: null,
|
||||
helpPage: null,
|
||||
|
||||
didInsertElement() {
|
||||
this._super();
|
||||
|
||||
this.fetchReport.apply(this);
|
||||
},
|
||||
|
||||
@computed("dataSourceName")
|
||||
dataSource(dataSourceName) {
|
||||
return `/admin/reports/${dataSourceName}`;
|
||||
},
|
||||
|
||||
fetchReport() {
|
||||
this.set("isLoading", true);
|
||||
|
||||
ajax(this.get("dataSource")).then((response) => {
|
||||
const report = response.report;
|
||||
|
||||
this.setProperties({
|
||||
labels: report.data.map(r => r.x),
|
||||
dataset: report.data.map(r => r.y),
|
||||
total: report.total,
|
||||
title: report.title,
|
||||
chartData: report.data
|
||||
});
|
||||
}).finally(() => {
|
||||
this.set("isLoading", false);
|
||||
})
|
||||
}
|
||||
});
|
Reference in New Issue
Block a user