diff --git a/guarddog_nexus/web/routes.py b/guarddog_nexus/web/routes.py index 0430bb7..1d4593f 100644 --- a/guarddog_nexus/web/routes.py +++ b/guarddog_nexus/web/routes.py @@ -76,8 +76,10 @@ async def scans_list( scans = (await session.execute(q)).scalars().all() total = await session.scalar(count_q) + template = "_scans_table.html" if request.headers.get("HX-Request") else "scans_list.html" + return _render( - "scans_list.html", + template, scans=scans, page=page, per_page=per_page, @@ -136,8 +138,10 @@ async def packages_list( total = await session.scalar(total_q) rows = (await session.execute(rows_q)).all() + template = "_packages_table.html" if request.headers.get("HX-Request") else "packages_list.html" + return _render( - "packages_list.html", + template, packages=rows, page=page, per_page=per_page, diff --git a/guarddog_nexus/web/templates/_packages_table.html b/guarddog_nexus/web/templates/_packages_table.html new file mode 100644 index 0000000..ad7c041 --- /dev/null +++ b/guarddog_nexus/web/templates/_packages_table.html @@ -0,0 +1,61 @@ +
+ + + {% if flagged_filter == '1' %}Show all{% else %}Flagged only{% endif %} + + Export CSV +
+ +
+ + + + + + + + + + + + + + {% for p in packages %} + + + + + + + + + + {% endfor %} + {% if not packages %} + + + + {% endif %} + +
+ Name {% if sort_by == 'name' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} + VersionEcosystemRepo + Flagged {% if sort_by == 'flagged' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} + + Findings {% if sort_by == 'total_findings' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} + + Last Scan {% if sort_by == 'last_scanned_at' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} +
{{ p.pkg_name }}{{ p.pkg_ver }}{{ p.ecosystem }}{{ p.repository }}{% if p.is_flagged %}YES{% else %}No{% endif %}{{ p.findings_sum }}{{ p.last_scan.strftime('%Y-%m-%d %H:%M') if p.last_scan }}
No packages yet — packages will appear here once scans are processed.
+
+ +{% set total_pages = (total // per_page) + (1 if total % per_page else 0) %} +{% if total_pages > 1 %} + +{% endif %} +{{ total }} total packages diff --git a/guarddog_nexus/web/templates/_scans_table.html b/guarddog_nexus/web/templates/_scans_table.html new file mode 100644 index 0000000..4169c20 --- /dev/null +++ b/guarddog_nexus/web/templates/_scans_table.html @@ -0,0 +1,72 @@ +
+ + + + {% if flagged_filter == '1' %}Show all{% else %}Flagged only{% endif %} + + Export CSV +
+ +
+ + + + + + + + + + + + + + {% for s in scans %} + + + + + + + + + + {% endfor %} + {% if not scans %} + + + + {% endif %} + +
+ ID {% if sort_by == 'id' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} + + Package {% if sort_by == 'package_name' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} + VersionRepo + Status {% if sort_by == 'status' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} + + Findings {% if sort_by == 'total_findings' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} + + Time {% if sort_by == 'started_at' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} +
#{{ s.id }}{{ s.package_name }}{{ s.package_version }}{{ s.repository }} + {% if s.status == 'scanning' %}scanning{% else %}{{ s.status }}{% endif %} + {% if s.flagged %}{{ s.total_findings }}{% else %}0{% endif %}{{ s.started_at.strftime('%Y-%m-%d %H:%M') if s.started_at }}
No scans yet — scans will appear here once packages are processed.
+
+ +{% set total_pages = (total // per_page) + (1 if total % per_page else 0) %} +{% if total_pages > 1 %} + +{% endif %} +{{ total }} total scans diff --git a/guarddog_nexus/web/templates/packages_list.html b/guarddog_nexus/web/templates/packages_list.html index 730dced..2fcdd11 100644 --- a/guarddog_nexus/web/templates/packages_list.html +++ b/guarddog_nexus/web/templates/packages_list.html @@ -9,66 +9,5 @@ {% endblock %} {% block content %}

Packages

- -
- - - {% if flagged_filter == '1' %}Show all{% else %}Flagged only{% endif %} - - Export CSV -
- -
- - - - - - - - - - - - - - {% for p in packages %} - - - - - - - - - - {% endfor %} - {% if not packages %} - - - - {% endif %} - -
- Name {% if sort_by == 'name' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} - VersionEcosystemRepo - Flagged {% if sort_by == 'flagged' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} - - Findings {% if sort_by == 'total_findings' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} - - Last Scan {% if sort_by == 'last_scanned_at' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} -
{{ p.pkg_name }}{{ p.pkg_ver }}{{ p.ecosystem }}{{ p.repository }}{% if p.is_flagged %}YES{% else %}No{% endif %}{{ p.findings_sum }}{{ p.last_scan.strftime('%Y-%m-%d %H:%M') if p.last_scan }}
No packages yet — packages will appear here once scans are processed.
-
- -{% set total_pages = (total // per_page) + (1 if total % per_page else 0) %} -{% if total_pages > 1 %} - -{% endif %} -{{ total }} total packages +{% include "_packages_table.html" %} {% endblock %} diff --git a/guarddog_nexus/web/templates/scans_list.html b/guarddog_nexus/web/templates/scans_list.html index 7f01cb7..8691f5e 100644 --- a/guarddog_nexus/web/templates/scans_list.html +++ b/guarddog_nexus/web/templates/scans_list.html @@ -9,77 +9,5 @@ {% endblock %} {% block content %}

Scans

- -
- - - - {% if flagged_filter == '1' %}Show all{% else %}Flagged only{% endif %} - - Export CSV -
- -
- - - - - - - - - - - - - - {% for s in scans %} - - - - - - - - - - {% endfor %} - {% if not scans %} - - - - {% endif %} - -
- ID {% if sort_by == 'id' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} - - Package {% if sort_by == 'package_name' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} - VersionRepo - Status {% if sort_by == 'status' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} - - Findings {% if sort_by == 'total_findings' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} - - Time {% if sort_by == 'started_at' %}{{ '▲' if sort_dir == 'asc' else '▼' }}{% else %}↕{% endif %} -
#{{ s.id }}{{ s.package_name }}{{ s.package_version }}{{ s.repository }} - {% if s.status == 'scanning' %}scanning{% else %}{{ s.status }}{% endif %} - {% if s.flagged %}{{ s.total_findings }}{% else %}0{% endif %}{{ s.started_at.strftime('%Y-%m-%d %H:%M') if s.started_at }}
No scans yet — scans will appear here once packages are processed.
-
- -{% set total_pages = (total // per_page) + (1 if total % per_page else 0) %} -{% if total_pages > 1 %} - -{% endif %} -{{ total }} total scans +{% include "_scans_table.html" %} {% endblock %}