Add cron ping error response to status notice

[MAILPOET-2290]
This commit is contained in:
Rostislav Wolny
2019-08-21 13:43:06 +02:00
committed by M. Shull
parent 89ed90dddb
commit 23f785bf62
2 changed files with 7 additions and 3 deletions

View File

@ -5,7 +5,7 @@ import CronStatus from './cron_status.jsx';
import QueueStatus from './queue_status.jsx';
import Tabs from './tabs.jsx';
function renderStatusMessage(status, error, link) {
function renderStatusMessage(status, error, link, additionalInfo) {
const noticeType = (status) ? 'success' : 'error';
let noticeMessage = (status)
? MailPoet.I18n.t('systemStatusConnectionSuccessful')
@ -16,7 +16,7 @@ function renderStatusMessage(status, error, link) {
noticeMessage,
/\[link\](.*?)\[\/link\]/g,
(match) => (
<a href={`${link}`} key="kb-link">{ match }</a>
<a href={`${link}`} key="kb-link">{match}</a>
)
);
}
@ -24,6 +24,7 @@ function renderStatusMessage(status, error, link) {
return (
<div className={`mailpoet_notice notice inline notice-${noticeType}`} style={{ marginTop: '1em' }}>
<p>{noticeMessage}</p>
{additionalInfo ? (<p><i>{additionalInfo}</i></p>) : null}
</div>
);
}
@ -31,6 +32,8 @@ function renderStatusMessage(status, error, link) {
function renderCronSection(data) {
const status = data.cron.isReachable;
const url = data.cron.url;
const error = MailPoet.I18n.t('systemStatusCronConnectionUnsuccessfulInfo');
const additionalInfo = !status ? data.cron.pingResponse : null;
return (
<div>
@ -38,7 +41,7 @@ function renderCronSection(data) {
<p>
<a href={url} target="_blank" rel="noopener noreferrer">{url}</a>
</p>
{renderStatusMessage(status, MailPoet.I18n.t('systemStatusCronConnectionUnsuccessfulInfo'), 'https://kb.mailpoet.com/article/231-sending-does-not-work')}
{renderStatusMessage(status, error, 'https://kb.mailpoet.com/article/231-sending-does-not-work', additionalInfo)}
</div>
);
}

View File

@ -32,6 +32,7 @@ class Help {
'cron' => [
'url' => CronHelper::getCronUrl(CronDaemon::ACTION_PING),
'isReachable' => CronHelper::validatePingResponse($cron_ping_response),
'pingResponse' => $cron_ping_response,
],
'mss' => [
'enabled' => (Bridge::isMPSendingServiceEnabled()) ?