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