diff --git a/app/dependencies.py b/app/dependencies.py index 44860e1..5a98ac3 100644 --- a/app/dependencies.py +++ b/app/dependencies.py @@ -139,3 +139,48 @@ def get_cache_service(): cache_manager=get_cache_manager(), database=get_database(), ) + + +async def get_nav_counts(actor_id: Optional[str] = None) -> dict: + """ + Get counts for navigation bar display. + + Returns dict with: runs, recipes, effects, media, storage + """ + counts = {} + + try: + import database + counts["media"] = await database.count_user_items(actor_id) if actor_id else 0 + except Exception: + pass + + try: + recipe_service = get_recipe_service() + recipes = await recipe_service.list_recipes(actor_id) + counts["recipes"] = len(recipes) + except Exception: + pass + + try: + run_service = get_run_service() + runs = await run_service.list_runs(actor_id) + counts["runs"] = len(runs) + except Exception: + pass + + try: + cache_mgr = get_cache_manager() + effects = cache_mgr.list_by_type('effect') + counts["effects"] = len(effects) + except Exception: + pass + + try: + import database + storage_providers = await database.get_user_storage_providers(actor_id) if actor_id else [] + counts["storage"] = len(storage_providers) if storage_providers else 0 + except Exception: + pass + + return counts diff --git a/app/routers/home.py b/app/routers/home.py index a7a1704..9ecbef2 100644 --- a/app/routers/home.py +++ b/app/routers/home.py @@ -77,6 +77,7 @@ async def home(request: Request): user=user, readme_html=readme_html, stats=stats, + nav_counts=stats, # Reuse stats for nav counts active_tab="home", ) diff --git a/app/templates/base.html b/app/templates/base.html index 04deecc..4c44e8d 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -4,11 +4,11 @@ {% block nav_items %} {% endblock %} diff --git a/app/templates/runs/detail.html b/app/templates/runs/detail.html index 9be1b2d..916fc6f 100644 --- a/app/templates/runs/detail.html +++ b/app/templates/runs/detail.html @@ -37,12 +37,20 @@
Recipe
-
{{ run.recipe_name or run.recipe[:16] ~ '...' if run.recipe and run.recipe|length > 16 else run.recipe or 'Unknown' }}
+
+ {% if run.recipe %} + + {{ run.recipe_name or (run.recipe[:16] ~ '...') }} + + {% else %} + Unknown + {% endif %} +
Steps
- {{ run.executed or 0 }} / {{ run.total_steps or '?' }} + {{ run.executed or 0 }} / {{ run.total_steps or (plan.steps|length if plan and plan.steps else '?') }} {% if run.cached_steps %} ({{ run.cached_steps }} cached) {% endif %}