feat(templates): add pagination with total counts to catalog and campaign picker
Aegis CI / lint-and-test (push) Has been cancelled
Snyk Security Scan / Python vulnerabilities (backend) (push) Has been cancelled
Snyk Security Scan / npm vulnerabilities (frontend) (push) Has been cancelled
Snyk Security Scan / Docker image vulnerabilities (backend) (push) Has been cancelled

Test Catalog's pagination showed only 'Page N' with no way to know
how many pages existed, and the campaign 'Add Test' modal's template
picker had no pagination at all — with 2800+ templates in the
catalog, its flat 100-row fetch made most templates unreachable
unless a search happened to match. Adds GET /test-templates/count
(open to any authenticated user, mirrors the list endpoint's filters)
and wires real 'Page N of M' + total-available counts into both.
This commit is contained in:
kitos
2026-07-16 10:01:20 +02:00
parent 8493a6a764
commit 0002601b50
8 changed files with 269 additions and 59 deletions
+5 -2
View File
@@ -147,8 +147,11 @@ def test_list_templates_with_filters():
assert "search" in source, "List must accept search filter"
assert "mitre_technique_id" in source, "List must accept mitre_technique_id filter"
# Verify ilike is used for search
assert "ilike" in source, "Search should use ilike for case-insensitive matching"
# Verify ilike is used for search — lives in the shared
# _build_template_query() helper now, reused by list and count.
from app.services.test_template_service import _build_template_query
assert "ilike" in inspect.getsource(_build_template_query), \
"Search should use ilike for case-insensitive matching"
# ===========================================================================