Remove unnecessary redirect routes, fix template links

- Removed /run/{id} and /recipe/{id} redirect routes
- Updated templates to use /runs/ and /recipes/ paths

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
gilesb
2026-01-11 18:05:24 +00:00
parent 6c73a06539
commit e806337503
4 changed files with 4 additions and 21 deletions

View File

@@ -65,26 +65,9 @@ def create_app() -> FastAPI:
app.include_router(storage.router, prefix="/storage", tags=["storage"])
app.include_router(api.router, prefix="/api", tags=["api"])
# Runs router - handles both /runs and /run/{id} patterns
# Runs and recipes routers
app.include_router(runs.router, prefix="/runs", tags=["runs"])
# Also mount at /run for single-run detail URLs
from fastapi import APIRouter
from .dependencies import get_run_service, get_recipe_service
run_detail_router = APIRouter()
@run_detail_router.get("/{run_id}")
async def run_detail_redirect(run_id: str, request: Request):
from .routers.runs import run_detail
return await run_detail(run_id, request, run_service=get_run_service())
app.include_router(run_detail_router, prefix="/run", tags=["runs"])
# Recipes router - handles both /recipes and /recipe/{id} patterns
app.include_router(recipes.router, prefix="/recipes", tags=["recipes"])
recipe_detail_router = APIRouter()
@recipe_detail_router.get("/{recipe_id}")
async def recipe_detail_redirect(recipe_id: str, request: Request):
from .routers.recipes import get_recipe
return await get_recipe(recipe_id, request, recipe_service=get_recipe_service())
app.include_router(recipe_detail_router, prefix="/recipe", tags=["recipes"])
# Cache router - handles /cache and /media
app.include_router(cache.router, prefix="/cache", tags=["cache"])

View File

@@ -79,7 +79,7 @@
<h2 class="text-lg font-semibold mb-4">Related Runs</h2>
<div class="space-y-2">
{% for run in cache.runs %}
<a href="/run/{{ run.run_id }}"
<a href="/runs/{{ run.run_id }}"
class="block bg-gray-800 rounded p-3 hover:bg-gray-750 transition-colors">
<div class="flex items-center justify-between">
<span class="font-mono text-sm">{{ run.run_id[:16] }}...</span>

View File

@@ -15,7 +15,7 @@
{% if recipes %}
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
{% for recipe in recipes %}
<a href="/recipe/{{ recipe.recipe_id }}"
<a href="/recipes/{{ recipe.recipe_id }}"
class="bg-gray-800 border border-gray-700 rounded-lg p-4 hover:border-gray-600 transition-colors">
<div class="flex items-center justify-between mb-2">
<span class="font-medium text-white">{{ recipe.name }}</span>

View File

@@ -8,7 +8,7 @@
} %}
{% set color = status_colors.get(run.status, 'gray') %}
<a href="/run/{{ run.run_id }}"
<a href="/runs/{{ run.run_id }}"
class="block bg-gray-800 border border-gray-700 rounded-lg p-4 hover:border-gray-600 transition-colors">
<div class="flex items-center justify-between mb-2">
<div class="flex items-center space-x-3">