2021-02-04 20:36:29 +03:00
|
|
|
import Controller from '@ember/controller';
|
|
|
|
import {inject as service} from '@ember/service';
|
2021-02-18 17:17:10 +03:00
|
|
|
import {tracked} from '@glimmer/tracking';
|
2021-02-04 20:36:29 +03:00
|
|
|
|
|
|
|
export default class DashboardController extends Controller {
|
2021-02-04 21:35:19 +03:00
|
|
|
@service feature;
|
2021-02-04 20:36:29 +03:00
|
|
|
@service session;
|
2021-02-18 17:17:10 +03:00
|
|
|
@service membersStats;
|
|
|
|
|
|
|
|
@tracked
|
|
|
|
events = {
|
|
|
|
data: null,
|
|
|
|
error: null,
|
|
|
|
loading: false
|
|
|
|
};
|
2021-02-18 20:13:51 +03:00
|
|
|
@tracked
|
|
|
|
mrrStats = {
|
|
|
|
data: null,
|
|
|
|
error: null,
|
|
|
|
loading: false
|
|
|
|
};
|
2021-02-18 17:17:10 +03:00
|
|
|
|
|
|
|
constructor(...args) {
|
|
|
|
super(...args);
|
|
|
|
this.loadEvents();
|
2021-02-18 20:13:51 +03:00
|
|
|
this.loadCharts();
|
|
|
|
}
|
|
|
|
|
|
|
|
loadCharts() {
|
|
|
|
this.membersStats.fetchMRR().then((stats) => {
|
|
|
|
this.mrrStats.data = stats;
|
|
|
|
this.events.loading = false;
|
|
|
|
}, (error) => {
|
|
|
|
this.mrrStats.error = error;
|
|
|
|
this.events.loading = false;
|
|
|
|
});
|
2021-02-18 17:17:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
loadEvents() {
|
|
|
|
this.events.loading = true;
|
|
|
|
this.membersStats.fetchTimeline().then(({events}) => {
|
|
|
|
this.events.data = events;
|
|
|
|
this.events.loading = false;
|
|
|
|
}, (error) => {
|
|
|
|
this.events.error = error;
|
|
|
|
this.events.loading = false;
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|