diff --git a/src/Symfony/Bundle/DoctrineBundle/DataCollector/DoctrineDataCollector.php b/src/Symfony/Bundle/DoctrineBundle/DataCollector/DoctrineDataCollector.php
index 9a8371f09b..6777b853b1 100644
--- a/src/Symfony/Bundle/DoctrineBundle/DataCollector/DoctrineDataCollector.php
+++ b/src/Symfony/Bundle/DoctrineBundle/DataCollector/DoctrineDataCollector.php
@@ -67,4 +67,11 @@ class DoctrineDataCollector extends DataCollector
{
return 'db';
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getStatus() {
+ return $this->getQueryCount() < 10 ? self::INFO : self::WARNING;
+ }
}
diff --git a/src/Symfony/Bundle/DoctrineBundle/Resources/views/Collector/db.html.twig b/src/Symfony/Bundle/DoctrineBundle/Resources/views/Collector/db.html.twig
index 5a47ce8721..256802dec5 100644
--- a/src/Symfony/Bundle/DoctrineBundle/Resources/views/Collector/db.html.twig
+++ b/src/Symfony/Bundle/DoctrineBundle/Resources/views/Collector/db.html.twig
@@ -5,9 +5,9 @@
{% endset %}
{% set text %}
- {{ collector.querycount }}
+ {{ collector.querycount }}
{% endset %}
- {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'icon' : icon, 'text' : text } only %}
+ {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'icon' : icon, 'text' : text, 'status' : collector.status } only %}
{% endblock %}
{% block menu %}
diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/DataCollector/DoctrineMongoDBDataCollector.php b/src/Symfony/Bundle/DoctrineMongoDBBundle/DataCollector/DoctrineMongoDBDataCollector.php
index e6c14eca15..3eff736e93 100644
--- a/src/Symfony/Bundle/DoctrineMongoDBBundle/DataCollector/DoctrineMongoDBDataCollector.php
+++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/DataCollector/DoctrineMongoDBDataCollector.php
@@ -56,4 +56,11 @@ class DoctrineMongoDBDataCollector extends DataCollector
{
return 'mongodb';
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getStatus() {
+ return $this->getQueryCount() < 10 ? self::INFO : self::WARNING;
+ }
}
diff --git a/src/Symfony/Bundle/DoctrineMongoDBBundle/Resources/views/Collector/mongodb.html.twig b/src/Symfony/Bundle/DoctrineMongoDBBundle/Resources/views/Collector/mongodb.html.twig
index d5268dbef3..1b5964b761 100644
--- a/src/Symfony/Bundle/DoctrineMongoDBBundle/Resources/views/Collector/mongodb.html.twig
+++ b/src/Symfony/Bundle/DoctrineMongoDBBundle/Resources/views/Collector/mongodb.html.twig
@@ -5,9 +5,9 @@
{% endset %}
{% set text %}
- {{ collector.querycount }}
+ {{ collector.querycount }}
{% endset %}
- {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'icon' : icon, 'text' : text } only %}
+ {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'icon' : icon, 'text' : text, 'status' : collector.status } only %}
{% endblock %}
{% block menu %}
diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig
index 578f00eaa6..35819686b9 100644
--- a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig
+++ b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig
@@ -15,7 +15,7 @@
{% endif %}
{% endset %}
- {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'icon' : icon, 'text' : text } only %}
+ {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'icon' : icon, 'text' : text, 'status' : collector.status } only %}
{% endblock %}
{% block menu %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig
index ae71c5be55..062acd23b8 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig
@@ -7,7 +7,7 @@
{% set text %}
{{ collector.counterrors }}
{% endset %}
- {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'icon' : icon, 'text' : text } only %}
+ {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'icon' : icon, 'text' : text, 'status' : collector.status } only %}
{% endblock %}
{% block menu %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/memory.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/memory.html.twig
index 6412b5c2e6..80687d39c0 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/memory.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/memory.html.twig
@@ -7,5 +7,5 @@
{% set text %}
{{ '%.0f'|format(collector.memory / 1024) }} KB
{% endset %}
- {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'icon' : icon, 'text' : text } only %}
+ {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'icon' : icon, 'text' : text, 'status' : collector.status } only %}
{% endblock %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig
index 94f11d3cb6..15b0a368d0 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig
@@ -13,7 +13,7 @@
|
{{ collector.contenttype }}
{% endset %}
- {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'icon' : icon, 'text' : text } only %}
+ {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'icon' : icon, 'text' : text, 'status' : collector.status } only %}
{% endblock %}
{% block menu %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/timer.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/timer.html.twig
index 80d4624f26..234d96ed41 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/timer.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/timer.html.twig
@@ -7,5 +7,5 @@
{% set text %}
{{ '%.0f'|format(collector.time * 1000) }} ms
{% endset %}
- {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'icon' : icon, 'text' : text } only %}
+ {% include 'WebProfilerBundle:Profiler:toolbar_item.html.twig' with {'icon' : icon, 'text' : text, 'status' : collector.status } only %}
{% endblock %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig
index 5381775218..410f8cef81 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig
@@ -1,5 +1,12 @@
-
+{% set style = '' %}
+{% if status is defined %}
+ {% if 'error' == status %}
+ {% set style = 'background-color: #f66;' %}
+ {% elseif 'warning' == status %}
+ {% set style = 'background-color: #fa2;' %}
+ {% endif %}
+{% endif %}
+
{% if icon is defined %}{{ icon }}{% endif %}
{% if text is defined %}{{ text }}{% endif %}
-
-
+
\ No newline at end of file
diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php
index f1002fbb83..6a0e721fc2 100644
--- a/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php
+++ b/src/Symfony/Component/HttpKernel/DataCollector/DataCollector.php
@@ -24,6 +24,16 @@ abstract class DataCollector implements DataCollectorInterface, \Serializable
{
protected $data;
+ /**
+ * Returns the status of the collector.
+ *
+ * @return integer The status of the collector
+ */
+ public function getStatus()
+ {
+ return self::INFO;
+ }
+
public function serialize()
{
return serialize($this->data);
diff --git a/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php b/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php
index d4a28547ea..74f01d6103 100644
--- a/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php
+++ b/src/Symfony/Component/HttpKernel/DataCollector/DataCollectorInterface.php
@@ -22,6 +22,10 @@ use Symfony\Component\HttpFoundation\Response;
*/
interface DataCollectorInterface
{
+ const INFO = 'info';
+ const WARNING = 'warning';
+ const ERROR = 'error';
+
/**
* Collects data for the given Request and Response.
*
@@ -37,4 +41,11 @@ interface DataCollectorInterface
* @return string The collector name
*/
function getName();
+
+ /**
+ * Returns the status of the collector.
+ *
+ * @return string The status of the collector
+ */
+ function getStatus();
}
diff --git a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php
index 6fbef25c86..ad3c57af37 100644
--- a/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php
+++ b/src/Symfony/Component/HttpKernel/DataCollector/LoggerDataCollector.php
@@ -72,4 +72,12 @@ class LoggerDataCollector extends DataCollector
{
return 'logger';
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getStatus()
+ {
+ return 0 === $this->countErrors() ? self::INFO : self::ERROR;
+ }
}