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
|
* @return Response A Response instance
|
||||||
*/
|
*/
|
||||||
public function searchBarAction($token)
|
public function searchBarAction()
|
||||||
{
|
{
|
||||||
$profiler = $this->container->get('profiler');
|
$profiler = $this->container->get('profiler');
|
||||||
$profiler->disable();
|
$profiler->disable();
|
||||||
@ -171,11 +171,10 @@ class ProfilerController extends ContainerAware
|
|||||||
$ip = $session->get('_profiler_search_ip');
|
$ip = $session->get('_profiler_search_ip');
|
||||||
$url = $session->get('_profiler_search_url');
|
$url = $session->get('_profiler_search_url');
|
||||||
$limit = $session->get('_profiler_search_limit');
|
$limit = $session->get('_profiler_search_limit');
|
||||||
|
$token = $session->get('_profiler_search_token');
|
||||||
|
|
||||||
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:search.html.twig', array(
|
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:search.html.twig', array(
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
'profiler' => $profiler,
|
|
||||||
'tokens' => $profiler->find($ip, $url, $limit),
|
|
||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'limit' => $limit,
|
'limit' => $limit,
|
||||||
@ -192,6 +191,8 @@ class ProfilerController extends ContainerAware
|
|||||||
$profiler = $this->container->get('profiler');
|
$profiler = $this->container->get('profiler');
|
||||||
$profiler->disable();
|
$profiler->disable();
|
||||||
|
|
||||||
|
$pofiler = $profiler->loadFromToken($token);
|
||||||
|
|
||||||
$session = $this->container->get('request')->getSession();
|
$session = $this->container->get('request')->getSession();
|
||||||
$ip = $session->get('_profiler_search_ip');
|
$ip = $session->get('_profiler_search_ip');
|
||||||
$url = $session->get('_profiler_search_url');
|
$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(
|
return $this->container->get('templating')->renderResponse('WebProfilerBundle:Profiler:results.html.twig', array(
|
||||||
'token' => $token,
|
'token' => $token,
|
||||||
'profiler' => $this->container->get('profiler')->loadFromToken($token),
|
'profiler' => $profiler,
|
||||||
'tokens' => $profiler->find($ip, $url, $limit),
|
'tokens' => $profiler->find($ip, $url, $limit),
|
||||||
'ip' => $ip,
|
'ip' => $ip,
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
@ -220,20 +221,19 @@ class ProfilerController extends ContainerAware
|
|||||||
|
|
||||||
$request = $this->container->get('request');
|
$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 = $request->getSession();
|
||||||
$session->set('_profiler_search_ip', $ip = preg_replace('/[^\d\.]/', '', $request->query->get('ip')));
|
$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_url', $url = $request->query->get('url'));
|
||||||
$session->set('_profiler_search_limit', $limit = $request->query->get('limit'));
|
$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);
|
$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)
|
protected function getTemplateNames($profiler)
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<strong>Exception</strong>
|
<strong>Exception</strong>
|
||||||
<span class="count">
|
<span class="count">
|
||||||
{% if collector.hasexception %}
|
{% if collector.hasexception %}
|
||||||
<span>1</span>
|
<span class="error">1</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</span>
|
</span>
|
||||||
</span>
|
</span>
|
||||||
@ -21,7 +21,9 @@
|
|||||||
<h2>Exception</h2>
|
<h2>Exception</h2>
|
||||||
|
|
||||||
{% if not collector.hasexception %}
|
{% if not collector.hasexception %}
|
||||||
<em>No exception was thrown and uncaught during the request.</em>
|
<p>
|
||||||
|
<em>No exception was thrown and uncaught during the request.</em>
|
||||||
|
</p>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% render 'WebProfilerBundle:Exception:show' with { 'exception': collector.exception, 'format': 'html' } %}
|
{% render 'WebProfilerBundle:Exception:show' with { 'exception': collector.exception, 'format': 'html' } %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
{% else %}
|
{% else %}
|
||||||
<em>No logs available.</em>
|
<p>
|
||||||
|
<em>No logs available.</em>
|
||||||
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -90,6 +90,8 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</table>
|
</table>
|
||||||
{% else %}
|
{% else %}
|
||||||
<em>No request session attributes</em>
|
<p>
|
||||||
|
<em>No request session attributes</em>
|
||||||
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -7,14 +7,16 @@
|
|||||||
<div id="content">
|
<div id="content">
|
||||||
{% include 'WebProfilerBundle:Profiler:header.html.twig' only %}
|
{% include 'WebProfilerBundle:Profiler:header.html.twig' only %}
|
||||||
|
|
||||||
<div class="resume">
|
{% if not profiler.isempty %}
|
||||||
<p>
|
<div class="resume">
|
||||||
<strong><a href="{{ profiler.url }}">{{ profiler.url }}</a></strong>
|
<p>
|
||||||
<span class="date">
|
<strong><a href="{{ profiler.url }}">{{ profiler.url }}</a></strong>
|
||||||
<strong>by {{ profiler.ip }}</strong> at <strong>{{ profiler.time|date('r') }}</strong>
|
<span class="date">
|
||||||
</span>
|
<strong>by {{ profiler.ip }}</strong> at <strong>{{ profiler.time|date('r') }}</strong>
|
||||||
</p>
|
</span>
|
||||||
</div>
|
</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<div class="main">
|
<div class="main">
|
||||||
|
|
||||||
@ -35,8 +37,8 @@
|
|||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% render 'WebProfilerBundle:Profiler:searchBar' with { 'token': token } %}
|
{% render 'WebProfilerBundle:Profiler:searchBar' %}
|
||||||
|
|
||||||
{% include 'WebProfilerBundle:Profiler:admin.html.twig' with { 'token': token } only %}
|
{% include 'WebProfilerBundle:Profiler:admin.html.twig' with { 'token': token } only %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<div class="resume">
|
<div class="resume">
|
||||||
<p>
|
<p>
|
||||||
<strong>Token "{{ token }}" does not exist.</strong>
|
<strong>No request matching the token "{{ token }}".</strong>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -17,7 +17,12 @@
|
|||||||
{% include 'WebProfilerBundle:Profiler:admin.html.twig' with { 'token': token } only %}
|
{% include 'WebProfilerBundle:Profiler:admin.html.twig' with { 'token': token } only %}
|
||||||
</div>
|
</div>
|
||||||
<div class="collector_content">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -3,20 +3,27 @@
|
|||||||
{% block panel %}
|
{% block panel %}
|
||||||
<h2>Search Results</h2>
|
<h2>Search Results</h2>
|
||||||
|
|
||||||
<table>
|
{% if tokens %}
|
||||||
<tr>
|
<table>
|
||||||
<th>Token</th>
|
|
||||||
<th>IP</th>
|
|
||||||
<th>URL</th>
|
|
||||||
<th>Time</th>
|
|
||||||
</tr>
|
|
||||||
{% for elements in tokens %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{ path('_profiler', { 'token': elements.token }) }}">{{ elements.token }}</a></td>
|
<th>Token</th>
|
||||||
<td>{{ elements.ip }}</td>
|
<th>IP</th>
|
||||||
<td>{{ elements.url }}</td>
|
<th>URL</th>
|
||||||
<td>{{ elements.time|date('r') }}</td>
|
<th>Time</th>
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% for elements in tokens %}
|
||||||
</table>
|
<tr>
|
||||||
|
<td><a href="{{ path('_profiler', { 'token': elements.token }) }}">{{ elements.token }}</a></td>
|
||||||
|
<td>{{ elements.ip }}</td>
|
||||||
|
<td>{{ elements.url }}</td>
|
||||||
|
<td>{{ elements.time|date('r') }}</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
{% else %}
|
||||||
|
<p>
|
||||||
|
<em>The query returned no result.</em>
|
||||||
|
</p>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
<input type="text" name="url" id="url" value="{{ url }}" />
|
<input type="text" name="url" id="url" value="{{ url }}" />
|
||||||
<div class="clear_fix"></div>
|
<div class="clear_fix"></div>
|
||||||
<label for="token">Token</label>
|
<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>
|
<div class="clear_fix"></div>
|
||||||
<label for="limit">Limit</label>
|
<label for="limit">Limit</label>
|
||||||
<select name="limit" id="limit">
|
<select name="limit" id="limit">
|
||||||
|
Reference in New Issue
Block a user