Skip to content

Commit

Permalink
[WebProfilerBundle] Log section minor fixes (missing "notice" filter,…
Browse files Browse the repository at this point in the history
… log priority, accessibility)
  • Loading branch information
Amunak authored and fabpot committed Feb 25, 2022
1 parent 0fc8f7a commit 1c3b266
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
Expand Up @@ -89,8 +89,8 @@

<div class="log-filter-content">
<div class="filter-select-all-or-none">
<a href="#" class="select-all">Select All</a>
<a href="#" class="select-none">Select None</a>
<button type="button" class="btn btn-link select-all">Select All</button>
<button type="button" class="btn btn-link select-none">Select None</button>
</div>

{% for label, value in filters.priority %}
Expand All @@ -110,8 +110,8 @@

<div class="log-filter-content">
<div class="filter-select-all-or-none">
<a href="#" class="select-all">Select All</a>
<a href="#" class="select-none">Select None</a>
<button type="button" class="btn btn-link select-all">Select All</button>
<button type="button" class="btn btn-link select-none">Select None</button>
</div>

{% for value in filters.channel %}
Expand Down Expand Up @@ -155,6 +155,10 @@
{{ log.type|lower }}
{% endif %}
</span>
{% else %}
<span class="log-type-badge badge badge-{{ css_class }}">
{{ log.priorityName|lower }}
</span>
{% endif %}
</td>

Expand Down Expand Up @@ -204,7 +208,7 @@
<td class="font-normal">
{% set context_id = 'context-compiler-' ~ loop.index %}

<a class="btn btn-link sf-toggle" data-toggle-selector="#{{ context_id }}" data-toggle-alt-content="{{ class }}">{{ class }}</a>
<button type="button" class="btn btn-link sf-toggle" data-toggle-selector="#{{ context_id }}" data-toggle-alt-content="{{ class }}">{{ class }}</button>

<div id="{{ context_id }}" class="context sf-toggle-content sf-toggle-hidden">
<ul class="break-long-words">
Expand Down Expand Up @@ -243,12 +247,12 @@

{% if has_context %}
{% set context_id = 'context-' ~ category ~ '-' ~ log_index %}
<span><a class="btn btn-link text-small sf-toggle" data-toggle-selector="#{{ context_id }}" data-toggle-alt-content="Hide context">Show context</a></span>
<span><button type="button" class="btn btn-link text-small sf-toggle" data-toggle-selector="#{{ context_id }}" data-toggle-alt-content="Hide context">Show context</button></span>
{% endif %}

{% if has_trace %}
{% set trace_id = 'trace-' ~ category ~ '-' ~ log_index %}
<span><a class="btn btn-link text-small sf-toggle" data-toggle-selector="#{{ trace_id }}" data-toggle-alt-content="Hide trace">Show trace</a></span>
<span><button type="button" class="btn btn-link text-small sf-toggle" data-toggle-selector="#{{ trace_id }}" data-toggle-alt-content="Hide trace">Show trace</button></span>

<div id="{{ trace_id }}" class="context sf-toggle-content sf-toggle-hidden">
{{ profiler_dump(log.context.exception.trace, maxDepth=1) }}
Expand Down
Expand Up @@ -796,7 +796,7 @@ if (typeof Sfjs === 'undefined' || typeof Sfjs.loadToolbar === 'undefined') {
input.addEventListener('change', () => { Sfjs.updateLogsTable(); });
});
document.querySelectorAll('.filter-select-all-or-none a').forEach((link) => {
document.querySelectorAll('.filter-select-all-or-none button').forEach((link) => {
link.addEventListener('click', () => {
const selectAll = link.classList.contains('select-all');
link.closest('.log-filter-content').querySelectorAll('input').forEach((input) => {
Expand All @@ -819,6 +819,7 @@ if (typeof Sfjs === 'undefined' || typeof Sfjs.loadToolbar === 'undefined') {
updateLogsTable: function() {
const selectedType = document.querySelector('#log-filter-type input:checked').value;
const priorities = document.querySelectorAll('#log-filter-priority input');
const allPriorities = Array.from(priorities).map((input) => input.value);
const selectedPriorities = Array.from(priorities).filter((input) => input.checked).map((input) => input.value);
const channels = document.querySelectorAll('#log-filter-channel input');
const selectedChannels = Array.from(channels).filter((input) => input.checked).map((input) => input.value);
Expand All @@ -836,7 +837,8 @@ if (typeof Sfjs === 'undefined' || typeof Sfjs.loadToolbar === 'undefined') {
return;
}
if (false === selectedPriorities.includes(row.getAttribute('data-priority'))) {
const priority = row.getAttribute('data-priority');
if (false === selectedPriorities.includes(priority) && true === allPriorities.includes(priority)) {
row.style.display = 'none';
return;
}
Expand Down
Expand Up @@ -1135,7 +1135,7 @@ tr.status-warning td {
.log-filter .filter-select-all-or-none {
margin-bottom: 10px;
}
.log-filter .filter-select-all-or-none a + a {
.log-filter .filter-select-all-or-none button + button {
margin-left: 15px;
}
.log-filters .log-filter .log-filter-content .log-filter-option + .log-filter-option {
Expand Down
Expand Up @@ -133,6 +133,7 @@ public function getFilters()
'priority' => [
'Debug' => 100,
'Info' => 200,
'Notice' => 250,
'Warning' => 300,
'Error' => 400,
'Critical' => 500,
Expand Down

0 comments on commit 1c3b266

Please sign in to comment.