Fix test dashboard: return SX wire format for SX-Request on index route
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 3m43s

Filter card links (/?filter=failed) were blanking the page because the
index route always returned full HTML, even for SX-Request. Now returns
sx_response() partial like test_detail already does.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 17:55:23 +00:00
parent a8e61dd0ea
commit 1e52bb33a6

View File

@@ -12,18 +12,29 @@ def register(url_prefix: str = "/") -> Blueprint:
@bp.get("/") @bp.get("/")
async def index(): async def index():
"""Full page dashboard with last results.""" """Full page dashboard with last results."""
from shared.sx.page import get_template_context
from shared.browser.app.csrf import generate_csrf_token from shared.browser.app.csrf import generate_csrf_token
from sxc.pages.renders import render_dashboard_page_sx from sxc.pages.renders import render_dashboard_page_sx, render_results_partial_sx
import runner import runner
ctx = await get_template_context()
result = runner.get_results() result = runner.get_results()
running = runner.is_running() running = runner.is_running()
csrf = generate_csrf_token() csrf = generate_csrf_token()
active_filter = request.args.get("filter") active_filter = request.args.get("filter")
active_service = request.args.get("service") active_service = request.args.get("service")
is_sx = bool(request.headers.get("SX-Request") or request.headers.get("HX-Request"))
if is_sx:
from shared.sx.helpers import sx_response
html = await render_results_partial_sx(
result, running, csrf,
active_filter=active_filter,
active_service=active_service,
)
return sx_response(html)
from shared.sx.page import get_template_context
ctx = await get_template_context()
html = await render_dashboard_page_sx( html = await render_dashboard_page_sx(
ctx, result, running, csrf, ctx, result, running, csrf,
active_filter=active_filter, active_filter=active_filter,