diff --git a/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md b/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md index f1cb83280b9d8..247aea5a8ca50 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +7.2 +--- + +* Follow the browser from the profiler to quickly find the profiler token + 7.1 --- diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/settings-follow-all.svg b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/settings-follow-all.svg new file mode 100644 index 0000000000000..ba7dcfd49724c --- /dev/null +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/settings-follow-all.svg @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/settings-follow-main.svg b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/settings-follow-main.svg new file mode 100644 index 0000000000000..b7486df097a69 --- /dev/null +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/settings-follow-main.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/settings-follow-nothing.svg b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/settings-follow-nothing.svg new file mode 100644 index 0000000000000..e2280c7aa98dd --- /dev/null +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/settings-follow-nothing.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/browser_tracker.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/browser_tracker.html.twig new file mode 100644 index 0000000000000..01bffddcd8d81 --- /dev/null +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/browser_tracker.html.twig @@ -0,0 +1,77 @@ + + + + + diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig index 2d35e72ab7d04..ca3e7e1e70ebf 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig @@ -18,6 +18,8 @@ }, with_context=false) }} {% endif %} {% endblock %} + + {{ include('@WebProfiler/Profiler/browser_tracker.html.twig') }}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/settings.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/settings.html.twig index 9f96c5b881eb6..2f5ae3dd9bfce 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/settings.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/settings.html.twig @@ -250,6 +250,34 @@

+ +

Follow Browser

+ +
+ + + + + +
@@ -295,6 +323,7 @@ openModalButton.addEventListener('click', function(event) { document.getElementById('settings-' + (localStorage.getItem('symfony/profiler/theme') || 'theme-auto')).checked = 'checked'; document.getElementById('settings-' + (localStorage.getItem('symfony/profiler/width') || 'width-normal')).checked = 'checked'; + document.getElementById('settings-' + (localStorage.getItem('symfony/profiler/follow') || 'follow-main')).checked = 'checked'; modalWindow.classList.toggle('visible'); setTimeout(() => closeModalButton.focus(), 30); diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig index f6b37b37e9fb7..525c00a746102 100644 --- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig +++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig @@ -248,6 +248,9 @@ } } } + else if(request.profile) { + broadCastToken(request.profile, "ajax", request.url); + } pendingRequests--; var row = request.DOMNode; @@ -396,6 +399,16 @@ } {% endif %} + function broadCastToken(token, type, help) { + if (!window.hasOwnProperty('BroadcastChannel')) return; + + (new BroadcastChannel('symfony_profiler')).postMessage({ + token: token, + type: type, + help: help + }); + } + return { hasClass: hasClass, @@ -510,6 +523,7 @@ setPreference('toolbar/displayState', 'block'); }); + broadCastToken(token, 'main', (document.getElementById('sfToolbarMainContent-' + token).querySelector(".sf-toolbar-block-request .sf-toolbar-label")?.innerText ?? "") + (document.getElementById('sfToolbarMainContent-' + token).querySelector(".sf-toolbar-block-request .sf-toolbar-info-piece-additional")?.innerText ?? "")); }, loadToolbar: function(token, newToken) {