From a1c84e15f1c3fb2c7be63c90a76de85509a8a5bd Mon Sep 17 00:00:00 2001 From: Shiv Tyagi Date: Wed, 4 Feb 2026 21:47:21 +0530 Subject: [PATCH] web: remove viewlog route, use root with build_id param instead There is no advantage of an extra route to open the same page. The query parameter on main route should do. --- web/static/js/add_build.js | 2 +- web/templates/index.html | 6 +++--- web/ui/router.py | 25 ++++--------------------- 3 files changed, 8 insertions(+), 25 deletions(-) diff --git a/web/static/js/add_build.js b/web/static/js/add_build.js index b3caba8..4b298d8 100644 --- a/web/static/js/add_build.js +++ b/web/static/js/add_build.js @@ -719,7 +719,7 @@ async function handleFormSubmit(event) { const result = await response.json(); // Redirect to viewlog page - window.location.href = `/viewlog/${result.build_id}`; + window.location.href = `/?build_id=${result.build_id}`; } catch (error) { console.error('Error submitting build:', error); diff --git a/web/templates/index.html b/web/templates/index.html index d9436b7..4789d51 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -127,12 +127,12 @@ - {% if token != None %} + {% if build_id != None %} {% endif %} diff --git a/web/ui/router.py b/web/ui/router.py index c8a87f6..fe00662 100644 --- a/web/ui/router.py +++ b/web/ui/router.py @@ -14,38 +14,21 @@ @router.get("/", response_class=HTMLResponse) -async def index(request: Request, token: str = None): +async def index(request: Request, build_id: str = None): """ Render the main index page showing all builds. Args: request: FastAPI Request object - token: Optional build token to automatically show log modal + build_id: Optional build ID to automatically show log modal and + trigger artifact download on build completion Returns: Rendered HTML template """ return templates.TemplateResponse( "index.html", - {"request": request, "token": token} - ) - - -@router.get("/viewlog/{token}", response_class=HTMLResponse) -async def viewlog(request: Request, token: str): - """ - Render the index page with a specific build log open. - - Args: - request: FastAPI Request object - token: Build ID to show log for - - Returns: - Rendered HTML template with token - """ - return templates.TemplateResponse( - "index.html", - {"request": request, "token": token} + {"request": request, "build_id": build_id} )