0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Added basic member counts chart implementation for dashboard 5

refs https://github.com/TryGhost/Team/issues/1443

A real API endpoint is now used to power the member counts chart. But it sill requires some optimizations.
This commit is contained in:
Simon Backx 2022-03-28 10:47:09 +02:00
parent 16d0629de3
commit cc478dcb53

View file

@ -64,6 +64,8 @@ import {tracked} from '@glimmer/tracking';
export default class DashboardStatsService extends Service {
@service dashboardMocks;
@service store;
@service ajax;
@service ghostPaths;
/**
* @type {?SiteStatus} Contains information on what graphs need to be shown
@ -214,12 +216,15 @@ export default class DashboardStatsService extends Service {
// Note: that this shouldn't happen
return null;
}
this.memberCountStats = this.fillMissingDates(this.dashboardMocks.memberCountStats.slice(-this.chartDays), {paid: 0, free: 0, comped: 0}, this.chartDays);
this.memberCountStats = this.fillMissingDates(this.dashboardMocks.memberCountStats, {paid: 0, free: 0, comped: 0}, this.chartDays);
return;
}
// Normal implementation
// @todo
// @todo: we need to reuse the result of the call when we reload, because the endpoint returns all available days
// at the moment. We can reuse the result to show 7 days, 30 days, ...
let statsUrl = this.ghostPaths.url.api('members/stats/count');
let stats = yield this.ajax.request(statsUrl);
this.memberCountStats = this.fillMissingDates(stats.data, {paid: 0, free: 0, comped: 0}, this.chartDays);
}
loadMrrStats() {