Merge pull request #1488 from mailpoet/help-status-fixes
Help Page System Status JS fixes
This commit is contained in:
@ -3,7 +3,7 @@ import React from 'react';
|
||||
const KeyValueTable = props => (
|
||||
<table className={'widefat fixed'} style={{ maxWidth: props.max_width }}>
|
||||
<tbody>
|
||||
{props.children.map(row => (
|
||||
{props.rows.map(row => (
|
||||
<tr key={`row_${row.key}`}>
|
||||
<td className={'row-title'}>{ row.key }</td><td>{ row.value }</td>
|
||||
</tr>
|
||||
@ -14,7 +14,7 @@ const KeyValueTable = props => (
|
||||
|
||||
KeyValueTable.propTypes = {
|
||||
max_width: React.PropTypes.string,
|
||||
children: React.PropTypes.arrayOf(React.PropTypes.shape({
|
||||
rows: React.PropTypes.arrayOf(React.PropTypes.shape({
|
||||
key: React.PropTypes.string.isRequired,
|
||||
value: React.PropTypes.oneOfType([
|
||||
React.PropTypes.string,
|
||||
|
@ -12,32 +12,35 @@ const CronStatus = (props) => {
|
||||
return (
|
||||
<div>
|
||||
<h2>{MailPoet.I18n.t('systemStatusCronStatusTitle')}</h2>
|
||||
<KeyValueTable max_width={'400px'}>{[
|
||||
{
|
||||
key: MailPoet.I18n.t('accessible'),
|
||||
value: <PrintBoolean>{status.accessible}</PrintBoolean>,
|
||||
},
|
||||
{
|
||||
key: MailPoet.I18n.t('status'),
|
||||
value: activeStatusMapping[status.status] ? activeStatusMapping[status.status] : MailPoet.I18n.t('unknown'),
|
||||
},
|
||||
{
|
||||
key: MailPoet.I18n.t('lastUpdated'),
|
||||
value: status.updated_at ? MailPoet.Date.full(status.updated_at * 1000) : MailPoet.I18n.t('unknown'),
|
||||
},
|
||||
{
|
||||
key: MailPoet.I18n.t('lastRunStarted'),
|
||||
value: status.run_accessed_at ? MailPoet.Date.full(status.run_started_at * 1000) : MailPoet.I18n.t('unknown'),
|
||||
},
|
||||
{
|
||||
key: MailPoet.I18n.t('lastRunCompleted'),
|
||||
value: status.run_completed_at ? MailPoet.Date.full(status.run_completed_at * 1000) : MailPoet.I18n.t('unknown'),
|
||||
},
|
||||
{
|
||||
key: MailPoet.I18n.t('lastSeenError'),
|
||||
value: status.last_error || MailPoet.I18n.t('none'),
|
||||
}]}
|
||||
</KeyValueTable>
|
||||
<KeyValueTable
|
||||
max_width={'400px'}
|
||||
rows={[
|
||||
{
|
||||
key: MailPoet.I18n.t('accessible'),
|
||||
value: <PrintBoolean>{status.accessible}</PrintBoolean>,
|
||||
},
|
||||
{
|
||||
key: MailPoet.I18n.t('status'),
|
||||
value: activeStatusMapping[status.status] ? activeStatusMapping[status.status] : MailPoet.I18n.t('unknown'),
|
||||
},
|
||||
{
|
||||
key: MailPoet.I18n.t('lastUpdated'),
|
||||
value: status.updated_at ? MailPoet.Date.full(status.updated_at * 1000) : MailPoet.I18n.t('unknown'),
|
||||
},
|
||||
{
|
||||
key: MailPoet.I18n.t('lastRunStarted'),
|
||||
value: status.run_accessed_at ? MailPoet.Date.full(status.run_started_at * 1000) : MailPoet.I18n.t('unknown'),
|
||||
},
|
||||
{
|
||||
key: MailPoet.I18n.t('lastRunCompleted'),
|
||||
value: status.run_completed_at ? MailPoet.Date.full(status.run_completed_at * 1000) : MailPoet.I18n.t('unknown'),
|
||||
},
|
||||
{
|
||||
key: MailPoet.I18n.t('lastSeenError'),
|
||||
value: status.last_error || MailPoet.I18n.t('none'),
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
@ -9,40 +9,42 @@ const QueueStatus = (props) => {
|
||||
return (
|
||||
<div>
|
||||
<h2>{MailPoet.I18n.t('systemStatusQueueTitle')}</h2>
|
||||
<KeyValueTable max_width={'400px'}>{
|
||||
[{
|
||||
key: MailPoet.I18n.t('status'),
|
||||
value: status.status === 'paused' ? MailPoet.I18n.t('paused') : MailPoet.I18n.t('running'),
|
||||
}, {
|
||||
key: MailPoet.I18n.t('startedAt'),
|
||||
value: status.started ? MailPoet.Date.full(status.started * 1000) : MailPoet.I18n.t('unknown'),
|
||||
}, {
|
||||
key: MailPoet.I18n.t('sentEmails'),
|
||||
value: status.sent || 0,
|
||||
}, {
|
||||
key: MailPoet.I18n.t('retryAttempt'),
|
||||
value: status.retry_attempt || MailPoet.I18n.t('none'),
|
||||
}, {
|
||||
key: MailPoet.I18n.t('retryAt'),
|
||||
value: status.retry_at ? MailPoet.Date.full(status.retry_at * 1000) : MailPoet.I18n.t('none'),
|
||||
}, {
|
||||
key: MailPoet.I18n.t('error'),
|
||||
value: status.error || MailPoet.I18n.t('none'),
|
||||
}, {
|
||||
key: MailPoet.I18n.t('totalCompletedTasks'),
|
||||
value: status.tasksStatusCounts.completed,
|
||||
}, {
|
||||
key: MailPoet.I18n.t('totalRunningTasks'),
|
||||
value: status.tasksStatusCounts.running,
|
||||
}, {
|
||||
key: MailPoet.I18n.t('totalPausedTasks'),
|
||||
value: status.tasksStatusCounts.paused,
|
||||
}, {
|
||||
key: MailPoet.I18n.t('totalScheduledTasks'),
|
||||
value: status.tasksStatusCounts.scheduled,
|
||||
}]}
|
||||
</KeyValueTable>
|
||||
|
||||
<KeyValueTable
|
||||
max_width={'400px'}
|
||||
rows={[
|
||||
{
|
||||
key: MailPoet.I18n.t('status'),
|
||||
value: status.status === 'paused' ? MailPoet.I18n.t('paused') : MailPoet.I18n.t('running'),
|
||||
}, {
|
||||
key: MailPoet.I18n.t('startedAt'),
|
||||
value: status.started ? MailPoet.Date.full(status.started * 1000) : MailPoet.I18n.t('unknown'),
|
||||
}, {
|
||||
key: MailPoet.I18n.t('sentEmails'),
|
||||
value: status.sent || 0,
|
||||
}, {
|
||||
key: MailPoet.I18n.t('retryAttempt'),
|
||||
value: status.retry_attempt || MailPoet.I18n.t('none'),
|
||||
}, {
|
||||
key: MailPoet.I18n.t('retryAt'),
|
||||
value: status.retry_at ? MailPoet.Date.full(status.retry_at * 1000) : MailPoet.I18n.t('none'),
|
||||
}, {
|
||||
key: MailPoet.I18n.t('error'),
|
||||
value: status.error ? status.error.error_message : MailPoet.I18n.t('none'),
|
||||
}, {
|
||||
key: MailPoet.I18n.t('totalCompletedTasks'),
|
||||
value: status.tasksStatusCounts.completed,
|
||||
}, {
|
||||
key: MailPoet.I18n.t('totalRunningTasks'),
|
||||
value: status.tasksStatusCounts.running,
|
||||
}, {
|
||||
key: MailPoet.I18n.t('totalPausedTasks'),
|
||||
value: status.tasksStatusCounts.paused,
|
||||
}, {
|
||||
key: MailPoet.I18n.t('totalScheduledTasks'),
|
||||
value: status.tasksStatusCounts.scheduled,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
<h4>{MailPoet.I18n.t('scheduledTasks')}</h4>
|
||||
<TasksList show_scheduled_at tasks={status.latestTasks.filter(task => (task.status === 'scheduled'))} />
|
||||
|
||||
@ -62,6 +64,10 @@ QueueStatus.propTypes = {
|
||||
sent: React.PropTypes.number,
|
||||
retry_attempt: React.PropTypes.number,
|
||||
retry_at: React.PropTypes.number,
|
||||
error: React.PropTypes.shape({
|
||||
operation: React.PropTypes.string,
|
||||
error_message: React.PropTypes.string,
|
||||
}),
|
||||
tasksStatusCounts: React.PropTypes.shape({
|
||||
completed: React.PropTypes.number.isRequired,
|
||||
running: React.PropTypes.number.isRequired,
|
||||
@ -79,6 +85,7 @@ QueueStatus.defaultProps = {
|
||||
sent: null,
|
||||
retry_attempt: null,
|
||||
retry_at: null,
|
||||
error: null,
|
||||
},
|
||||
};
|
||||
|
||||
|
@ -46,6 +46,7 @@
|
||||
'no': __('no'),
|
||||
'none': _x('none', 'An empty state is a status table e.g. Error: none'),
|
||||
'running': _x('running', 'A state of a process.'),
|
||||
'paused': _x('paused', 'A state of a process.'),
|
||||
'cronWaiting': _x('waiting for the next run', 'A state of a process.'),
|
||||
'startedAt': _x('Started at', 'A label in a status table e.g. Started at: 2018-10-18 18:50'),
|
||||
'sentEmails': _x('Sent emails', 'A label in a status table e.g. Sent emails: 50'),
|
||||
|
Reference in New Issue
Block a user