fix(ui): фильтр-бар больше не в htmx-фрагменте — не дублируется

Фильтр-бар вынесен из _scans_table.html / _packages_table.html
в scans_list.html / packages_list.html — вне htmx target.
htmx заменяет только таблицу, фильтр остаётся на месте.
This commit is contained in:
Marker689
2026-05-10 06:14:10 +03:00
parent c4c27deb79
commit ab60d1944d
4 changed files with 29 additions and 27 deletions

View File

@@ -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> <table>
<thead> <thead>
<tr> <tr>
@@ -46,7 +37,6 @@
{% endif %} {% endif %}
</tbody> </tbody>
</table> </table>
</div>
{% set total_pages = (total // per_page) + (1 if total % per_page else 0) %} {% set total_pages = (total // per_page) + (1 if total % per_page else 0) %}
{% if total_pages > 1 %} {% if total_pages > 1 %}

View File

@@ -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> <table>
<thead> <thead>
<tr> <tr>
@@ -57,7 +41,6 @@
{% endif %} {% endif %}
</tbody> </tbody>
</table> </table>
</div>
{% set total_pages = (total // per_page) + (1 if total % per_page else 0) %} {% set total_pages = (total // per_page) + (1 if total % per_page else 0) %}
{% if total_pages > 1 %} {% if total_pages > 1 %}

View File

@@ -9,5 +9,16 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1>Packages</h1> <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" %} {% include "_packages_table.html" %}
</div>
{% endblock %} {% endblock %}

View File

@@ -9,5 +9,23 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h1>Scans</h1> <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" %} {% include "_scans_table.html" %}
</div>
{% endblock %} {% endblock %}