Improvements to logging screens and internals of List widget
This commit is contained in:
parent
c404070cad
commit
09106ff560
|
|
@ -6,6 +6,7 @@ title: backend::lang.access_log.menu_label
|
|||
list: @/modules/backend/models/accesslog/columns.yaml
|
||||
modelClass: Backend\Models\AccessLog
|
||||
noRecordsMessage: backend::lang.list.no_records
|
||||
recordsPerPage: 30
|
||||
showSetup: true
|
||||
|
||||
toolbar:
|
||||
|
|
|
|||
|
|
@ -559,7 +559,7 @@ class Lists extends WidgetBase
|
|||
$value = $record->{$columnName};
|
||||
|
||||
if (method_exists($this, 'eval'. studly_case($column->type) .'TypeValue'))
|
||||
$value = $this->{'eval'. studly_case($column->type) .'TypeValue'}($value, $column);
|
||||
$value = $this->{'eval'. studly_case($column->type) .'TypeValue'}($record, $column, $value);
|
||||
|
||||
/*
|
||||
* Extensibility
|
||||
|
|
@ -601,15 +601,19 @@ class Lists extends WidgetBase
|
|||
/**
|
||||
* Process as boolean switch
|
||||
*/
|
||||
public function evalPartialTypeValue($value, $column)
|
||||
protected function evalPartialTypeValue($record, $column, $value)
|
||||
{
|
||||
return $this->controller->makePartial($column->path ?: $column->columnName, ['value' => $value, 'column' => $column]);
|
||||
return $this->controller->makePartial($column->path ?: $column->columnName, [
|
||||
'listColumn' => $column,
|
||||
'record' => $record,
|
||||
'value' => $value
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Process as boolean switch
|
||||
*/
|
||||
public function evalSwitchTypeValue($value, $column)
|
||||
protected function evalSwitchTypeValue($record, $column, $value)
|
||||
{
|
||||
// return ($value) ? '<i class="icon-check"></i>' : '<i class="icon-times"></i>';
|
||||
return ($value) ? 'Yes' : 'No';
|
||||
|
|
@ -618,7 +622,7 @@ class Lists extends WidgetBase
|
|||
/**
|
||||
* Process as a datetime value
|
||||
*/
|
||||
public function evalDatetimeTypeValue($value, $column)
|
||||
protected function evalDatetimeTypeValue($record, $column, $value)
|
||||
{
|
||||
if ($value === null)
|
||||
return null;
|
||||
|
|
@ -634,7 +638,7 @@ class Lists extends WidgetBase
|
|||
/**
|
||||
* Process as a time value
|
||||
*/
|
||||
public function evalTimeTypeValue($value, $column)
|
||||
protected function evalTimeTypeValue($record, $column, $value)
|
||||
{
|
||||
if ($value === null)
|
||||
return null;
|
||||
|
|
@ -650,7 +654,7 @@ class Lists extends WidgetBase
|
|||
/**
|
||||
* Process as a date value
|
||||
*/
|
||||
public function evalDateTypeValue($value, $column)
|
||||
protected function evalDateTypeValue($record, $column, $value)
|
||||
{
|
||||
if ($value === null)
|
||||
return null;
|
||||
|
|
@ -666,7 +670,7 @@ class Lists extends WidgetBase
|
|||
/**
|
||||
* Process as diff for humans (1 min ago)
|
||||
*/
|
||||
public function evalTimesinceTypeValue($value, $column)
|
||||
protected function evalTimesinceTypeValue($record, $column, $value)
|
||||
{
|
||||
if ($value === null)
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -1,6 +1 @@
|
|||
<?php
|
||||
if (preg_match("/with message '(.+)' in/", $value, $matches))
|
||||
echo $matches[1];
|
||||
else
|
||||
echo Str::limit($value, 100);
|
||||
?>
|
||||
<?= e($record->summary) ?>
|
||||
|
|
@ -7,6 +7,7 @@ list: @/modules/system/models/eventlog/columns.yaml
|
|||
modelClass: System\Models\EventLog
|
||||
recordUrl: system/eventlogs/preview/:id
|
||||
noRecordsMessage: backend::lang.list.no_records
|
||||
recordsPerPage: 30
|
||||
showSetup: true
|
||||
|
||||
toolbar:
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ list: @/modules/system/models/requestlog/columns.yaml
|
|||
modelClass: System\Models\RequestLog
|
||||
recordUrl: system/requestlogs/preview/:id
|
||||
noRecordsMessage: backend::lang.list.no_records
|
||||
recordsPerPage: 30
|
||||
showSetup: true
|
||||
|
||||
toolbar:
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<?php namespace System\Models;
|
||||
|
||||
use Str;
|
||||
use Model;
|
||||
|
||||
/**
|
||||
|
|
@ -49,4 +50,17 @@ class EventLog extends Model
|
|||
return ucfirst($level);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a shorter version of the message attribute,
|
||||
* extracts the exception message or limits by 100 characters.
|
||||
* @return string
|
||||
*/
|
||||
public function getSummaryAttribute()
|
||||
{
|
||||
if (preg_match("/with message '(.+)' in/", $this->message, $match))
|
||||
return $match[1];
|
||||
|
||||
return Str::limit($this->message, 100);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue