Can now prune event/request log records, add width definition to list columns
This commit is contained in:
parent
cf9231466c
commit
6bf72386ee
File diff suppressed because one or more lines are too long
|
|
@ -225,6 +225,18 @@ table.table.data {
|
|||
color: #98a7a8;
|
||||
}
|
||||
}
|
||||
|
||||
td.column-break-word {
|
||||
word-wrap: break-word;
|
||||
word-break: break-all;
|
||||
}
|
||||
|
||||
// Requires "max-width" with px value
|
||||
td.column-single-line {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
}
|
||||
|
||||
tfoot {
|
||||
|
|
|
|||
|
|
@ -56,6 +56,13 @@ class ListColumn
|
|||
*/
|
||||
public $relation;
|
||||
|
||||
/**
|
||||
* @var string sets the column width, can be specified in percents (10%) or pixels (50px).
|
||||
* There could be a single column without width specified, it will be stretched to take the
|
||||
* available space.
|
||||
*/
|
||||
public $width;
|
||||
|
||||
/**
|
||||
* @var string Specify a CSS class to attach to the list cell element.
|
||||
*/
|
||||
|
|
@ -107,6 +114,9 @@ class ListColumn
|
|||
*/
|
||||
protected function evalConfig($config)
|
||||
{
|
||||
if (isset($config['width'])) {
|
||||
$this->width = $config['width'];
|
||||
}
|
||||
if (isset($config['cssClass'])) {
|
||||
$this->cssClass = $config['cssClass'];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -129,7 +129,10 @@ return [
|
|||
'setup_title' => 'List Setup',
|
||||
'setup_help' => 'Use checkboxes to select columns you want to see in the list. You can change position of columns by dragging them up or down.',
|
||||
'records_per_page' => 'Records per page',
|
||||
'records_per_page_help' => 'Select the number of records per page to display. Please note that high number of records on a single page can reduce performance.'
|
||||
'records_per_page_help' => 'Select the number of records per page to display. Please note that high number of records on a single page can reduce performance.',
|
||||
'delete_selected' => 'Delete selected',
|
||||
'delete_selected_confirm' => 'Delete the selected records?',
|
||||
'delete_selected_success' => 'Successfully deleted the selected records.',
|
||||
],
|
||||
'fileupload' => [
|
||||
'attachment' => 'Attachment',
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@
|
|||
|
||||
<?php foreach ($columns as $key => $column): ?>
|
||||
<?php if ($showSorting && $column->sortable): ?>
|
||||
<th class="<?= $this->sortColumn==$column->columnName?'sort-'.$this->sortDirection.' active':'sort-desc' ?> list-cell-name-<?= $column->columnName ?>">
|
||||
<th
|
||||
<?php if ($column->width): ?>style="width: <?= $column->width ?>"<?php endif ?>
|
||||
class="<?= $this->sortColumn==$column->columnName?'sort-'.$this->sortDirection.' active':'sort-desc' ?> list-cell-name-<?= $column->columnName ?>"
|
||||
>
|
||||
<a
|
||||
href="javascript:;"
|
||||
data-request="<?= $this->getEventHandler('onSort') ?>"
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ Columns are defined as array with the `columns` property. The array keys corresp
|
|||
|
||||
- `title`
|
||||
- `type` (string, checkbox, dropdown, autocomplete)
|
||||
- `width` - sets the column width, can be specified in percents (10%) or pixels (50px). There could be a single column without the width specified. It will be stretched to take the available space.
|
||||
- `width` - sets the column width, can be specified in percents (10%) or pixels (50px). There could be a single column without width specified, it will be stretched to take the available space.
|
||||
- `readOnly`
|
||||
- `options` (for drop-down elements and autocomplete types)
|
||||
- `dependsOn` (from drop-down elements)
|
||||
|
|
|
|||
|
|
@ -46,4 +46,19 @@ class EventLogs extends Controller
|
|||
Flash::success(Lang::get('system::lang.event_log.empty_success'));
|
||||
return $this->listRefresh();
|
||||
}
|
||||
|
||||
public function index_onDelete()
|
||||
{
|
||||
if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
|
||||
|
||||
foreach ($checkedIds as $recordId) {
|
||||
if (!$record = EventLog::find($recordId)) continue;
|
||||
$record->delete();
|
||||
}
|
||||
|
||||
Flash::success(Lang::get('backend::lang.list.delete_selected_success'));
|
||||
}
|
||||
|
||||
return $this->listRefresh();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,4 +46,19 @@ class RequestLogs extends Controller
|
|||
Flash::success(Lang::get('system::lang.request_log.empty_success'));
|
||||
return $this->listRefresh();
|
||||
}
|
||||
|
||||
public function index_onDelete()
|
||||
{
|
||||
if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
|
||||
|
||||
foreach ($checkedIds as $recordId) {
|
||||
if (!$record = RequestLog::find($recordId)) continue;
|
||||
$record->delete();
|
||||
}
|
||||
|
||||
Flash::success(Lang::get('backend::lang.list.delete_selected_success'));
|
||||
}
|
||||
|
||||
return $this->listRefresh();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,22 @@
|
|||
href="javascript:;"
|
||||
data-request="onEmptyLog"
|
||||
data-load-indicator="<?= e(trans('system::lang.event_log.empty_loading')) ?>"
|
||||
class="btn btn-default oc-icon-trash-o">
|
||||
class="btn btn-default oc-icon-eraser">
|
||||
<?= e(trans('system::lang.event_log.empty_link')) ?>
|
||||
</a>
|
||||
<button
|
||||
class="btn btn-default oc-icon-trash-o"
|
||||
disabled="disabled"
|
||||
onclick="$(this).data('request-data', {
|
||||
checked: $('.control-list').listWidget('getChecked')
|
||||
})"
|
||||
data-request="onDelete"
|
||||
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
|
||||
data-trigger-action="enable"
|
||||
data-trigger=".control-list input[type=checkbox]"
|
||||
data-trigger-condition="checked"
|
||||
data-request-success="$el.prop('disabled', false)"
|
||||
data-stripe-load-indicator>
|
||||
<?= e(trans('backend::lang.list.delete_selected')) ?>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -9,6 +9,7 @@ recordUrl: system/eventlogs/preview/:id
|
|||
noRecordsMessage: backend::lang.list.no_records
|
||||
recordsPerPage: 30
|
||||
showSetup: true
|
||||
showCheckboxes: true
|
||||
|
||||
toolbar:
|
||||
buttons: list_toolbar
|
||||
|
|
|
|||
|
|
@ -3,7 +3,22 @@
|
|||
href="javascript:;"
|
||||
data-request="onEmptyLog"
|
||||
data-load-indicator="<?= e(trans('system::lang.request_log.empty_loading')) ?>"
|
||||
class="btn btn-default oc-icon-trash-o">
|
||||
class="btn btn-default oc-icon-eraser">
|
||||
<?= e(trans('system::lang.request_log.empty_link')) ?>
|
||||
</a>
|
||||
<button
|
||||
class="btn btn-default oc-icon-trash-o"
|
||||
disabled="disabled"
|
||||
onclick="$(this).data('request-data', {
|
||||
checked: $('.control-list').listWidget('getChecked')
|
||||
})"
|
||||
data-request="onDelete"
|
||||
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
|
||||
data-trigger-action="enable"
|
||||
data-trigger=".control-list input[type=checkbox]"
|
||||
data-trigger-condition="checked"
|
||||
data-request-success="$el.prop('disabled', false)"
|
||||
data-stripe-load-indicator>
|
||||
<?= e(trans('backend::lang.list.delete_selected')) ?>
|
||||
</button>
|
||||
</div>
|
||||
|
|
@ -9,6 +9,7 @@ recordUrl: system/requestlogs/preview/:id
|
|||
noRecordsMessage: backend::lang.list.no_records
|
||||
recordsPerPage: 30
|
||||
showSetup: true
|
||||
showCheckboxes: true
|
||||
defaultSort:
|
||||
column: count
|
||||
direction: desc
|
||||
|
|
|
|||
|
|
@ -16,3 +16,4 @@ columns:
|
|||
searchable: yes
|
||||
type: partial
|
||||
path: message_column
|
||||
cssClass: column-break-word
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ columns:
|
|||
url:
|
||||
label: system::lang.request_log.url
|
||||
searchable: yes
|
||||
cssClass: column-break-word
|
||||
|
||||
count:
|
||||
label: system::lang.request_log.count
|
||||
|
|
|
|||
Loading…
Reference in New Issue