Display data in table

[MAILPOET-3135]
This commit is contained in:
Pavel Dohnal
2021-03-02 14:25:35 +01:00
committed by Veljko V
parent dbbea72ef3
commit 74367ae40e
3 changed files with 18 additions and 7 deletions

View File

@ -30,7 +30,7 @@ class Logs {
$data['logs'][] = [ $data['logs'][] = [
'name' => $log->getName(), 'name' => $log->getName(),
'message' => $log->getMessage(), 'message' => $log->getMessage(),
'created_at' => $log->getCreatedAt(), 'created_at' => $log->getCreatedAt()->format('Y-m-d H:i:s'),
]; ];
} }
$this->pageRenderer->displayPage('logs.html', $data); $this->pageRenderer->displayPage('logs.html', $data);

View File

@ -33,6 +33,8 @@ class LogRepository extends Repository {
->setParameter('dateTo', $dateTo->format('Y-m-d H:i:s')); ->setParameter('dateTo', $dateTo->format('Y-m-d H:i:s'));
} }
$query->orderBy('l.createdAt', 'desc');
return $query->getQuery()->getResult(); return $query->getQuery()->getResult();
} }
} }

View File

@ -5,12 +5,21 @@
<div class="wrap"> <div class="wrap">
<h1 class="mailpoet-h1">Logs</h1> <h1 class="mailpoet-h1">Logs</h1>
<table class="mailpoet-listing-table widefat fixed"> <table class="mailpoet-listing-table widefat striped">
<thead>
<tr> <tr>
<th>Name</th> <th>Name</th>
<th>Message</th> <th>Message</th>
<th>Created On</th> <th>Created On</th>
</tr> </tr>
</thead>
<% for log in logs %>
<tr>
<td><%= log.name %></td>
<td><%= log.message %></td>
<td><%= log.created_at %></td>
</tr>
<% endfor %>
</table> </table>
</div> </div>