Ghost/ghost/admin/app/components/dashboard/charts/attribution.js
Rishabh e93f6071cd Handled null sources for attribution chart and table
refs https://github.com/TryGhost/Team/issues/1932

- removes null sources from attribution chart
- moves null sources count to bottom of attribution table
2022-09-22 21:04:46 +05:30

31 lines
827 B
JavaScript

import Component from '@glimmer/component';
import {action} from '@ember/object';
import {inject as service} from '@ember/service';
export default class Recents extends Component {
@service dashboardStats;
@action
loadData() {
this.dashboardStats.loadMemberAttributionStats();
}
get sources() {
return this.dashboardStats?.memberSourceAttributionCounts || [];
}
get chartSources() {
const counts = this.dashboardStats?.memberSourceAttributionCounts || [];
// filter null source from the list
return counts.filter(source => source.source);
}
get areMembersEnabled() {
return this.dashboardStats.siteStatus?.membersEnabled;
}
get areNewslettersEnabled() {
return this.dashboardStats.siteStatus?.newslettersEnabled;
}
}