Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ env:
matrix:
fast_finish: true
include:
- php: 7.3
- php: 7.3
- php: 7.4
- php: 7.4
env: SETUP=lowest
- php: 8.0
- php: 8.0
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Symfony bundle dedicated to Ibexa, to add a log management interface to the back

## Requirements

* php: >=7.3
* ibexa: 3.3.*
* php: >=7.4
* ibexa: 4.0+

:warning: Warning, in its current version, the bundle **only supports** log files in `Monolog/LineFormatter` format.
[LineFormatter from Github](https://github.com/Seldaek/monolog/blob/master/src/Monolog/Formatter/LineFormatter.php)
Expand Down
11 changes: 8 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
}
},
"require": {
"php": ">=7.3",
"php": ">=7.4",
"ext-json": "*",
"ezsystems/ezplatform-admin-ui": "^2.3",
"http-interop/http-factory-guzzle": "^1.2",
"ibexa/admin-ui": "^4.0",
"ibexa/core": "^4.0",
"monolog/monolog": "^2.2",
"symfony/cache": "^5.2",
"symfony/web-profiler-bundle": "^5.2"
Expand All @@ -38,6 +40,9 @@
"prefer-stable": true,
"config": {
"optimize-autoloader": true,
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"php-http/discovery": true
}
}
}
6 changes: 3 additions & 3 deletions src/Controller/LogsManagerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace IbexaLogsUi\Bundle\Controller;

use eZ\Publish\Core\MVC\Symfony\Security\Authorization\Attribute;
use Ibexa\Core\MVC\Symfony\Security\Authorization\Attribute;
use IbexaLogsUi\Bundle\LogManager\LogFile;
use IbexaLogsUi\Bundle\LogManager\LogsCache;
use EzSystems\EzPlatformAdminUiBundle\Controller\Controller;
use Ibexa\Contracts\AdminUi\Controller\Controller;
use Monolog\Handler\HandlerInterface;
use Monolog\Logger;
use Symfony\Component\HttpFoundation\Response;
Expand Down Expand Up @@ -116,7 +116,7 @@ private function renderLogs(
array $logs = [],
array $logLevels = LogFile::LOG_LEVELS
): Response {
return $this->render('@ezdesign/logs/logs.html.twig', [
return $this->render('@ibexadesign/logs/logs.html.twig', [
'log_path' => $logPath,
'level' => $level,
'page' => $page,
Expand Down
1 change: 1 addition & 0 deletions src/EventSubscriber/MenuSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function onConfigureMenu(ConfigureMenuEvent $event): void
$menu[MainMenuBuilder::ITEM_ADMIN]->addChild('logs_ui', [
'label' => 'logs_ui.menu.label',
'route' => 'ibexa_logs_ui_index',
'extras' => ['translation_domain' => 'messages']
]);
}
}
2 changes: 1 addition & 1 deletion src/IbexaLogsUiBundle.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function build(ContainerBuilder $container): void
{
parent::build($container);

$eZExtension = $container->getExtension('ezpublish');
$eZExtension = $container->getExtension('ibexa');
$eZExtension->addPolicyProvider(new LogsUiProvider);
}
}
86 changes: 40 additions & 46 deletions src/Resources/views/themes/admin/logs/logs.html.twig
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{% extends ['@ezdesign/layout.html.twig', '@ezdesign/ui/layout.html.twig'] %}
{% extends ['@ibexadesign/layout.html.twig', '@ibexadesign/ui/layout.html.twig'] %}

{% block breadcrumbs %}
{% include ['@ezdesign/parts/breadcrumbs.html.twig', '@ezdesign/ui/breadcrumbs.html.twig'] with { items: [
{% include ['@ibexadesign/parts/breadcrumbs.html.twig', '@ibexadesign/ui/breadcrumbs.html.twig'] with { items: [
{ value: 'breadcrumb.admin'|trans(domain='messages')|desc('Admin') },
{ value: 'logs_ui.menu.label'|trans }
]} %}
{% endblock %}

{% block page_title %}
{% include ['@ezdesign/parts/page_title.html.twig', '@ezdesign/ui/page_title.html.twig'] with {
{% block header %}
{% include ['@ibexadesign/parts/page_title.html.twig', '@ibexadesign/ui/page_title.html.twig'] with {
title: 'logs_ui.menu.label'|trans,
iconName: 'contentlist'
} %}
Expand All @@ -19,43 +19,37 @@
{% set max_logs = constant('IbexaLogsUi\\Bundle\\Controller\\LogsManagerController::MAX_LOGS') %}
{% set pages = (total / per_page_logs)|round(0, 'ceil') %}

<div class="row ez-header pt-3">
<div class="container ez-container">
<div class="ez-table-header">
<div>
<div class="ez-table-header__headline">
{{ 'logs_ui.text.last_message'|trans }} {{ logs is not empty ? logs|first.date|date('d/m/Y H:i') : '#' }}
</div>
<i class="text-secondary">{{ log_path }}</i>
</div>
<div class="ez-table-header__tools">
<a href="{{ path('ibexa_logs_ui_reload') }}" class="btn btn-icon" title="{{ 'logs_ui.text.reload'|trans }}">
<svg class="ez-icon ez-icon-refresh">
<use xlink:href="{{ ez_icon_path('refresh') }}"></use>
</svg>
<span class="text-primary ml-1">{{ 'logs_ui.text.reload'|trans }}</span>
</a>
<div class="container ibexa-container">
<div class="ibexa-table-header">
<div>
<div class="ibexa-table-header__headline">
{{ 'logs_ui.text.last_message'|trans }} {{ logs is not empty ? logs|first.date|date('d/m/Y H:i') : '#' }}
</div>
<i class="text-secondary">{{ log_path }}</i>
</div>
<div class="ibexa-table-header__tools">
<a href="{{ path('ibexa_logs_ui_reload') }}" class="btn btn-icon" title="{{ 'logs_ui.text.reload'|trans }}">
<svg class="ibexa-icon ibexa-icon--small">
<use xlink:href="{{ ibexa_icon_path('refresh') }}"></use>
</svg>
<span class="text-primary ml-1">{{ 'logs_ui.text.reload'|trans }}</span>
</a>
</div>
</div>

<ul class="nav nav-tabs ez-tabs px-4">
<li class="nav-item">
<a href="{{ path('ibexa_logs_ui_index') }}" class="nav-link {{ level == 'all' ? 'active' }}">
{{ 'logs_ui.text.all_levels'|trans }}
</a>
</li>
{% for item in log_levels %}
<li class="nav-item">
<a href="{{ path('ibexa_logs_ui_index', {level: item|lower}) }}" class="nav-link {{ level == item|lower ? 'active' }}">
{{ item }}
</a>
</li>
{% endfor %}
</ul>
<div class="mt-4">
<a href="{{ path('ibexa_logs_ui_index') }}" class="btn {{ level == 'all' ? 'btn-primary' : 'btn-secondary' }}">
{{ 'logs_ui.text.all_levels'|trans }}
</a>
{% for item in log_levels %}
<a href="{{ path('ibexa_logs_ui_index', {level: item|lower}) }}" class="btn {{ level == item|lower ? 'btn-primary' : 'btn-secondary' }}">
{{ item }}
</a>
{% endfor %}
</div>
</div>

<div class="container ez-container pb-5" id="ez-tab-list-content-logs">
<div class="container ibexa-container" id="ibexa-tab-list-content-logs">
{% if per_page_logs < total %}
<div class="mb-2">
{% if page != 1 %}
Expand All @@ -74,24 +68,24 @@
{{ 'logs_ui.text.log_path'|trans }} {{ log_path }}
</p>
{% else %}
<table class="table ez-table ez-table--list">
<table class="table ibexa-table">
<thead>
<tr>
<th scope="col">Date</th>
<th scope="col">Logger</th>
<th scope="col">Message</th>
<tr class="ibexa-table__head-row">
<th class="ibexa-table__header-cell" scope="col">Date</th>
<th class="ibexa-table__header-cell" scope="col">Logger</th>
<th class="ibexa-table__header-cell" scope="col">Message</th>
</tr>
</thead>
<tbody>
{% for log in logs %}
<tr>
<th scope="row" class="text-nowrap">{{ log.date|date('d/m/Y H:i:s') }}</th>
<td class="text-nowrap">
<div class="badge badge-{{ log.class is defined ? log.class : 'secondary' }}">
<tr class="ibexa-table__row">
<th scope="row" class="ibexa-table__cell text-nowrap">{{ log.date|date('d/m/Y H:i:s') }}</th>
<td class="ibexa-table__cell text-nowrap">
<div class="badge ibexa-badge ibexa-badge--{{ log.class is defined ? log.class : 'secondary' }}">
{{ log.logger }}.{{ log.level }}
</div>
</td>
<td class="text-break">
<td class="ibexa-table__cell text-break">
<samp>{{ dump_log_message(log.message, log.context) }}</samp>
{% if log.context is not empty or log.extra is not empty %}
<details class="mt-2">
Expand All @@ -117,7 +111,7 @@
</table>
{% endif %}

{% from '@ezdesign/logs/pagination.html.twig' import pagination %}
{% from '@ibexadesign/logs/pagination.html.twig' import pagination %}
{{ pagination(pages, page, path('ibexa_logs_ui_index') ~ '/' ~ level ~ '/', logs|length, total) }}
</div>
{% endblock %}
16 changes: 8 additions & 8 deletions src/Resources/views/themes/admin/logs/pagination.html.twig
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{% macro pagination(pages, current, url, perPageLogs, total, nearbyPagesLimit = 4) %}
{% if pages > 1 %}
<div class="m-sub-items__pagination-container">
<div class="m-sub-items__pagination-info">
<div class="ibexa-pagination">
<div class="ibexa-pagination__info">
{{ 'logs_ui.text.pagination'|trans({'%perPage%': perPageLogs|number_format(0, ',', ' '), '%total%': total|number_format(0, ',', ' ')})|raw }}
</div>
<ul class="c-pagination pagination">
<ul class="pagination ibexa-pagination__navigation">
{% for i in 1..pages %}
{% if 0 == (current - nearbyPagesLimit) - loop.index %}
<li class="c-pagination-button page-item">
<li class="page-item">
<a href="{{ (url ~ 1)|e }}" class="page-link">1</a>
</li>
{% if 1 != loop.index %}
<li class="c-pagination-button page-item disabled">
<li class="page-item disabled">
<button class="page-link" aria-disabled="true">...</button>
</li>
{% endif %}
{% elseif 0 == (current + nearbyPagesLimit) - loop.index and (current + nearbyPagesLimit) < pages %}
<li class="c-pagination-button page-item disabled">
<li class="page-item disabled">
<button class="page-link" aria-disabled="true">...</button>
</li>
{% elseif 0 < (current - nearbyPagesLimit) - loop.index %}
{% elseif 0 > (current + nearbyPagesLimit) - loop.index %}
{% else %}
<li class="c-pagination-button page-item {{ current == loop.index ? 'active' }}">
<li class="page-item {{ current == loop.index ? 'active' }}">
{% if current == loop.index %}
<button class="page-link">{{ loop.index }}</button>
{% else %}
Expand All @@ -32,7 +32,7 @@
{% endif %}
{% endfor %}
{% if current != pages and (current + nearbyPagesLimit) < pages %}
<li class="c-pagination-button page-item">
<li class="page-item">
<a href="{{ (url ~ pages)|e }}" class="page-link">{{ pages }}</a>
</li>
{% endif %}
Expand Down
2 changes: 1 addition & 1 deletion src/Security/LogsUiProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace IbexaLogsUi\Bundle\Security;

use eZ\Bundle\EzPublishCoreBundle\DependencyInjection\Security\PolicyProvider\YamlPolicyProvider;
use Ibexa\Bundle\Core\DependencyInjection\Security\PolicyProvider\YamlPolicyProvider;

class LogsUiProvider extends YamlPolicyProvider
{
Expand Down