2018-05-16 02:12:03 +08:00
|
|
|
import { ajax } from "discourse/lib/ajax";
|
2018-05-03 21:41:41 +08:00
|
|
|
import AsyncReport from "admin/mixins/async-report";
|
2018-04-16 16:42:06 +08:00
|
|
|
|
2018-05-03 21:41:41 +08:00
|
|
|
export default Ember.Component.extend(AsyncReport, {
|
2018-05-22 22:47:23 +08:00
|
|
|
classNames: ["dashboard-inline-table"],
|
2018-05-15 13:08:23 +08:00
|
|
|
|
2018-05-03 21:41:41 +08:00
|
|
|
fetchReport() {
|
2018-05-16 02:12:03 +08:00
|
|
|
this._super();
|
2018-04-16 16:42:06 +08:00
|
|
|
|
2018-05-22 22:47:23 +08:00
|
|
|
let payload = this.buildPayload(["total", "prev30Days"]);
|
2018-05-15 13:08:23 +08:00
|
|
|
|
2018-05-16 02:12:03 +08:00
|
|
|
return Ember.RSVP.Promise.all(this.get("dataSources").map(dataSource => {
|
|
|
|
return ajax(dataSource, payload)
|
|
|
|
.then(response => {
|
2018-05-16 22:45:21 +08:00
|
|
|
this.get("reports").pushObject(this.loadReport(response.report));
|
2018-05-16 02:12:03 +08:00
|
|
|
});
|
|
|
|
}));
|
2018-04-16 16:42:06 +08:00
|
|
|
}
|
|
|
|
});
|