Skip to content

Commit

Permalink
No icon when no call (#88)
Browse files Browse the repository at this point in the history
* Simplify error count Twig condition

This is not necessary to specify `> 0`.

* Do not show debug icon when no Guzzle call happen
  • Loading branch information
soullivaneuh authored and Florian Preusner committed Dec 30, 2016
1 parent bdda71e commit 59f0b30
Showing 1 changed file with 32 additions and 33 deletions.
65 changes: 32 additions & 33 deletions Resources/views/debug.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,39 @@


{% block toolbar %}

{% if collector.callCount == 0 %}
{% set color = 'grey' %}
{% elseif collector.errorCount > 0 %}
{% set color = 'red' %}
{% else %}
{% set color = 'green' %}
{% if collector.callCount %}
{% if collector.errorCount %}
{% set color = 'red' %}
{% else %}
{% set color = 'green' %}
{% endif %}

{% set icon %}
{{ include("@Guzzle/Icons/logo.svg.twig") }}
<span class="sf-toolbar-status sf-toolbar-status-{{ color }}">
{{ collector.callCount }}
</span>
{% endset %}

{% set text %}

<div class="sf-toolbar-info-piece">
<b>API Calls</b>
<span>{{ collector.callCount }}</span>
</div>

<div class="sf-toolbar-info-piece">
<b>Total time</b>
{% if collector.totalTime > 1.0 %}
<span>{{ '%0.2f'|format(collector.totalTime) }} s</span>
{% else %}
<span>{{ '%0.0f'|format(collector.totalTime * 1000) }} ms</span>
{% endif %}
</div>
{% endset %}

{% include "WebProfilerBundle:Profiler:toolbar_item.html.twig" with { "link": profiler_url } %}
{% endif %}

{% set icon %}
{{ include("@Guzzle/Icons/logo.svg.twig") }}
<span class="sf-toolbar-status sf-toolbar-status-{{ color }}">
{{ collector.callCount }}
</span>
{% endset %}

{% set text %}

<div class="sf-toolbar-info-piece">
<b>API Calls</b>
<span>{{ collector.callCount }}</span>
</div>

<div class="sf-toolbar-info-piece">
<b>Total time</b>
{% if collector.totalTime > 1.0 %}
<span>{{ '%0.2f'|format(collector.totalTime) }} s</span>
{% else %}
<span>{{ '%0.0f'|format(collector.totalTime * 1000) }} ms</span>
{% endif %}
</div>
{% endset %}

{% include "WebProfilerBundle:Profiler:toolbar_item.html.twig" with { "link": profiler_url } %}
{% endblock %}


Expand Down

0 comments on commit 59f0b30

Please sign in to comment.