results.html.twig 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. {% extends '@WebProfiler/Profiler/layout.html.twig' %}
  2. {% macro profile_search_filter(request, result, property) %}
  3. {%- if request.hasSession -%}
  4. <a href="{{ path('_profiler_search_results', request.query.all|merge({token: result.token})|merge({ (property): result[property] })) }}" title="Search"><span title="Search" class="sf-icon sf-search">{{ include('@WebProfiler/Icon/search.svg') }}</span></a>
  5. {%- endif -%}
  6. {% endmacro %}
  7. {% import _self as helper %}
  8. {% block summary %}
  9. <div class="status">
  10. <div class="container">
  11. <h2>Profile Search</h2>
  12. </div>
  13. </div>
  14. {% endblock %}
  15. {% block panel %}
  16. <h2>{{ tokens ? tokens|length : 'No' }} results found</h2>
  17. {% if tokens %}
  18. <table id="search-results">
  19. <thead>
  20. <tr>
  21. <th scope="col" class="text-center">Status</th>
  22. <th scope="col">IP</th>
  23. <th scope="col">Method</th>
  24. <th scope="col">URL</th>
  25. <th scope="col">Time</th>
  26. <th scope="col">Token</th>
  27. </tr>
  28. </thead>
  29. <tbody>
  30. {% for result in tokens %}
  31. {% set css_class = result.status_code|default(0) > 399 ? 'status-error' : result.status_code|default(0) > 299 ? 'status-warning' : 'status-success' %}
  32. <tr>
  33. <td class="text-center">
  34. <span class="label {{ css_class }}">{{ result.status_code|default('n/a') }}</span>
  35. </td>
  36. <td>
  37. <span class="nowrap">{{ result.ip }} {{ helper.profile_search_filter(request, result, 'ip') }}</span>
  38. </td>
  39. <td>
  40. <span class="nowrap">{{ result.method }} {{ helper.profile_search_filter(request, result, 'method') }}</span>
  41. </td>
  42. <td class="break-long-words">
  43. {{ result.url }}
  44. {{ helper.profile_search_filter(request, result, 'url') }}
  45. </td>
  46. <td class="text-small">
  47. <span class="nowrap">{{ result.time|date('d-M-Y') }}</span>
  48. <span class="nowrap newline">{{ result.time|date('H:i:s') }}</span>
  49. </td>
  50. <td class="nowrap"><a href="{{ path('_profiler', { token: result.token }) }}">{{ result.token }}</a></td>
  51. </tr>
  52. {% endfor %}
  53. </tbody>
  54. </table>
  55. {% else %}
  56. <div class="empty">
  57. <p>The query returned no result.</p>
  58. </div>
  59. {% endif %}
  60. {% endblock %}