diff --git a/client/src/campaigns/List.js b/client/src/campaigns/List.js index 26e9a170..82a0329a 100644 --- a/client/src/campaigns/List.js +++ b/client/src/campaigns/List.js @@ -109,12 +109,10 @@ export default class List extends Component { link: `/campaigns/${data[0]}/status` }); - if (status === CampaignStatus.SENDING || status === CampaignStatus.PAUSED || status === CampaignStatus.FINISHED) { - actions.push({ - label: , - link: `/campaigns/${data[0]}/statistics` - }); - } + actions.push({ + label: , + link: `/campaigns/${data[0]}/statistics` + }); } if (perms.includes('edit')) { diff --git a/client/src/campaigns/Statistics.js b/client/src/campaigns/Statistics.js index 419db352..eea2a3ac 100644 --- a/client/src/campaigns/Statistics.js +++ b/client/src/campaigns/Statistics.js @@ -35,7 +35,6 @@ export default class Statistics extends Component { this.state = { entity: props.entity, - statisticsOverview: props.statisticsOverview }; this.refreshTimeoutHandler = ::this.periodicRefreshTask; @@ -43,8 +42,7 @@ export default class Statistics extends Component { } static propTypes = { - entity: PropTypes.object, - statisticsOverview: PropTypes.object + entity: PropTypes.object } @withAsyncErrorHandler @@ -54,12 +52,8 @@ export default class Statistics extends Component { resp = await axios.get(getUrl(`rest/campaigns-stats/${this.props.entity.id}`)); const entity = resp.data; - resp = await axios.get(getUrl(`rest/campaign-statistics/${this.props.entity.id}/overview`)); - const statisticsOverview = resp.data; - this.setState({ - entity, - statisticsOverview + entity }); } @@ -85,11 +79,10 @@ export default class Statistics extends Component { render() { const t = this.props.t; const entity = this.state.entity; - - const stats = this.state.statisticsOverview; + const total = entity.subscriptionsToSend === undefined ? undefined : entity.subscriptionsToSend + entity.delivered; const renderMetrics = (key, label, showZoomIn = true) => { - const val = stats[key] + const val = entity[key] return ( {val}{showZoomIn && } @@ -97,13 +90,13 @@ export default class Statistics extends Component { } const renderMetricsWithProgress = (key, label, progressBarClass, showZoomIn = true) => { - const val = stats[key] + const val = entity[key] - if (!stats.total) { + if (!total) { return renderMetrics(key, label); } - const rate = Math.round(val / stats.total * 100); + const rate = Math.round(val / total * 100); return ( @@ -112,9 +105,6 @@ export default class Statistics extends Component {
{val} ({rate}%)
diff --git a/client/src/campaigns/StatisticsOpened.js b/client/src/campaigns/StatisticsOpened.js index 18dbe356..6faf8e3b 100644 --- a/client/src/campaigns/StatisticsOpened.js +++ b/client/src/campaigns/StatisticsOpened.js @@ -60,7 +60,7 @@ export default class StatisticsOpened extends Component { async refreshEntity() { let resp; - resp = await axios.get(getUrl(`rest/campaigns-stats/${this.props.entity.id}`)); + resp = await axios.get(getUrl(`rest/campaigns-settings/${this.props.entity.id}`)); const entity = resp.data; resp = await axios.get(getUrl(`rest/campaign-statistics/${this.props.entity.id}/opened`)); @@ -132,7 +132,7 @@ export default class StatisticsOpened extends Component {

{t('Distribution by device type')}

{t('Loading chart')}} data={[ @@ -144,7 +144,7 @@ export default class StatisticsOpened extends Component { left: "25%", top: 15, width: "100%", - height: 270 + height: 350 }, tooltip: { showColorCode: true @@ -169,7 +169,7 @@ export default class StatisticsOpened extends Component {
{t('Loading chart')}
} data={[ @@ -181,7 +181,7 @@ export default class StatisticsOpened extends Component { left: "25%", top: 15, width: "100%", - height: 270 + height: 350 }, tooltip: { showColorCode: true @@ -199,7 +199,7 @@ export default class StatisticsOpened extends Component {
{yesNoDialog} @@ -316,7 +316,7 @@ class SendControls extends Component { ); } else if (entity.status === CampaignStatus.FINISHED) { - const subscrInfo = entity.subscriptionsTotal === undefined ? '' : ` (${entity.subscriptionsToSend} ${t('subscribers-1')})`; + const subscrInfo = entity.subscriptionsToSend === undefined ? '' : ` (${entity.subscriptionsToSend} ${t('subscribers-1')})`; return (
{yesNoDialog} @@ -479,7 +479,7 @@ export default class Status extends Component { {t('campaignStatus')} {entity.name} - {entity.subscriptionsTotal === undefined ? t('computing') : entity.subscriptionsTotal} + {entity.delivered} {this.campaignStatusLabels[entity.status]} {sendSettings} diff --git a/client/src/campaigns/root.js b/client/src/campaigns/root.js index b266182f..2e8b8543 100644 --- a/client/src/campaigns/root.js +++ b/client/src/campaigns/root.js @@ -62,12 +62,9 @@ function getMenus(t) { }, statistics: { title: t('statistics'), - resolve: { - statisticsOverview: params => `rest/campaign-statistics/${params.campaignId}/overview` - }, link: params => `/campaigns/${params.campaignId}/statistics`, - visible: resolved => resolved.campaign.permissions.includes('viewStats') && (resolved.campaign.status === CampaignStatus.SENDING || resolved.campaign.status === CampaignStatus.PAUSED || resolved.campaign.status === CampaignStatus.FINISHED), - panelRender: props => , + visible: resolved => resolved.campaign.permissions.includes('viewStats'), + panelRender: props => , children: { delivered: { title: t('Delivered'), diff --git a/client/src/lib/untrusted.js b/client/src/lib/untrusted.js index 953efd4b..5a1a0552 100644 --- a/client/src/lib/untrusted.js +++ b/client/src/lib/untrusted.js @@ -201,7 +201,7 @@ export class UntrustedContentRoot extends Component { this.clientHeight = newHeight; this.sendMessage('clientHeight', newHeight); } - //this.periodicTimeoutId = setTimeout(this.periodicTimeoutHandler, 250); + this.periodicTimeoutId = setTimeout(this.periodicTimeoutHandler, 250); } diff --git a/client/src/lists/CUD.js b/client/src/lists/CUD.js index 99a99289..8f68ea8c 100644 --- a/client/src/lists/CUD.js +++ b/client/src/lists/CUD.js @@ -216,7 +216,7 @@ export default class CUD extends Component {