Skip to content

Commit

Permalink
update search UI
Browse files Browse the repository at this point in the history
  • Loading branch information
HeahDude committed Aug 28, 2022
1 parent 0ec9761 commit 23d46cb
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ public function searchAction(Request $request): Response
'start' => $start,
'end' => $end,
'limit' => $limit,
'type' => $profileType,
]), 302, ['Content-Type' => 'text/html']);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
{% block sidebar_shortcuts_links %}
<div class="shortcuts">
<a class="btn btn-link" href="{{ path('_profiler_search', { limit: 10, type: profile_type }) }}">Last 10</a>
<a class="btn btn-link" href="{{ path('_profiler', { token: 'latest' }|merge(request.query.all)) }}">Latest</a>
<a class="btn btn-link" href="{{ path('_profiler', { token: 'latest', type: profile_type }|merge(request.query.all)) }}">Latest</a>

<a class="sf-toggle btn btn-link" data-toggle-selector="#sidebar-search" {% if tokens is defined or about is defined %}data-toggle-initial="display"{% endif %}>
{{ source('@WebProfiler/Icon/search.svg') }} <span class="hidden-small">Search</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,38 @@
<thead>
<tr>
<th scope="col" class="text-center">Status</th>
<th scope="col">IP</th>
<th scope="col">Method</th>
<th scope="col">URL</th>
<th scope="col">
{% if 'command' == profile_type %}
Application
{% else %}
IP
{% endif %}
</th>
<th scope="col">
{% if 'command' == profile_type %}
Mode
{% else %}
Method
{% endif %}
</th>
<th scope="col">
{% if 'command' == profile_type %}
Command
{% else %}
URL
{% endif %}
</th>
<th scope="col">Time</th>
<th scope="col">Token</th>
</tr>
</thead>
<tbody>
{% for result in tokens %}
{% set css_class = result.status_code|default(0) > 399 ? 'status-error' : result.status_code|default(0) > 299 ? 'status-warning' : 'status-success' %}
{% if 'command' == profile_type %}
{% set css_class = result.status_code == 113 ? 'status-warning' : result.status_code > 0 ? 'status-error' : 'status-success' %}
{% else %}
{% set css_class = result.status_code|default(0) > 399 ? 'status-error' : result.status_code|default(0) > 299 ? 'status-warning' : 'status-success' %}
{% endif %}

<tr>
<td class="text-center">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,60 @@
<div id="sidebar-search" class="{{ render_hidden_by_default is not defined or render_hidden_by_default ? 'hidden' }}">
<form action="{{ path('_profiler_search') }}" method="get">
<div class="form-group">
<label for="ip">IP</label>
<label for="ip">
{% if 'command' == profile_type %}
Application
{% else %}
IP
{% endif %}
</label>
<input type="text" name="ip" id="ip" value="{{ ip }}">
</div>

<div class="form-group-row">
<div class="form-group">
<label for="method">Method</label>
<label for="method">
{% if 'command' == profile_type %}
Mode
{% else %}
Method
{% endif %}
</label>
<select name="method" id="method">
<option value="">Any</option>
{% for m in ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'] %}
{% if 'command' == profile_type %}
{% set methods = ['BATCH', 'INTERACTIVE'] %}
{% else %}
{% set methods = ['DELETE', 'GET', 'HEAD', 'PATCH', 'POST', 'PUT'] %}
{% endif %}
{% for m in methods %}
<option {{ m == method ? 'selected="selected"' }}>{{ m }}</option>
{% endfor %}
</select>
</div>

<div class="form-group">
<label for="status_code">Status</label>
<input type="number" name="status_code" id="status_code" min="100" max="599" value="{{ status_code }}">
<label for="status_code">
{% if 'command' == profile_type %}
Exit code
{% set min_and_max = 'min=%d max=%d'|format(0, 255) %}
{% else %}
Status
{% set min_and_max = 'min=%d max=%d'|format(100, 599) %}
{% endif %}
</label>
<input type="number" name="status_code" id="status_code" {{ min_and_max }} value="{{ status_code }}">
</div>
</div>

<div class="form-group">
<label for="url">URL</label>
<label for="url">
{% if 'command' == profile_type %}
Command
{% else %}
URL
{% endif %}
</label>
<input type="text" name="url" id="url" value="{{ url }}">
</div>

Expand Down

0 comments on commit 23d46cb

Please sign in to comment.