From c965dbd431e519c262d1b51a404f1cbe83929061 Mon Sep 17 00:00:00 2001 From: Jeffrey Layanto Date: Wed, 30 Dec 2015 17:43:19 +1100 Subject: [PATCH 1/6] Create icon.svg Flat style Stash icon for new web debug toolbar and profiler --- Resources/views/Profiler/icon.svg | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Resources/views/Profiler/icon.svg diff --git a/Resources/views/Profiler/icon.svg b/Resources/views/Profiler/icon.svg new file mode 100644 index 0000000..be86c50 --- /dev/null +++ b/Resources/views/Profiler/icon.svg @@ -0,0 +1,4 @@ + +    + S + From fffc80d897ab6d6b7f05aad04a67abc21df32e87 Mon Sep 17 00:00:00 2001 From: Jeffrey Layanto Date: Wed, 30 Dec 2015 17:45:04 +1100 Subject: [PATCH 2/6] Update layout.html.twig - Add support for new web debug toolbar and profiler - Convert PNG icon into base64 PNG --- Resources/views/Profiler/layout.html.twig | 124 ++++++++++++++-------- 1 file changed, 82 insertions(+), 42 deletions(-) diff --git a/Resources/views/Profiler/layout.html.twig b/Resources/views/Profiler/layout.html.twig index 118695e..a2614ff 100644 --- a/Resources/views/Profiler/layout.html.twig +++ b/Resources/views/Profiler/layout.html.twig @@ -1,44 +1,79 @@ -{% extends 'WebProfilerBundle:Profiler:layout.html.twig' %} +{% extends app.request.isXmlHttpRequest ? '@WebProfiler/Profiler/ajax_layout.html.twig' : '@WebProfiler/Profiler/layout.html.twig' %} {% block toolbar %} - {% set icon %} - Memory Usage - {{ collector.calls }} call{% if collector.calls != 1 %}s{% endif %} / {{ collector.hits }} hit{% if collector.hits != 1 %}s{% endif %} - {% endset %} - {% set text %} -
- Total Response {{ collector.calls }} / {{ collector.hits }} -
-
- Default Queue {{ collector.default }} -
-
- Av. Drivers {{ collector.drivers|join(', ') }} -
- {% for name, details in collector.caches %} -
+ {% if collector.calls > 0 or collector.hits > 0 %} + + {% set profiler_markup_version = profiler_markup_version|default(1) %} + + {% set icon %} + {% if profiler_markup_version == 1 %} + + Memory Usage + + {{ collector.calls }} call{% if collector.calls != 1 %}s{% endif %} / {{ collector.hits }} hit{% if collector.hits != 1 %}s{% endif %} + + {% else %} + {{ include('@TedivmStash/Profiler/icon.svg') }} + + {{ collector.hits }} + + of + {{ collector.calls }} + call{% if collector.calls != 1 %}s{% endif %} + + + {% endif %} + {% endset %} + + {% set text %} +
+ Total Response {{ collector.calls }} / {{ collector.hits }} +
- {{ name }} {{ details.calls }} / {{ details.hits }} + Default Queue {{ collector.default }}
- Drivers {{ details.options.drivers|join(', ') }} + Av. Drivers {{ collector.drivers|join(', ') }}
- {% endfor %} - {% endset %} - {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with { 'link': profiler_url } %} + {% for name, details in collector.caches %} +
+
+ {{ name }} {{ details.calls }} / {{ details.hits }} +
+
+ Drivers {{ details.options.drivers|join(', ') }} +
+ {% endfor %} + {% endset %} + + {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: profiler_url, status: status|default('') }) }} + {% endif %} {% endblock %} {% block menu %} - - - Stash - - {{ collector.calls }} / {{ collector.hits }} - - + {% set profiler_markup_version = profiler_markup_version|default(1) %} + + {% if profiler_markup_version == 1 %} + + + + + Stash + + {{ collector.calls }} / {{ collector.hits }} + + + {% else %} + + {{ include('@TedivmStash/Profiler/icon.svg') }} + Stash + + {% endif %} {% endblock %} {% block panel %} + {% set profiler_markup_version = profiler_markup_version|default(1) %} +

Cache Information

@@ -115,21 +150,26 @@

Query Record

- - - - - - - {% for query in details.queries %} + {% if not details.queries|length %} +
+

No queries were performed.

+
+ {% else %} +
Request KeyHit?Returned Value
- - - + + + - {% endfor %} -
{{ query.key }}{{ query.hit }}{{ query.value }}Request KeyHit?Returned Value
- + {% for query in details.queries %} + + {{ query.key }} + {{ query.hit }} + {{ query.value }} + + {% endfor %} + + {% endif %} {% endfor %} {% endblock %} From 0e83b16df6cca361bbbfcf39b745330568be9d1a Mon Sep 17 00:00:00 2001 From: Jeffrey Layanto Date: Wed, 30 Dec 2015 17:46:06 +1100 Subject: [PATCH 3/6] Delete stash.png Replace with equivalent in layout.html.twig as base64 PNG --- Resources/public/images/stash.png | Bin 1417 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 Resources/public/images/stash.png diff --git a/Resources/public/images/stash.png b/Resources/public/images/stash.png deleted file mode 100644 index 07b7e0d7f37f48af07f6037fb4455d189be0e150..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1417 zcmV;41$O$0P)3I>1S^)SwCh{zCOf`otLy5_+j$KI(xNK&fzVG+MamEAY0B@Sv7(hVS zduCaGLLhr9qmq(l<^g|5Y7By)8QAOlennl+%=Q6Yzyp#fI3e{9fSECXgExoehK-44 z_E2R1VW7E^p7VYGyrj*Ny3MSR3QDgbVW2mq0!B;P*x13=zC%_&v%MWj0`lbJ|AP5#$OjBW{(`nz#J_05VH61bJ+JJe!@1H3fnIfRI0ox^A zElOe8s|>$b$@g+H08@Z>(&_YwQqn6G&H$g9Stw}=kT2I z4A2R*7TU#4k=e6n&m`b8Nq0w-uIQhZrohUvbx8`XsFDgg7AgKEX>BT%`n7Cif*_bA zX$LSPI_Q>wENvkbs!&Cg(Pd`uO4<$F1{_bNQW-0%q8i|1Gg~}RG=_on04_<|kt25k?*WU8dXp7T4#U(I+JVhxwjWq-W{V_!D=81)H8wRmNxniY0j^6* z-dyd5IqNpF%LuQ?xD&k~HjL;#${7wQ0Nh-{9aN|d*=+WVbM9qeQ55}aKu!|g?76d* z>C7}AJ97LbDI5h<6&dLxXfwOuT;j5%5q*8M-+_jyUqLvm_qQ+%uZaInzd`_=r~DB%VC}jnKiqCC66y* z{f5{0X7|@joqBKV$AxmyDlohQi(L)v?d_~uxtfNVvw7-?r3C5ksI9GG?YcGbs<3wo zxG7DAzU6K)*7RG|qpL|I5?sH2okNEXv;OrBWHK2h*G-NY7*`G!eUHqsOFNlNvg@mz zeDV19P>})X>gr;D^Zp_Cr+hw_bIzU4=kr^EZOLTv!2J31RZM!O*bpB2 za^~pi={YcF%HKSuuFeJw?zr{~& Date: Wed, 30 Dec 2015 18:13:48 +1100 Subject: [PATCH 4/6] Fix cs - trailing spaces --- Resources/views/Profiler/layout.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/views/Profiler/layout.html.twig b/Resources/views/Profiler/layout.html.twig index a2614ff..4ebcd44 100644 --- a/Resources/views/Profiler/layout.html.twig +++ b/Resources/views/Profiler/layout.html.twig @@ -11,7 +11,7 @@ Memory Usage {{ collector.calls }} call{% if collector.calls != 1 %}s{% endif %} / {{ collector.hits }} hit{% if collector.hits != 1 %}s{% endif %} - + {% else %} {{ include('@TedivmStash/Profiler/icon.svg') }} From 68e282711128d5411d4ce633ccbd03d64a2aad60 Mon Sep 17 00:00:00 2001 From: Jeffrey Layanto Date: Thu, 31 Dec 2015 18:10:56 +1100 Subject: [PATCH 5/6] Update layout.html.twig Update new profiler 2.8/3.0 based on style of TwigBundle and DoctrineBundle --- Resources/views/Profiler/layout.html.twig | 241 ++++++++++++++++------ 1 file changed, 174 insertions(+), 67 deletions(-) diff --git a/Resources/views/Profiler/layout.html.twig b/Resources/views/Profiler/layout.html.twig index 4ebcd44..a42ac6b 100644 --- a/Resources/views/Profiler/layout.html.twig +++ b/Resources/views/Profiler/layout.html.twig @@ -16,6 +16,7 @@ {{ include('@TedivmStash/Profiler/icon.svg') }} {{ collector.hits }} + hit{% if collector.hits != 1 %}s{% endif %} of {{ collector.calls }} @@ -75,79 +76,181 @@ {% set profiler_markup_version = profiler_markup_version|default(1) %}

Cache Information

- - - - - - - - - - - - - - - - -
Default Cache{{ collector.default }}
Available Drivers{{ collector.drivers|join(', ') }}
Total Requests{{ collector.calls }}
Total Hits{{ collector.hits }}
- - {% for name, details in collector.caches %} - -

Cache Service: {{ name }}

+ {% if profiler_markup_version == 1 %} - - - - - - - + + - - + + - - + + - - + +
Drivers{{ details.options.drivers|join(', ') }}
Calls{{ details.calls }}
Default Cache{{ collector.default }}
Hits{{ details.hits }}Available Drivers{{ collector.drivers|join(', ') }}
Doctrine Adapter{{ details.options.registerDoctrineAdapter ? 'true' : 'false' }}Total Requests{{ collector.calls }}
Cache In-Memory{{ details.options.inMemory ? 'true' : 'false' }}Total Hits{{ collector.hits }}
+ {% else %} +
+
+ {{ collector.calls }} + Total requests +
+
+ {{ collector.hits }} + Total hits +
+
+ + + + + + + + + + + + + + + + + +
KeyValue
Default Cache{{ collector.default }}
Available Drivers{{ collector.drivers|join(', ') }}
+ {% endif %} + + {% for name, details in collector.caches %} + +

Cache Service: {{ name }}

+ {% if profiler_markup_version == 1 %} + + + + + + + + + + + + + + + + + + + + + +
Drivers{{ details.options.drivers|join(', ') }}
Calls{{ details.calls }}
Hits{{ details.hits }}
Doctrine Adapter{{ details.options.registerDoctrineAdapter ? 'true' : 'false' }}
Cache In-Memory{{ details.options.inMemory ? 'true' : 'false' }}
+ {% else %} +
+
+ {{ details.calls }} + Requests +
+
+ {{ details.hits }} + Hits +
+
+ + + + + + + + + + + + + + + + + + + + + + +
KeyValue
Drivers{{ details.options.drivers|join(', ') }}
Doctrine Adapter{{ details.options.registerDoctrineAdapter ? 'true' : 'false' }}
Cache In-Memory{{ details.options.inMemory ? 'true' : 'false' }}
+ {% endif %}

Driver Options

- + {% if profiler_markup_version == 1 %} +
+ {% for name, options in details.options %} + {% if name != 'drivers' and name in details.options.drivers %} + + + + {% if name in ['Memcache', 'Redis'] %} + {% for ovalue in options.servers %} + + + + + {% endfor %} + {% else %} + {% for oname, ovalue in options %} + + + {% if oname == 'filePermissions' or oname == 'dirPermissions' %} + + {% endif %} + + {% endfor %} + {% endif %} + {% endif %} + {% endfor %} +

{{ name }} settings

Server{{ ovalue.server }}:{{ ovalue.port }} {% if ovalue.weight is defined %}(weight {{ ovalue.weight }}){% endif %}
{{ oname }}{{ "%o"|format(ovalue) }} + {% else %} + {{ ovalue }}
+ {% else %} {% for name, options in details.options %} {% if name != 'drivers' and name in details.options.drivers %} - -

{{ name }} settings

- - {% if name in ['Memcache', 'Redis'] %} - {% for ovalue in options.servers %} - - Server - {{ ovalue.server }}:{{ ovalue.port }} {% if ovalue.weight is defined %}(weight {{ ovalue.weight }}){% endif %} - - {% endfor %} - {% else %} - {% for oname, ovalue in options %} + + - - {% if oname == 'filePermissions' or oname == 'dirPermissions' %} - - {% endif %} - - {% endfor %} - {% endif %} + + + + + {% if name in ['Memcache', 'Redis'] %} + {% for ovalue in options.servers %} + + + + + {% endfor %} + {% else %} + {% for oname, ovalue in options %} + + + {% if oname == 'filePermissions' or oname == 'dirPermissions' %} + + {% endif %} + + {% endfor %} + {% endif %} + {% endif %} +
{{ oname }}{{ "%o"|format(ovalue) }} - {% else %} - {{ ovalue }}
{{ name }} settings
Server{{ ovalue.server }}:{{ ovalue.port }} {% if ovalue.weight is defined %}(weight {{ ovalue.weight }}){% endif %}
{{ oname }}{{ "%o"|format(ovalue) }} + {% else %} + {{ ovalue }}
{% endfor %} - + {% endif %}

Query Record

{% if not details.queries|length %} @@ -156,18 +259,22 @@ {% else %} - - - - - - {% for query in details.queries %} + - - - + + + - {% endfor %} + + + {% for query in details.queries %} + + + + + + {% endfor %} +
Request KeyHit?Returned Value
{{ query.key }}{{ query.hit }}{{ query.value }}Request KeyHit?Returned Value
{{ query.key }}{{ query.hit }}{{ query.value }}
{% endif %} From 858f0efab8aeb9f360d583616f3aa289761c6c17 Mon Sep 17 00:00:00 2001 From: Jeffrey Layanto Date: Tue, 5 Jan 2016 18:06:39 +1100 Subject: [PATCH 6/6] Update layout.html.twig - Modify web debug toolbar to show '''x/y''' for medium view and ```x calls/y hits``` for large view - Add status color depending on percentage of ```hits/calls``` where <33% = red, <66% = yellow --- Resources/views/Profiler/layout.html.twig | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/Resources/views/Profiler/layout.html.twig b/Resources/views/Profiler/layout.html.twig index a42ac6b..636d38a 100644 --- a/Resources/views/Profiler/layout.html.twig +++ b/Resources/views/Profiler/layout.html.twig @@ -2,27 +2,27 @@ {% block toolbar %} {% if collector.calls > 0 or collector.hits > 0 %} - {% set profiler_markup_version = profiler_markup_version|default(1) %} {% set icon %} {% if profiler_markup_version == 1 %} - Memory Usage {{ collector.calls }} call{% if collector.calls != 1 %}s{% endif %} / {{ collector.hits }} hit{% if collector.hits != 1 %}s{% endif %} - {% else %} + {% set status = (collector.hits/collector.calls) < 0.33 ? 'red' : (collector.hits/collector.calls) < 0.66 ? 'yellow' : '' %} + {{ include('@TedivmStash/Profiler/icon.svg') }} - {{ collector.hits }} - hit{% if collector.hits != 1 %}s{% endif %} + {{ collector.calls }} - of - {{ collector.calls }} call{% if collector.calls != 1 %}s{% endif %} - + / + {{ collector.hits }} + + hit{% if collector.hits != 1 %}s{% endif %} + {% endif %} {% endset %} @@ -126,7 +126,6 @@ {% endif %} {% for name, details in collector.caches %} -

Cache Service: {{ name }}

{% if profiler_markup_version == 1 %} @@ -277,6 +276,5 @@
{% endif %} - {% endfor %} {% endblock %}