mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-29 13:10:06 +02:00
Coloring on log level in log tables now work again.
This commit is contained in:
parent
f0395d51b0
commit
618a6e49dd
3 changed files with 28 additions and 25 deletions
|
@ -105,6 +105,28 @@ class LogDataTable implements DataTableTypeInterface
|
|||
$this->configureOptions($resolver);
|
||||
$options = $resolver->resolve($options);
|
||||
|
||||
//This special $$rowClass column is used to set the row class depending on the log level. The class gets set by the frontend controller
|
||||
$dataTable->add('$$rowClass', TextColumn::class, [
|
||||
'label' => '',
|
||||
'className' => 'no-colvis',
|
||||
'visible' => false,
|
||||
'render' => static function ($value, AbstractLogEntry $context) {
|
||||
switch ($context->getLevel()) {
|
||||
case AbstractLogEntry::LEVEL_EMERGENCY:
|
||||
case AbstractLogEntry::LEVEL_ALERT:
|
||||
case AbstractLogEntry::LEVEL_CRITICAL:
|
||||
case AbstractLogEntry::LEVEL_ERROR:
|
||||
return 'table-danger';
|
||||
case AbstractLogEntry::LEVEL_WARNING:
|
||||
return 'table-warning';
|
||||
case AbstractLogEntry::LEVEL_NOTICE:
|
||||
return 'table-info';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
},
|
||||
]);
|
||||
|
||||
$dataTable->add('symbol', TextColumn::class, [
|
||||
'label' => '',
|
||||
'className' => 'no-colvis',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue