2022-03-21 19:58:39 +03:00
|
|
|
import Component from '@glimmer/component';
|
2022-03-23 11:51:53 +03:00
|
|
|
import {action} from '@ember/object';
|
|
|
|
import {inject as service} from '@ember/service';
|
2022-03-21 19:58:39 +03:00
|
|
|
|
2022-03-23 11:51:53 +03:00
|
|
|
const DAYS_OPTIONS = [{
|
|
|
|
name: '7 days',
|
|
|
|
value: 7
|
|
|
|
}, {
|
|
|
|
name: '30 days',
|
|
|
|
value: 30
|
|
|
|
}, {
|
|
|
|
name: '90 days',
|
|
|
|
value: 90
|
|
|
|
}, {
|
|
|
|
name: 'All time',
|
2022-03-31 15:20:25 +03:00
|
|
|
value: 'all'
|
2022-03-23 11:51:53 +03:00
|
|
|
}];
|
|
|
|
|
2022-03-21 19:58:39 +03:00
|
|
|
export default class DashboardDashboardV5Component extends Component {
|
2022-03-23 11:51:53 +03:00
|
|
|
@service dashboardStats;
|
|
|
|
|
|
|
|
daysOptions = DAYS_OPTIONS;
|
|
|
|
|
2022-03-24 14:04:18 +03:00
|
|
|
get days() {
|
|
|
|
return this.dashboardStats.chartDays;
|
|
|
|
}
|
|
|
|
|
|
|
|
set days(days) {
|
|
|
|
this.dashboardStats.chartDays = days;
|
|
|
|
}
|
|
|
|
|
2022-03-24 11:01:30 +03:00
|
|
|
@action
|
|
|
|
onInsert() {
|
2022-03-24 14:04:18 +03:00
|
|
|
this.dashboardStats.loadSiteStatus();
|
2022-03-23 18:38:16 +03:00
|
|
|
}
|
|
|
|
|
2022-03-23 11:51:53 +03:00
|
|
|
get selectedDaysOption() {
|
|
|
|
return this.daysOptions.find(d => d.value === this.days);
|
|
|
|
}
|
2022-03-21 21:02:57 +03:00
|
|
|
|
2022-03-24 14:04:18 +03:00
|
|
|
get isLoading() {
|
|
|
|
return this.dashboardStats.siteStatus === null;
|
|
|
|
}
|
|
|
|
|
2022-03-21 21:02:57 +03:00
|
|
|
get hasPaidTiers() {
|
2022-03-24 14:04:18 +03:00
|
|
|
return this.dashboardStats.siteStatus?.hasPaidTiers;
|
2022-03-21 21:02:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
get isStripeEnabled() {
|
2022-03-24 14:04:18 +03:00
|
|
|
return this.dashboardStats.siteStatus?.stripeEnabled;
|
2022-03-21 21:02:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
get areNewslettersEnabled() {
|
2022-03-24 14:04:18 +03:00
|
|
|
return this.dashboardStats.siteStatus?.newslettersEnabled;
|
2022-03-21 21:02:57 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
get areMembersEnabled() {
|
2022-03-24 14:04:18 +03:00
|
|
|
return this.dashboardStats.siteStatus?.membersEnabled;
|
2022-03-21 21:02:57 +03:00
|
|
|
}
|
2022-03-23 11:51:53 +03:00
|
|
|
|
|
|
|
@action
|
|
|
|
onDaysChange(selected) {
|
|
|
|
this.days = selected.value;
|
|
|
|
}
|
2022-03-21 19:58:39 +03:00
|
|
|
}
|