mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-26 12:21:36 +03:00
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
This commit is contained in:
parent
45a301277d
commit
e93f6071cd
@ -10,7 +10,7 @@
|
||||
|
||||
<div style="border-left: 1px solid #eceef0; padding-left: 48px;display: flex;justify-content: center;align-items: center;">
|
||||
<div style="max-width: 200px;">
|
||||
<MemberAttribution::SourceAttributionChart @sources={{this.sources}} />
|
||||
<MemberAttribution::SourceAttributionChart @sources={{this.chartSources}} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -14,6 +14,12 @@ export default class Recents extends Component {
|
||||
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;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="gh-dashboard-list-body">
|
||||
{{#each @sources as |sourceData|}}
|
||||
{{#each this.sources as |sourceData|}}
|
||||
<div class="gh-dashboard-list-item">
|
||||
<div class="gh-dashboard-list-item-sub">
|
||||
<span class="gh-dashboard-list-text">{{sourceData.source}}</span>
|
||||
|
@ -3,4 +3,18 @@ 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
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user