Add effects count to home page dashboard
- Add Effects card to home page grid (now 3 columns)
- Add stats["effects"] count from cache.list_by_type('effect')
- Add tests for home page effects display
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -65,6 +65,12 @@ async def home(request: Request):
|
||||
stats["storage"] = len(storage_providers) if storage_providers else 0
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
from ..dependencies import get_cache_manager
|
||||
effects = get_cache_manager().list_by_type('effect')
|
||||
stats["effects"] = len(effects)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
templates = get_templates(request)
|
||||
return render(templates, "home.html", request,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<h1 class="text-4xl font-bold mb-4">Art-DAG L1</h1>
|
||||
<p class="text-xl text-gray-400 mb-8">Content-Addressable Media Processing</p>
|
||||
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-6 max-w-2xl mx-auto mb-12">
|
||||
<div class="grid grid-cols-1 md:grid-cols-3 gap-6 max-w-3xl mx-auto mb-12">
|
||||
<a href="/runs"
|
||||
class="bg-gray-800 border border-gray-700 rounded-lg p-6 hover:border-blue-500 transition-colors">
|
||||
<div class="text-blue-400 text-3xl font-bold mb-2">{{ stats.runs or 0 }}</div>
|
||||
@@ -18,6 +18,11 @@
|
||||
<div class="text-green-400 text-3xl font-bold mb-2">{{ stats.recipes or 0 }}</div>
|
||||
<div class="text-gray-400">Recipes</div>
|
||||
</a>
|
||||
<a href="/effects"
|
||||
class="bg-gray-800 border border-gray-700 rounded-lg p-6 hover:border-cyan-500 transition-colors">
|
||||
<div class="text-cyan-400 text-3xl font-bold mb-2">{{ stats.effects or 0 }}</div>
|
||||
<div class="text-gray-400">Effects</div>
|
||||
</a>
|
||||
<a href="/media"
|
||||
class="bg-gray-800 border border-gray-700 rounded-lg p-6 hover:border-purple-500 transition-colors">
|
||||
<div class="text-purple-400 text-3xl font-bold mb-2">{{ stats.media or 0 }}</div>
|
||||
|
||||
@@ -235,6 +235,28 @@ def process_frame(frame, params, state):
|
||||
assert "multi-line" in meta["description"]
|
||||
|
||||
|
||||
class TestHomePageEffectsCount:
|
||||
"""Test that effects count is shown on home page."""
|
||||
|
||||
def test_home_template_has_effects_card(self) -> None:
|
||||
"""Home page should display effects count."""
|
||||
path = Path('/home/giles/art/art-celery/app/templates/home.html')
|
||||
content = path.read_text()
|
||||
|
||||
assert 'stats.effects' in content, \
|
||||
"Home page should display stats.effects count"
|
||||
assert 'href="/effects"' in content, \
|
||||
"Home page should link to /effects"
|
||||
|
||||
def test_home_route_provides_effects_count(self) -> None:
|
||||
"""Home route should provide effects count in stats."""
|
||||
path = Path('/home/giles/art/art-celery/app/routers/home.py')
|
||||
content = path.read_text()
|
||||
|
||||
assert 'stats["effects"]' in content, \
|
||||
"Home route should populate stats['effects']"
|
||||
|
||||
|
||||
class TestNavigationIncludesEffects:
|
||||
"""Test that Effects link is in navigation."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user