From 7fa28e8e47ef7b244a373f2e3733e0f683ae4246 Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 7 May 2026 17:03:36 +0300 Subject: [PATCH] fix: move run navigation from id link to table row --- app/static/admin.js | 12 +++++++++++- app/templates/dashboard.html | 2 +- app/templates/runs.html | 2 +- app/version.py | 6 +++--- tests/test_admin_templates.py | 16 ++++++++++++++-- tests/test_api_mcp.py | 2 +- 6 files changed, 31 insertions(+), 9 deletions(-) diff --git a/app/static/admin.js b/app/static/admin.js index fbf7d2d..433643a 100644 --- a/app/static/admin.js +++ b/app/static/admin.js @@ -62,10 +62,20 @@ } function setupClickableRows() { + const openRow = (row) => { + window.location.href = row.dataset.rowHref; + }; + document.querySelectorAll("[data-row-href]").forEach((row) => { row.addEventListener("click", (event) => { if (event.target.closest("a, button, input, select, label")) return; - window.location.href = row.dataset.rowHref; + openRow(row); + }); + row.addEventListener("keydown", (event) => { + if (!["Enter", " "].includes(event.key)) return; + if (event.target.closest("a, button, input, select, label")) return; + event.preventDefault(); + openRow(row); }); }); } diff --git a/app/templates/dashboard.html b/app/templates/dashboard.html index f0d9db0..22dd775 100644 --- a/app/templates/dashboard.html +++ b/app/templates/dashboard.html @@ -51,7 +51,7 @@ IDСтатусОбработаноОшибкиСтарт {% for run in runs %} - {{ run.id }}{{ run.status_display }}{{ run.parsed_count }}{{ run.error_count }}{{ run.started_display }} + {{ run.id }}{{ run.status_display }}{{ run.parsed_count }}{{ run.error_count }}{{ run.started_display }} {% endfor %} diff --git a/app/templates/runs.html b/app/templates/runs.html index 5ad536d..b120cd1 100644 --- a/app/templates/runs.html +++ b/app/templates/runs.html @@ -38,7 +38,7 @@ IDСтатусНайденоОбработаноНовыеОшибкиУволеныСтарт {% for run in runs %} - {{ run.id }}{{ run.status_display }}{{ run.found_count }}{{ run.parsed_count }}{{ run.new_count }}{{ run.error_count }}{{ run.dismissed_count }}{{ run.started_display }} + {{ run.id }}{{ run.status_display }}{{ run.found_count }}{{ run.parsed_count }}{{ run.new_count }}{{ run.error_count }}{{ run.dismissed_count }}{{ run.started_display }} {% endfor %} diff --git a/app/version.py b/app/version.py index 02069bb..7a20dc3 100644 --- a/app/version.py +++ b/app/version.py @@ -1,3 +1,3 @@ -APP_VERSION = "0.4.2" -FRONTEND_VERSION = "0.4.2" -BACKEND_VERSION = "0.4.2" +APP_VERSION = "0.4.3" +FRONTEND_VERSION = "0.4.3" +BACKEND_VERSION = "0.4.3" diff --git a/tests/test_admin_templates.py b/tests/test_admin_templates.py index b7250db..b9c66c7 100644 --- a/tests/test_admin_templates.py +++ b/tests/test_admin_templates.py @@ -45,8 +45,10 @@ def test_dashboard_limits_latest_runs_to_five(): def test_runs_template_links_to_run_detail(): template = Path("app/templates/runs.html").read_text(encoding="utf-8") - assert 'href="/admin/runs/{{ run.id }}"' in template assert 'data-row-href="/admin/runs/{{ run.id }}"' in template + assert 'role="link"' in template + assert 'tabindex="0"' in template + assert '' not in template def test_run_detail_template_extends_base_and_shows_change_groups(): @@ -74,4 +76,14 @@ def test_dashboard_latest_run_rows_link_to_run_detail(): template = Path("app/templates/dashboard.html").read_text(encoding="utf-8") assert 'data-row-href="/admin/runs/{{ run.id }}"' in template - assert 'href="/admin/runs/{{ run.id }}"' in template + assert 'role="link"' in template + assert 'tabindex="0"' in template + assert '' not in template + + +def test_admin_js_supports_keyboard_activation_for_clickable_rows(): + source = Path("app/static/admin.js").read_text(encoding="utf-8") + + assert 'addEventListener("keydown"' in source + assert '"Enter"' in source + assert '" "' in source diff --git a/tests/test_api_mcp.py b/tests/test_api_mcp.py index 24fcea2..5610631 100644 --- a/tests/test_api_mcp.py +++ b/tests/test_api_mcp.py @@ -23,7 +23,7 @@ def test_health_returns_versions(): response = client.get("/api/health") assert response.status_code == 200 - assert response.json()["backend_version"] == "0.4.2" + assert response.json()["backend_version"] == "0.4.3" def test_mcp_requires_token_and_lists_tools():