| 1 |
/** |
| 2 |
* WordPress dependencies. |
| 3 |
*/ |
| 4 |
import { safeHTML } from '@wordpress/dom'; |
| 5 |
import { RawHTML, WPElement } from '@wordpress/element'; |
| 6 |
import { __ } from '@wordpress/i18n'; |
| 7 |
|
| 8 |
/** |
| 9 |
* Internal dependencies. |
| 10 |
*/ |
| 11 |
import { useSync } from '../../sync'; |
| 12 |
|
| 13 |
/** |
| 14 |
* Log messages component. |
| 15 |
* |
| 16 |
* @returns {WPElement} Component. |
| 17 |
*/ |
| 18 |
export default () => { |
| 19 |
const { errorCounts } = useSync(); |
| 20 |
|
| 21 |
return ( |
| 22 |
<div className="ep-sync-errors"> |
| 23 |
{errorCounts.length ? ( |
| 24 |
<table className="ep-sync-errors__table"> |
| 25 |
<thead> |
| 26 |
<tr> |
| 27 |
<th>{__('Count', 'elasticpress')}</th> |
| 28 |
<th>{__('Error type', 'elasticpress')}</th> |
| 29 |
</tr> |
| 30 |
</thead> |
| 31 |
{errorCounts.map((e) => ( |
| 32 |
<tr key={e.type}> |
| 33 |
<td className="ep-sync-errors__count">{e.count}</td> |
| 34 |
<td> |
| 35 |
{e.type} |
| 36 |
<RawHTML className="ep-sync-errors__solution"> |
| 37 |
{safeHTML(e.solution)} |
| 38 |
</RawHTML> |
| 39 |
</td> |
| 40 |
</tr> |
| 41 |
))} |
| 42 |
</table> |
| 43 |
) : ( |
| 44 |
<p>{__('No errors found in the log.', 'elasticpress')}</p> |
| 45 |
)} |
| 46 |
</div> |
| 47 |
); |
| 48 |
}; |
| 49 |
|