Integrate MSS message depending on enabled and isReachable
Depending on whether MSS is active or not we want to render different success and error messages. Therefore a refactor of renderStatusMessage was done, so that all message texts are now handed over to the method. [MAILPOET-3909]
This commit is contained in:
@@ -4,11 +4,18 @@ import ReactStringReplace from 'react-string-replace';
|
|||||||
import CronStatus from './cron_status.jsx';
|
import CronStatus from './cron_status.jsx';
|
||||||
import QueueStatus from './queue_status.jsx';
|
import QueueStatus from './queue_status.jsx';
|
||||||
|
|
||||||
function renderStatusMessage(status, error, link, linkBeacon, additionalInfo) {
|
function renderStatusMessage(
|
||||||
|
status,
|
||||||
|
successMessage,
|
||||||
|
errorMessage,
|
||||||
|
link,
|
||||||
|
linkBeacon,
|
||||||
|
additionalInfo
|
||||||
|
) {
|
||||||
const noticeType = (status) ? 'success' : 'error';
|
const noticeType = (status) ? 'success' : 'error';
|
||||||
let noticeMessage = (status)
|
let noticeMessage = (status)
|
||||||
? MailPoet.I18n.t('systemStatusConnectionSuccessful')
|
? successMessage
|
||||||
: `${MailPoet.I18n.t('systemStatusConnectionUnsuccessful')} ${error}`;
|
: errorMessage;
|
||||||
|
|
||||||
if (link) {
|
if (link) {
|
||||||
noticeMessage = ReactStringReplace(
|
noticeMessage = ReactStringReplace(
|
||||||
@@ -31,7 +38,8 @@ function renderStatusMessage(status, error, link, linkBeacon, additionalInfo) {
|
|||||||
function renderCronSection(data) {
|
function renderCronSection(data) {
|
||||||
const status = data.cron.isReachable;
|
const status = data.cron.isReachable;
|
||||||
const url = data.cron.url;
|
const url = data.cron.url;
|
||||||
const error = MailPoet.I18n.t('systemStatusCronConnectionUnsuccessfulInfo');
|
const error = `${MailPoet.I18n.t('systemStatusConnectionUnsuccessful')} ${MailPoet.I18n.t('systemStatusCronConnectionUnsuccessfulInfo')}`;
|
||||||
|
const success = MailPoet.I18n.t('systemStatusConnectionSuccessful');
|
||||||
const additionalInfo = !status ? data.cron.pingResponse : null;
|
const additionalInfo = !status ? data.cron.pingResponse : null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -40,20 +48,32 @@ function renderCronSection(data) {
|
|||||||
<p>
|
<p>
|
||||||
<a className="mailpoet-text-link" href={url} target="_blank" rel="noopener noreferrer">{url}</a>
|
<a className="mailpoet-text-link" href={url} target="_blank" rel="noopener noreferrer">{url}</a>
|
||||||
</p>
|
</p>
|
||||||
{renderStatusMessage(status, error, 'https://kb.mailpoet.com/article/231-sending-does-not-work', '5a0257ac2c7d3a272c0d7ad6', additionalInfo)}
|
{renderStatusMessage(status, success, error, 'https://kb.mailpoet.com/article/231-sending-does-not-work', '5a0257ac2c7d3a272c0d7ad6', additionalInfo)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderMSSSection(data) {
|
function renderMSSSection(data) {
|
||||||
if (!data.mss.enabled) return undefined;
|
const errorMessage = data.mss.enabled
|
||||||
|
? `${MailPoet.I18n.t('systemStatusConnectionUnsuccessful')} ${MailPoet.I18n.t('systemStatusMSSConnectionUnsuccessfulInfo')}`
|
||||||
const status = data.mss.enabled.isReachable;
|
: MailPoet.I18n.t('systemStatusMSSConnectionCanNotConnect');
|
||||||
|
const successMessage = data.mss.enabled
|
||||||
|
? MailPoet.I18n.t('systemStatusConnectionSuccessful')
|
||||||
|
: MailPoet.I18n.t('systemStatusMSSConnectionCanConnect');
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h4>{MailPoet.I18n.t('systemStatusMSSTitle')}</h4>
|
<h4>{MailPoet.I18n.t('systemStatusMSSTitle')}</h4>
|
||||||
{renderStatusMessage(status, MailPoet.I18n.t('systemStatusMSSConnectionUnsuccessfulInfo'), false)}
|
{
|
||||||
|
|
||||||
|
renderStatusMessage(
|
||||||
|
data.mss.isReachable,
|
||||||
|
successMessage,
|
||||||
|
errorMessage,
|
||||||
|
'https://kb.mailpoet.com/article/319-known-errors-when-validating-a-mailpoet-key',
|
||||||
|
'5ef1da9d2c7d3a10cba966c5',
|
||||||
|
null
|
||||||
|
)
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user