Skip to content

Commit 8a535e8

Browse files
committed
bug #48963 [WebProfilerBundle] [WebProfilerPanel] Update the logger panel filters (javiereguiluz)
This PR was squashed before being merged into the 6.3 branch. Discussion ---------- [WebProfilerBundle] [WebProfilerPanel] Update the logger panel filters | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | symfony/symfony#48762 (comment) | License | MIT | Doc PR | - This only changes the HTML contents of the logger profiler panel to make them valid (and keeps them accessible). No feature or behavior was changed. Commits ------- a8523cb091 [WebProfilerBundle] [WebProfilerPanel] Update the logger panel filters
2 parents b869011 + a5d0f35 commit 8a535e8

File tree

3 files changed

+48
-34
lines changed

3 files changed

+48
-34
lines changed

Resources/views/Collector/logger.html.twig

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -55,27 +55,24 @@
5555
{% set filters = collector.filters %}
5656
<div class="log-filters">
5757
<div id="log-filter-type" class="log-filter">
58-
<div class="tab-navigation" role="tablist">
59-
<button role="tab" class="tab-control {{ not has_error_logs and not has_deprecation_logs ? 'active' }}">
60-
<input {{ not has_error_logs and not has_deprecation_logs ? 'checked' }} type="radio" id="filter-log-type-all" name="filter-log-type" value="all">
61-
<label for="filter-log-type-all">All messages</label>
62-
</button>
63-
64-
<button role="tab" class="tab-control {{ has_error_logs ? 'active' }}">
65-
<input {{ has_error_logs ? 'checked' }} type="radio" id="filter-log-type-error" name="filter-log-type" value="error">
66-
<label for="filter-log-type-error">
67-
Errors
68-
<span class="badge status-{{ collector.counterrors ? 'error' }}">{{ collector.counterrors|default(0) }}</span>
69-
</label>
70-
</button>
71-
72-
<button role="tab" class="tab-control {{ not has_error_logs and has_deprecation_logs ? 'active' }}">
73-
<input {{ not has_error_logs and has_deprecation_logs ? 'checked' }} type="radio" id="filter-log-type-deprecation" name="filter-log-type" value="deprecation">
74-
<label for="filter-log-type-deprecation">
75-
Deprecations
76-
<span class="badge status-{{ collector.countdeprecations ? 'warning' }}">{{ collector.countdeprecations|default(0) }}</span>
77-
</label>
78-
</button>
58+
<div class="tab-navigation">
59+
{% set initially_active_tab = has_error_logs ? 'error' : has_deprecation_logs ? 'deprecation' : 'all' %}
60+
<input type="radio" id="filter-log-type-all" name="filter-log-type" value="all" {{ 'all' == initially_active_tab ? 'checked' }}>
61+
<label for="filter-log-type-all" class="tab-control">
62+
All messages
63+
</label>
64+
65+
<input type="radio" id="filter-log-type-error" name="filter-log-type" value="error" {{ 'error' == initially_active_tab ? 'checked' }}>
66+
<label for="filter-log-type-error" class="tab-control">
67+
Errors
68+
<span class="badge status-{{ collector.counterrors ? 'error' }}">{{ collector.counterrors|default(0) }}</span>
69+
</label>
70+
71+
<input type="radio" id="filter-log-type-deprecation" name="filter-log-type" value="deprecation" {{ 'deprecation' == initially_active_tab ? 'checked' }}>
72+
<label for="filter-log-type-deprecation" class="tab-control">
73+
Deprecations
74+
<span class="badge status-{{ collector.countdeprecations ? 'warning' }}">{{ collector.countdeprecations|default(0) }}</span>
75+
</label>
7976
</div>
8077
</div>
8178

Resources/views/Profiler/base_js.html.twig

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -868,18 +868,18 @@ if (typeof Sfjs === 'undefined' || typeof Sfjs.loadToolbar === 'undefined') {
868868
},
869869
870870
updateLogsTable: function() {
871+
const logs = document.querySelector('table.logs');
872+
if (null === logs) {
873+
return;
874+
}
875+
871876
const selectedType = document.querySelector('#log-filter-type input:checked').value;
872877
const priorities = document.querySelectorAll('#log-filter-priority input');
873878
const allPriorities = Array.from(priorities).map((input) => input.value);
874879
const selectedPriorities = Array.from(priorities).filter((input) => input.checked).map((input) => input.value);
875880
const channels = document.querySelectorAll('#log-filter-channel input');
876881
const selectedChannels = Array.from(channels).filter((input) => input.checked).map((input) => input.value);
877882
878-
const logs = document.querySelector('table.logs');
879-
if (null === logs) {
880-
return;
881-
}
882-
883883
/* hide rows that don't match the current filters */
884884
let numVisibleRows = 0;
885885
logs.querySelectorAll('tbody tr').forEach((row) => {
@@ -909,10 +909,6 @@ if (typeof Sfjs === 'undefined' || typeof Sfjs.loadToolbar === 'undefined') {
909909
/* update the selected totals of all filters */
910910
document.querySelector('#log-filter-priority .filter-active-num').innerText = (priorities.length === selectedPriorities.length) ? 'All' : selectedPriorities.length;
911911
document.querySelector('#log-filter-channel .filter-active-num').innerText = (channels.length === selectedChannels.length) ? 'All' : selectedChannels.length;
912-
913-
/* update the currently selected "log type" tab */
914-
document.querySelectorAll('#log-filter-type .tab-control').forEach((tab) => tab.classList.remove('active'));
915-
document.querySelector(`#log-filter-type input[value="${selectedType}"]`).parentElement.classList.add('active');
916912
},
917913
};
918914
})();

Resources/views/Profiler/profiler.css.twig

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,6 +1554,7 @@ tr.status-warning td {
15541554
background: transparent;
15551555
border: 0;
15561556
box-shadow: none;
1557+
color: var(--color-text);
15571558
transition: box-shadow .05s ease-in, background-color .05s ease-in;
15581559
cursor: pointer;
15591560
font-size: 14px;
@@ -1793,12 +1794,32 @@ tr.status-warning td {
17931794
font-weight: bold;
17941795
padding: 0 1px;
17951796
}
1796-
.log-filter .tab-navigation .tab-control input {
1797-
display: none;
1797+
.log-filter .tab-navigation {
1798+
position: relative;
17981799
}
1799-
.log-filter .tab-navigation .tab-control label {
1800-
cursor: pointer;
1800+
.log-filter .tab-navigation input[type="radio"] {
1801+
position: absolute;
1802+
pointer-events: none;
1803+
opacity: 0;
1804+
}
1805+
.tab-navigation input[type="radio"]:checked + .tab-control {
1806+
background-color: var(--tab-active-background);
1807+
border-radius: 6px;
1808+
box-shadow: inset 0 0 0 1.5px var(--tab-active-border-color);
1809+
color: var(--tab-active-color);
1810+
position: relative;
1811+
z-index: 1;
1812+
}
1813+
.theme-dark .tab-navigation input[type="radio"]:checked + .tab-control {
1814+
box-shadow: inset 0 0 0 1px var(--tab-border-color);
18011815
}
1816+
.tab-navigation input[type="radio"]:focus-visible + .tab-control {
1817+
outline: 1px solid var(--color-link);
1818+
}
1819+
.tab-navigation input[type="radio"]:checked + .tab-control + input[type="radio"] + .tab-control:before{
1820+
width: 0;
1821+
}
1822+
18021823
.log-filters .log-filter .log-filter-content {
18031824
background: var(--base-0);
18041825
border: 1px solid var(--table-border-color);

0 commit comments

Comments
 (0)