Show rendering issue in listing status
[MAILPOET-4983]
This commit is contained in:
@@ -202,6 +202,15 @@ h1.title.mailpoet-newsletter-listing-heading {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.mailpoet-listing-status-corrupt {
|
||||||
|
color: $color-destructive;
|
||||||
|
padding-left: 0;
|
||||||
|
|
||||||
|
.mailpoet-listing-status-label {
|
||||||
|
padding-left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.mailpoet-listing-status-percentage {
|
.mailpoet-listing-status-percentage {
|
||||||
stroke-width: 2px;
|
stroke-width: 2px;
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@ import { addHours, subHours } from 'date-fns';
|
|||||||
import { MailPoet } from 'mailpoet';
|
import { MailPoet } from 'mailpoet';
|
||||||
import { NewsletterStatus } from '../newsletter_status';
|
import { NewsletterStatus } from '../newsletter_status';
|
||||||
import { Heading } from '../../typography/heading/heading';
|
import { Heading } from '../../typography/heading/heading';
|
||||||
|
import { NewsletterStatus as NewsletterStatusEnum } from '../../../newsletters/models';
|
||||||
|
|
||||||
MailPoet.I18n.add('notSentYet', 'Not sent yet!');
|
MailPoet.I18n.add('notSentYet', 'Not sent yet!');
|
||||||
MailPoet.I18n.add('sent', 'Sent');
|
MailPoet.I18n.add('sent', 'Sent');
|
||||||
@@ -57,7 +58,7 @@ export function NewsletterStatuses() {
|
|||||||
<div className="mailpoet-gap" />
|
<div className="mailpoet-gap" />
|
||||||
|
|
||||||
<Heading level={3}>Sent without queue</Heading>
|
<Heading level={3}>Sent without queue</Heading>
|
||||||
<NewsletterStatus status="sent" />
|
<NewsletterStatus status={NewsletterStatusEnum.Sent} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,7 @@ import classnames from 'classnames';
|
|||||||
import { addDays, differenceInMinutes, isFuture, isPast } from 'date-fns';
|
import { addDays, differenceInMinutes, isFuture, isPast } from 'date-fns';
|
||||||
import { t } from 'common/functions/t';
|
import { t } from 'common/functions/t';
|
||||||
import { Tooltip } from '../tooltip/tooltip';
|
import { Tooltip } from '../tooltip/tooltip';
|
||||||
|
import { NewsletterStatus as NewsletterStatusEnum } from '../../newsletters/models';
|
||||||
|
|
||||||
type CircularProgressProps = {
|
type CircularProgressProps = {
|
||||||
percentage: number;
|
percentage: number;
|
||||||
@@ -60,7 +61,7 @@ type NewsletterStatusProps = {
|
|||||||
processed?: number;
|
processed?: number;
|
||||||
total?: number;
|
total?: number;
|
||||||
isPaused?: boolean;
|
isPaused?: boolean;
|
||||||
status?: string;
|
status?: NewsletterStatusEnum;
|
||||||
};
|
};
|
||||||
|
|
||||||
function NewsletterStatus({
|
function NewsletterStatus({
|
||||||
@@ -70,10 +71,11 @@ function NewsletterStatus({
|
|||||||
isPaused,
|
isPaused,
|
||||||
status,
|
status,
|
||||||
}: NewsletterStatusProps) {
|
}: NewsletterStatusProps) {
|
||||||
|
const isCorrupt = status === 'corrupt';
|
||||||
const unknown = !scheduledFor && !processed && !total;
|
const unknown = !scheduledFor && !processed && !total;
|
||||||
const scheduled = scheduledFor && isFuture(scheduledFor);
|
const scheduled = scheduledFor && isFuture(scheduledFor);
|
||||||
const inProgress =
|
const inProgress =
|
||||||
(!scheduledFor || isPast(scheduledFor)) && processed < total;
|
(!scheduledFor || isPast(scheduledFor)) && processed < total && !isCorrupt;
|
||||||
const sent = (!scheduledFor || isPast(scheduledFor)) && processed >= total;
|
const sent = (!scheduledFor || isPast(scheduledFor)) && processed >= total;
|
||||||
const sentWithoutQueue = status === 'sent' && total === undefined;
|
const sentWithoutQueue = status === 'sent' && total === undefined;
|
||||||
let percentage = 0;
|
let percentage = 0;
|
||||||
@@ -134,6 +136,11 @@ function NewsletterStatus({
|
|||||||
if (isPaused && !sent && !sentWithoutQueue) {
|
if (isPaused && !sent && !sentWithoutQueue) {
|
||||||
label = t('paused');
|
label = t('paused');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isCorrupt) {
|
||||||
|
label = t('renderingProblem');
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={classnames({
|
className={classnames({
|
||||||
@@ -142,10 +149,11 @@ function NewsletterStatus({
|
|||||||
'mailpoet-listing-status-scheduled': scheduled,
|
'mailpoet-listing-status-scheduled': scheduled,
|
||||||
'mailpoet-listing-status-in-progress': inProgress,
|
'mailpoet-listing-status-in-progress': inProgress,
|
||||||
'mailpoet-listing-status-sent': sent || sentWithoutQueue,
|
'mailpoet-listing-status-sent': sent || sentWithoutQueue,
|
||||||
|
'mailpoet-listing-status-corrupt': isCorrupt,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
{scheduled && <ScheduledIcon />}
|
{scheduled && <ScheduledIcon />}
|
||||||
<CircularProgress percentage={percentage} />
|
{!isCorrupt && <CircularProgress percentage={percentage} />}
|
||||||
<div className="mailpoet-listing-status-label">{label}</div>
|
<div className="mailpoet-listing-status-label">{label}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@@ -189,6 +189,7 @@ jQuery('#adminmenu #toplevel_page_mailpoet-newsletters')
|
|||||||
|
|
||||||
'sent': __('Sent'),
|
'sent': __('Sent'),
|
||||||
'notSentYet': __('Not sent yet!'),
|
'notSentYet': __('Not sent yet!'),
|
||||||
|
'renderingProblem': __('There was a problem with rendering!', 'mailpoet'),
|
||||||
|
|
||||||
'allSendingPausedHeader': __('All sending is currently paused!'),
|
'allSendingPausedHeader': __('All sending is currently paused!'),
|
||||||
'allSendingPausedBody': __('Your [link]API key[/link] to send with MailPoet is invalid.'),
|
'allSendingPausedBody': __('Your [link]API key[/link] to send with MailPoet is invalid.'),
|
||||||
|
Reference in New Issue
Block a user