fix(ui): фильтр-бар больше не в htmx-фрагменте — не дублируется
Фильтр-бар вынесен из _scans_table.html / _packages_table.html в scans_list.html / packages_list.html — вне htmx target. htmx заменяет только таблицу, фильтр остаётся на месте.
This commit is contained in:
@@ -1,12 +1,3 @@
|
||||
<div class="filter-bar">
|
||||
<input type="text" id="search-input" placeholder="Search packages..." value="{{ search }}" hx-get="/packages" hx-trigger="input changed, keyup[entered] delay:300ms" hx-target="#packages-table-container" hx-swap="innerHTML">
|
||||
<a href="?flagged={% if flagged_filter == '1' %}0{% else %}1{% endif %}" role="button" class="outline">
|
||||
{% if flagged_filter == '1' %}Show all{% else %}Flagged only{% endif %}
|
||||
</a>
|
||||
<a href="/api/v1/packages/export?flagged={{ flagged_filter }}&search={{ search }}" role="button" class="outline">Export CSV</a>
|
||||
</div>
|
||||
|
||||
<div id="packages-table-container">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -46,7 +37,6 @@
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% set total_pages = (total // per_page) + (1 if total % per_page else 0) %}
|
||||
{% if total_pages > 1 %}
|
||||
|
||||
@@ -1,19 +1,3 @@
|
||||
<div class="filter-bar">
|
||||
<input type="text" id="search-input" placeholder="Search packages..." value="{{ search }}" hx-get="/scans" hx-trigger="input changed, keyup[entered] delay:300ms" hx-target="#scans-table-container" hx-swap="innerHTML">
|
||||
<select id="status-filter" hx-get="/scans" hx-trigger="change" hx-target="#scans-table-container" hx-swap="innerHTML">
|
||||
<option value="">All Statuses</option>
|
||||
<option value="pending" {% if status_filter == 'pending' %}selected{% endif %}>Pending</option>
|
||||
<option value="scanning" {% if status_filter == 'scanning' %}selected{% endif %}>Scanning</option>
|
||||
<option value="completed" {% if status_filter == 'completed' %}selected{% endif %}>Completed</option>
|
||||
<option value="failed" {% if status_filter == 'failed' %}selected{% endif %}>Failed</option>
|
||||
</select>
|
||||
<a href="?flagged={% if flagged_filter == '1' %}0{% else %}1{% endif %}" role="button" class="outline">
|
||||
{% if flagged_filter == '1' %}Show all{% else %}Flagged only{% endif %}
|
||||
</a>
|
||||
<a href="/api/v1/scans/export?flagged={{ flagged_filter }}&search={{ search }}&status={{ status_filter }}" role="button" class="outline">Export CSV</a>
|
||||
</div>
|
||||
|
||||
<div id="scans-table-container">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -57,7 +41,6 @@
|
||||
{% endif %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
{% set total_pages = (total // per_page) + (1 if total % per_page else 0) %}
|
||||
{% if total_pages > 1 %}
|
||||
|
||||
@@ -9,5 +9,16 @@
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<h1>Packages</h1>
|
||||
|
||||
<div class="filter-bar">
|
||||
<input type="text" id="search-input" placeholder="Search packages..." value="{{ search }}" hx-get="/packages" hx-trigger="input changed, keyup[entered] delay:300ms" hx-target="#packages-table-container" hx-swap="innerHTML">
|
||||
<a href="?flagged={% if flagged_filter == '1' %}0{% else %}1{% endif %}" role="button" class="outline">
|
||||
{% if flagged_filter == '1' %}Show all{% else %}Flagged only{% endif %}
|
||||
</a>
|
||||
<a href="/api/v1/packages/export?flagged={{ flagged_filter }}&search={{ search }}" role="button" class="outline">Export CSV</a>
|
||||
</div>
|
||||
|
||||
<div id="packages-table-container">
|
||||
{% include "_packages_table.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
@@ -9,5 +9,23 @@
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<h1>Scans</h1>
|
||||
|
||||
<div class="filter-bar">
|
||||
<input type="text" id="search-input" placeholder="Search packages..." value="{{ search }}" hx-get="/scans" hx-trigger="input changed, keyup[entered] delay:300ms" hx-target="#scans-table-container" hx-swap="innerHTML">
|
||||
<select id="status-filter" hx-get="/scans" hx-trigger="change" hx-target="#scans-table-container" hx-swap="innerHTML">
|
||||
<option value="">All Statuses</option>
|
||||
<option value="pending" {% if status_filter == 'pending' %}selected{% endif %}>Pending</option>
|
||||
<option value="scanning" {% if status_filter == 'scanning' %}selected{% endif %}>Scanning</option>
|
||||
<option value="completed" {% if status_filter == 'completed' %}selected{% endif %}>Completed</option>
|
||||
<option value="failed" {% if status_filter == 'failed' %}selected{% endif %}>Failed</option>
|
||||
</select>
|
||||
<a href="?flagged={% if flagged_filter == '1' %}0{% else %}1{% endif %}" role="button" class="outline">
|
||||
{% if flagged_filter == '1' %}Show all{% else %}Flagged only{% endif %}
|
||||
</a>
|
||||
<a href="/api/v1/scans/export?flagged={{ flagged_filter }}&search={{ search }}&status={{ status_filter }}" role="button" class="outline">Export CSV</a>
|
||||
</div>
|
||||
|
||||
<div id="scans-table-container">
|
||||
{% include "_scans_table.html" %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user