Ghost/ghost/admin/app/components/member-attribution/source-attribution-table.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

21 lines
627 B
JavaScript

import Component from '@glimmer/component';
import {inject as service} from '@ember/service';
export default class SourceAttributionTable extends Component {
@service membersUtils;
get sources() {
const availableSources = this.args.sources.filter(source => source.source);
const unavailableSources = this.args.sources.filter(sourceData => !sourceData.source).map((sourceData) => {
return {
...sourceData,
source: 'Unavailable'
};
});
return [
...availableSources,
...unavailableSources
];
}
}