From bcad5557507d093730cc8fed85bb2f5368eea17d Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Sat, 12 Dec 2015 02:24:21 +0100 Subject: [PATCH] Fix ghost item in toolbar when no query --- Resources/views/Collector/db.html.twig | 90 +++++++++++++------------- 1 file changed, 46 insertions(+), 44 deletions(-) diff --git a/Resources/views/Collector/db.html.twig b/Resources/views/Collector/db.html.twig index d0c4b331f..7a48f7e85 100644 --- a/Resources/views/Collector/db.html.twig +++ b/Resources/views/Collector/db.html.twig @@ -1,23 +1,24 @@ {% extends app.request.isXmlHttpRequest ? '@WebProfiler/Profiler/ajax_layout.html.twig' : '@WebProfiler/Profiler/layout.html.twig' %} {% block toolbar %} - {% set profiler_markup_version = profiler_markup_version|default(1) %} + {% if collector.querycount > 0 or collector.invalidEntityCount > 0 %} - {% set icon %} - {% if profiler_markup_version == 1 %} + {% set profiler_markup_version = profiler_markup_version|default(1) %} - Database - {{ collector.querycount }} - {% if collector.querycount > 0 %} - in {{ '%0.2f'|format(collector.time * 1000) }} ms - {% endif %} - {% if collector.invalidEntityCount > 0 %} - {{ collector.invalidEntityCount }} - {% endif %} + {% set icon %} + {% if profiler_markup_version == 1 %} - {% else %} + Database + {{ collector.querycount }} + {% if collector.querycount > 0 %} + in {{ '%0.2f'|format(collector.time * 1000) }} ms + {% endif %} + {% if collector.invalidEntityCount > 0 %} + {{ collector.invalidEntityCount }} + {% endif %} + + {% else %} - {% if collector.querycount > 0 or collector.invalidEntityCount > 0 %} {% set status = collector.invalidEntityCount > 0 ? 'red' : collector.querycount > 50 ? 'yellow' %} {{ include('@Doctrine/Collector/icon.svg') }} @@ -33,46 +34,47 @@ ms {% endif %} - {% endif %} - {% endif %} - {% endset %} + {% endif %} + {% endset %} - {% set text %} -
- Database Queries - {{ collector.querycount }} -
-
- Query time - {{ '%0.2f'|format(collector.time * 1000) }} ms -
-
- Invalid entities - {{ collector.invalidEntityCount }} -
- {% if collector.cacheEnabled %} -
- Cache hits - {{ collector.cacheHitsCount }} -
+ {% set text %}
- Cache misses - {{ collector.cacheMissesCount }} + Database Queries + {{ collector.querycount }}
- Cache puts - {{ collector.cachePutsCount }} + Query time + {{ '%0.2f'|format(collector.time * 1000) }} ms
- {% else %}
- Second Level Cache - disabled + Invalid entities + {{ collector.invalidEntityCount }}
- {% endif %} - {% endset %} + {% if collector.cacheEnabled %} +
+ Cache hits + {{ collector.cacheHitsCount }} +
+
+ Cache misses + {{ collector.cacheMissesCount }} +
+
+ Cache puts + {{ collector.cachePutsCount }} +
+ {% else %} +
+ Second Level Cache + disabled +
+ {% endif %} + {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status|default('') }) }} - {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status|default('') }) }} + {% endif %} {% endblock %} {% block menu %}