Skip to content
Snippets Groups Projects
Commit b739ca88 authored by Oliver Bartsch's avatar Oliver Bartsch Committed by Benni Mack
Browse files

[TASK] Migrate status report to Fluid

The status report within EXT:reports now uses
the StandaloneView for rendering the status table.

Resolves: #93978
Releases: master
Change-Id: I75c629691b5e4dc712a377bc734ef9aacc525dcc
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/68851


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: default avatarcore-ci <typo3@b13.com>
Tested-by: default avatarTorben Hansen <derhansen@gmail.com>
Tested-by: default avatarBenni Mack <benni@typo3.org>
Reviewed-by: default avatarTorben Hansen <derhansen@gmail.com>
Reviewed-by: default avatarBenni Mack <benni@typo3.org>
parent 8fb0bfd7
Branches
Tags
No related merge requests found
......@@ -19,6 +19,7 @@ use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Registry;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Reports\ExtendedStatusProviderInterface;
use TYPO3\CMS\Reports\RequestAwareReportInterface;
use TYPO3\CMS\Reports\RequestAwareStatusProviderInterface;
......@@ -52,14 +53,10 @@ class Status implements RequestAwareReportInterface
*/
public function getReport(ServerRequestInterface $request = null)
{
$content = '';
$status = $this->getSystemStatus($request);
$highestSeverity = $this->getHighestSeverity($status);
// Updating the registry
$registry = GeneralUtility::makeInstance(Registry::class);
$registry->set('tx_reports', 'status.highestSeverity', $highestSeverity);
$content .= '<p class="lead">' . $this->getLanguageService()->getLL('status_report_explanation') . '</p>';
return $content . $this->renderStatus($status);
$registry->set('tx_reports', 'status.highestSeverity', $this->getHighestSeverity($status));
return $this->renderStatus($status);
}
/**
......@@ -153,44 +150,28 @@ class Status implements RequestAwareReportInterface
*/
protected function renderStatus(array $statusCollection)
{
$content = '';
$template = '
<tr>
<td class="###CLASS### col-6">###HEADER###</td>
<td class="###CLASS### col-6">###STATUS###<br>###CONTENT###</td>
</tr>
';
$statuses = $this->sortStatusProviders($statusCollection);
$id = 0;
foreach ($statuses as $provider => $providerStatus) {
$providerState = $this->sortStatuses($providerStatus);
$id++;
$classes = [
// Apply sorting to collection and the providers
$statusCollection = $this->sortStatusProviders($statusCollection);
foreach ($statusCollection as &$statuses) {
$statuses = $this->sortStatuses($statuses);
}
unset($statuses);
$view = GeneralUtility::makeInstance(StandaloneView::class);
$view->setTemplatePathAndFilename(GeneralUtility::getFileAbsFileName(
'EXT:reports/Resources/Private/Templates/StatusReport.html'
));
return $view->assignMultiple([
'statusCollection' => $statusCollection,
'severityClassMapping' => [
ReportStatus::NOTICE => 'notice',
ReportStatus::INFO => 'info',
ReportStatus::OK => 'success',
ReportStatus::WARNING => 'warning',
ReportStatus::ERROR => 'danger'
];
$messages = '';
/** @var ReportStatus $status */
foreach ($providerState as $status) {
$severity = $status->getSeverity();
$messages .= strtr($template, [
'###CLASS###' => $classes[$severity],
'###HEADER###' => $status->getTitle(),
'###STATUS###' => $status->getValue(),
'###CONTENT###' => $status->getMessage()
]);
}
$header = '<h2>' . $provider . '</h2>';
$table = '<table class="table table-striped table-hover">';
$table .= '<tbody>' . $messages . '</tbody>';
$table .= '</table>';
$content .= $header . $table;
}
return $content;
]
])->render();
}
/**
......
<p class="lead">
<f:translate key="LLL:EXT:reports/Resources/Private/Language/locallang_reports.xlf:status_report_explanation" />
</p>
<f:for each="{statusCollection}" as="statuses" key="title">
<h2>{title}</h2>
<table class="table table-striped table-hover">
<tbody>
<f:for each="{statuses}" as="status">
<tr>
<td class="{severityClassMapping.{status.severity}} col-6">
{status.title}
</td>
<td class="{severityClassMapping.{status.severity}} col-6">
{status.value}<br />
{status.message -> f:format.raw()}
</td>
</tr>
</f:for>
</tbody>
</table>
</f:for>
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment