From 1534f8be331a7eb74dd630a058519d4dbb83ef41 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Tue, 8 Dec 2015 12:52:06 +0100 Subject: [PATCH] Support new 2.8/3.0 toolbar and profiler design --- Resources/config/phpcr.xml | 2 +- Resources/views/Collector/icon.svg | 4 + Resources/views/Collector/phpcr.html.twig | 257 +++++++--------------- 3 files changed, 87 insertions(+), 176 deletions(-) create mode 100644 Resources/views/Collector/icon.svg diff --git a/Resources/config/phpcr.xml b/Resources/config/phpcr.xml index 119efa08..717c5cca 100644 --- a/Resources/config/phpcr.xml +++ b/Resources/config/phpcr.xml @@ -51,7 +51,7 @@ - + diff --git a/Resources/views/Collector/icon.svg b/Resources/views/Collector/icon.svg new file mode 100644 index 00000000..b5d59d6f --- /dev/null +++ b/Resources/views/Collector/icon.svg @@ -0,0 +1,4 @@ + + + diff --git a/Resources/views/Collector/phpcr.html.twig b/Resources/views/Collector/phpcr.html.twig index c031adfe..a0c5c49e 100644 --- a/Resources/views/Collector/phpcr.html.twig +++ b/Resources/views/Collector/phpcr.html.twig @@ -1,50 +1,77 @@ {% extends 'WebProfilerBundle:Profiler:layout.html.twig' %} {% block toolbar %} + {% set profiler_markup_version = profiler_markup_version|default(1) %} + {% set icon %} - Database - {{ collector.callcount }} - {% if collector.callcount > 0 %} - in {{ '%0.2f'|format(collector.time * 1000) }} ms + {% if profiler_markup_version == 1 %} + Database + {{ collector.callcount }} + {% if collector.callcount > 0 %} + in {{ '%0.2f'|format(collector.time * 1000) }} ms + {% endif %} + {% else %} + {% if collector.callcount > 0 %} + {% set status = collector.callcount > 50 ? 'yellow' %} + + {{ include('@DoctrinePHPCR/Collector/icon.svg') }} + + {{ collector.callcount }} + + in + {{ '%0.2f'|format(collector.time * 1000) }} + ms + + {% endif %} {% endif %} {% endset %} + {% set text %}
PHPCR Calls - {{ collector.callcount }} + {{ collector.callcount }}
Call time {{ '%0.2f'|format(collector.time * 1000) }} ms
{% endset %} - {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url } %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status|default('') }) }} {% endblock %} {% block menu %} - - - PHPCR - - {{ collector.callcount }} - {{ '%0.0f'|format(collector.time * 1000) }} ms - - + {% set profiler_markup_version = profiler_markup_version|default(1) %} + + {% if profiler_markup_version == 1 %} + + + PHPCR + + {{ collector.callcount }} + {{ '%0.0f'|format(collector.time * 1000) }} ms + + + {% else %} + + {{ include('@DoctrinePHPCR/Collector/icon.svg') }} + PHPCR + + {% endif %} {% endblock %} {% block panel %} - {{ block('calls') }} -{% endblock %} - -{% block calls %}

Calls

{% for connection, calls in collector.calls %} -

Connection {{ connection }}

+ {% if collector.connections|length > 1 %} +

Connection {{ connection }}

+ {% endif %} + {% if calls is empty %} -

- No calls. -

+
+

No calls.

+
{% else %} @@ -58,19 +85,22 @@ {% for i, call in calls %} - + {% endfor %} @@ -84,9 +114,9 @@ {% if collector.connections %} {% include 'WebProfilerBundle:Profiler:table.html.twig' with {data: collector.connections} only %} {% else %} -

- No connections. -

+
+

No connections.

+
{% endif %}

Document Managers

@@ -94,24 +124,30 @@ {% if collector.managers %} {% include 'WebProfilerBundle:Profiler:table.html.twig' with {data: collector.managers} only %} {% else %} -

- No document managers. -

+
+

No document managers.

+
{% endif %} -

Mapping

+

Document Mapping

{% for manager, classes in collector.documents %} -

Manager {{ manager }}

+ {% if collector.managers|length > 1 %} +

Manager {{ manager }}

+ {% endif %} + {% if classes is empty %} -

No loaded documents.

+
+

No loaded documents.

+
{% else %}
{{ loop.index }}{{ '%0.2f'|format(call.executionMS * 1000) }} ms{{ '%0.2f'|format(call.executionMS * 1000) }} ms - - {{ call.method|raw }} - - - Method: {{ call.method|yaml_encode }}
- Parameters: {{ call.params|yaml_encode }}
- Environment: {{ call.env|yaml_encode }}
- {% if call.caller is defined %} - Callers
    {% for caller in call.caller %}
  • - {{ caller }}
  • {% endfor %}
- {% endif %} -
+ {{ call.method|raw }}
+ + Parameters: + {{ call.params|yaml_encode }}
+ Environment: + {{ call.env|yaml_encode }}
+ {% if call.caller is defined %} + Callers +
    + {% for caller in call.caller %} +
  • - {{ caller }}
  • + {% endfor %} +
+ {% endif %}
- - - + + + + {% for class in classes %} @@ -122,133 +158,4 @@
Class
Class
{% endif %} {% endfor %} - - - - {% endblock %}