Merge remote branch 'vicb/profiler_template'
* vicb/profiler_template: [WebProfilerBundle] Remove dead code [WebProfilerBundle] Better handling of queries with an empty result [WebProfilerBundle] Improve the "token not found" page [WebProfilerBundle] Always remember the query including the token [WebProfilerBundle] Apply missing styles
This commit is contained in:
commit
bfe09d45fa
@ -162,7 +162,7 @@ class ProfilerController extends ContainerAware
|
||||
*
|
||||
* @return Response A Response instance
|
||||
*/
|
||||
public function searchBarAction($token)
|
||||
public function searchBarAction()
|
||||
{
|
||||
$profiler = $this->container->get('profiler');
|
||||
$profiler->disable();
|
||||
@ -171,11 +171,10 @@ class ProfilerController extends ContainerAware
|
||||
$ip = $session->get('_profiler_search_ip');
|
||||
$url = $session->get('_profiler_search_url');
|
||||
$limit = $session->get('_profiler_search_limit');
|
||||
$token = $session->get('_profiler_search_token');
|
||||
|
||||
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:search.html.twig', array(
|
||||
'token' => $token,
|
||||
'profiler' => $profiler,
|
||||
'tokens' => $profiler->find($ip, $url, $limit),
|
||||
'ip' => $ip,
|
||||
'url' => $url,
|
||||
'limit' => $limit,
|
||||
@ -192,6 +191,8 @@ class ProfilerController extends ContainerAware
|
||||
$profiler = $this->container->get('profiler');
|
||||
$profiler->disable();
|
||||
|
||||
$pofiler = $profiler->loadFromToken($token);
|
||||
|
||||
$session = $this->container->get('request')->getSession();
|
||||
$ip = $session->get('_profiler_search_ip');
|
||||
$url = $session->get('_profiler_search_url');
|
||||
@ -199,7 +200,7 @@ class ProfilerController extends ContainerAware
|
||||
|
||||
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:results.html.twig', array(
|
||||
'token' => $token,
|
||||
'profiler' => $this->container->get('profiler')->loadFromToken($token),
|
||||
'profiler' => $profiler,
|
||||
'tokens' => $profiler->find($ip, $url, $limit),
|
||||
'ip' => $ip,
|
||||
'url' => $url,
|
||||
@ -220,20 +221,19 @@ class ProfilerController extends ContainerAware
|
||||
|
||||
$request = $this->container->get('request');
|
||||
|
||||
if ($token = $request->query->get('token')) {
|
||||
return new RedirectResponse($this->container->get('router')->generate('_profiler', array('token' => $token)));
|
||||
}
|
||||
|
||||
$session = $request->getSession();
|
||||
$session->set('_profiler_search_ip', $ip = preg_replace('/[^\d\.]/', '', $request->query->get('ip')));
|
||||
$session->set('_profiler_search_url', $url = $request->query->get('url'));
|
||||
$session->set('_profiler_search_limit', $limit = $request->query->get('limit'));
|
||||
$session->set('_profiler_search_token', $token = $request->query->get('token'));
|
||||
|
||||
if (!empty($token)) {
|
||||
return new RedirectResponse($this->container->get('router')->generate('_profiler', array('token' => $token)));
|
||||
}
|
||||
|
||||
$profiler = $this->container->get('profiler');
|
||||
$profiler->disable();
|
||||
$tokens = $profiler->find($ip, $url, $limit);
|
||||
|
||||
return new RedirectResponse($this->container->get('router')->generate('_profiler_search_results', array('token' => $tokens ? $tokens[0]['token'] : '')));
|
||||
return new RedirectResponse($this->container->get('router')->generate('_profiler_search_results', array('token' => $tokens ? $tokens[0]['token'] : 'empty')));
|
||||
}
|
||||
|
||||
protected function getTemplateNames($profiler)
|
||||
|
@ -11,7 +11,7 @@
|
||||
<strong>Exception</strong>
|
||||
<span class="count">
|
||||
{% if collector.hasexception %}
|
||||
<span>1</span>
|
||||
<span class="error">1</span>
|
||||
{% endif %}
|
||||
</span>
|
||||
</span>
|
||||
@ -21,7 +21,9 @@
|
||||
<h2>Exception</h2>
|
||||
|
||||
{% if not collector.hasexception %}
|
||||
<p>
|
||||
<em>No exception was thrown and uncaught during the request.</em>
|
||||
</p>
|
||||
{% else %}
|
||||
{% render 'WebProfilerBundle:Exception:show' with { 'exception': collector.exception, 'format': 'html' } %}
|
||||
{% endif %}
|
||||
|
@ -30,6 +30,8 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>
|
||||
<em>No logs available.</em>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -90,6 +90,8 @@
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<p>
|
||||
<em>No request session attributes</em>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
@ -7,6 +7,7 @@
|
||||
<div id="content">
|
||||
{% include 'WebProfilerBundle:Profiler:header.html.twig' only %}
|
||||
|
||||
{% if not profiler.isempty %}
|
||||
<div class="resume">
|
||||
<p>
|
||||
<strong><a href="{{ profiler.url }}">{{ profiler.url }}</a></strong>
|
||||
@ -15,6 +16,7 @@
|
||||
</span>
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="main">
|
||||
|
||||
@ -35,7 +37,7 @@
|
||||
</ul>
|
||||
{% endif %}
|
||||
|
||||
{% render 'WebProfilerBundle:Profiler:searchBar' with { 'token': token } %}
|
||||
{% render 'WebProfilerBundle:Profiler:searchBar' %}
|
||||
|
||||
{% include 'WebProfilerBundle:Profiler:admin.html.twig' with { 'token': token } only %}
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
<div class="resume">
|
||||
<p>
|
||||
<strong>Token "{{ token }}" does not exist.</strong>
|
||||
<strong>No request matching the token "{{ token }}".</strong>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@ -17,7 +17,12 @@
|
||||
{% include 'WebProfilerBundle:Profiler:admin.html.twig' with { 'token': token } only %}
|
||||
</div>
|
||||
<div class="collector_content">
|
||||
{% block panel '' %}
|
||||
{% block panel%}
|
||||
<h2>Token not found</h2>
|
||||
<p>
|
||||
<em>No request matching the token "{{ token }}".</em>
|
||||
</p>
|
||||
{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -3,6 +3,7 @@
|
||||
{% block panel %}
|
||||
<h2>Search Results</h2>
|
||||
|
||||
{% if tokens %}
|
||||
<table>
|
||||
<tr>
|
||||
<th>Token</th>
|
||||
@ -19,4 +20,10 @@
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
{% else %}
|
||||
<p>
|
||||
<em>The query returned no result.</em>
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -11,7 +11,7 @@
|
||||
<input type="text" name="url" id="url" value="{{ url }}" />
|
||||
<div class="clear_fix"></div>
|
||||
<label for="token">Token</label>
|
||||
<input type="text" name="token" id="token" />
|
||||
<input type="text" name="token" id="token" value="{{ token }}" />
|
||||
<div class="clear_fix"></div>
|
||||
<label for="limit">Limit</label>
|
||||
<select name="limit" id="limit">
|
||||
|
Reference in New Issue
Block a user