mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-10-27 08:16:41 +01:00
removed static log list for dynamic one via onAdminLogFiles #1765
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
# v1.10.0-rc.1
|
||||
## mm/dd/2019
|
||||
|
||||
1. [](#new)
|
||||
* Added a new `onAdminLogFiles()` event for 3rd party plugins to register log files for log viewer [#1765](https://github.com/getgrav/grav-plugin-admin/issues/1765)
|
||||
1. [](#improved)
|
||||
* Improved delete button UI [#1769](https://github.com/getgrav/grav-plugin-admin/issues/1769)
|
||||
* Ability to configure display of 3rd party dashboard widgets [#1766](https://github.com/getgrav/grav-plugin-admin/issues/1766)
|
||||
|
||||
@@ -6,7 +6,6 @@ logo_text: ''
|
||||
body_classes: ''
|
||||
content_padding: true
|
||||
twofa_enabled: true
|
||||
log_viewer_files: ['grav', 'email']
|
||||
sidebar:
|
||||
activate: tab
|
||||
hover_delay: 100
|
||||
|
||||
@@ -265,15 +265,6 @@ form:
|
||||
label: Hide modular page types in Admin
|
||||
value_only: true
|
||||
|
||||
log_viewer_files:
|
||||
type: selectize
|
||||
size: medium
|
||||
label: PLUGIN_ADMIN.LOG_VIEWER_FILES
|
||||
help: PLUGIN_ADMIN.LOG_VIEWER_FILES_HELP
|
||||
classes: fancy
|
||||
validate:
|
||||
type: commalist
|
||||
|
||||
MediaResize:
|
||||
type: section
|
||||
title: Page Media Image Resizer
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace Grav\Plugin\Admin;
|
||||
|
||||
use DateTime;
|
||||
use Grav\Common\Data;
|
||||
use Grav\Common\Data\Data as GravData;
|
||||
use Grav\Common\File\CompiledYamlFile;
|
||||
use Grav\Common\GPM\GPM;
|
||||
use Grav\Common\GPM\Licenses;
|
||||
@@ -2127,4 +2128,11 @@ class Admin
|
||||
{
|
||||
return $_SERVER['HTTP_REFERER'] ?? null;
|
||||
}
|
||||
|
||||
public function getLogFiles()
|
||||
{
|
||||
$logs = new GravData(['grav.log' => 'Grav System Log', 'email.log' => 'Email Log']);
|
||||
Grav::instance()->fireEvent('onAdminLogFiles', new Event(['logs' => &$logs]));
|
||||
return $logs->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,11 +15,13 @@
|
||||
|
||||
{% import _self as macro %}
|
||||
|
||||
{% set file = grav.uri.query('log') ?: 'grav' %}
|
||||
{% set file = grav.uri.query('log') ?: 'grav.log' %}
|
||||
{% set verbose = grav.uri.query('verbose') == 'true' ? true : false %}
|
||||
{% set lines = grav.uri.query('lines') ?: 20 %}
|
||||
{% set logfile = grav.locator.findResource("log://" ~ file ~ '.log') %}
|
||||
{% set logfile = grav.locator.findResource("log://" ~ file) %}
|
||||
{% set logs = logviewer.objectTail(logfile, lines|int, false) %}
|
||||
{% set log_files = admin.getLogFiles() %}
|
||||
{% set title = log_files[file] %}
|
||||
|
||||
<div class="logs-output">
|
||||
|
||||
@@ -27,10 +29,10 @@
|
||||
<div class="block block-select">
|
||||
<div class="form-field">
|
||||
<div class="form-data">
|
||||
{% set log_files = config.plugins.admin.log_viewer_files|default(['grav','email']) %}
|
||||
|
||||
{% set lines_list = {10:'10 entries', 25:'25 entries', 50:'50 entries', 100:'100 entries', 200:'200 entries', 500:'500 entries'} %}
|
||||
|
||||
{{ macro.render_select('log', log_files, file, true) }}
|
||||
{{ macro.render_select('log', log_files, file) }}
|
||||
{{ macro.render_select('verbose', {'false':'Essential Output', 'true':'Verbose Output'}, verbose) }}
|
||||
{{ macro.render_select('lines', lines_list, lines) }}
|
||||
</div>
|
||||
@@ -38,7 +40,7 @@
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<h1>{{ file|titleize }} Log File</h1>
|
||||
<h1>{{ title }} Output</h1>
|
||||
<h3>Display the {{ lines }} most recent entries...</h3>
|
||||
<table class="noflex">
|
||||
<thead>
|
||||
|
||||
Reference in New Issue
Block a user