From 29a271b1bf6b5d801afad5cb0a9c13139ce55a78 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Wed, 27 Mar 2024 12:38:36 +0100 Subject: [PATCH] [WebProfilerBundle] Improve performance --- .../Resources/views/Profiler/base.html.twig | 1 + .../views/Profiler/base_js.html.twig | 19 ------------------- .../views/Profiler/profiler.css.twig | 5 +++++ 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig index 1eaa87b976d4c..90b805366c906 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig @@ -4,6 +4,7 @@ + {% block title %}Symfony Profiler{% endblock %} {% set request_collector = profile is defined ? profile.collectors.request|default(null) : null %} diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig index af0549ed7f1a2..8841dd7a82d51 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig @@ -11,7 +11,6 @@ class SymfonyProfiler { constructor() { - this.#reorderMainMenuItems(); this.#createTabs(); this.#createTableSearchFields(); this.#createToggles(); @@ -19,24 +18,6 @@ this.#convertDateTimesToUserTimezone(); } - #reorderMainMenuItems() { - /* reorder the main menu items to always display first the non-disabled items */ - const mainMenuElement = document.querySelector('#menu-profiler'); - const firstDisabledMenuItem = mainMenuElement.querySelector('li a > span.disabled')?.parentNode?.parentNode; - - if (!firstDisabledMenuItem) { - return; - } - - const mainMenuItems = mainMenuElement.querySelectorAll('li'); - mainMenuItems.forEach(menuItem => { - const isDisabled = null !== menuItem.querySelector('a > span.disabled'); - if (!isDisabled) { - mainMenuElement.insertBefore(menuItem, firstDisabledMenuItem); - } - }); - } - #createTabs() { /* the accessibility options of this component have been defined according to: */ /* www.w3.org/WAI/ARIA/apg/example-index/tabs/tabs-manual.html */ diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig index 0e3231b52e54a..fda25704c76f6 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig @@ -1499,11 +1499,16 @@ tr.status-warning td { list-style-type: none; margin: 0; padding: 7px; + display: flex; + flex-direction: column; } #menu-profiler li { margin-bottom: 0; position: relative; } +#menu-profiler li:has(span.disabled) { + order: 1; +} #menu-profiler li + li { margin-top: 4px; }