fix(web): exclude orphaned stacks from running count (#119)

The dashboard showed "stopped: -1" when orphaned stacks existed because
running_count included stacks in state but removed from config. Now only
stacks that are both in config AND deployed are counted as running.
This commit is contained in:
Bas Nijholt
2025-12-21 21:59:05 -08:00
committed by GitHub
parent 5ddbdcdf9e
commit 56d64bfe7a

View File

@@ -91,8 +91,8 @@ async def index(request: Request) -> HTMLResponse:
# Get state
deployed = load_state(config)
# Stats
running_count = len(deployed)
# Stats (only count stacks that are both in config AND deployed)
running_count = sum(1 for stack in deployed if stack in config.stacks)
stopped_count = len(config.stacks) - running_count
# Pending operations
@@ -250,7 +250,8 @@ async def stats_partial(request: Request) -> HTMLResponse:
templates = get_templates()
deployed = load_state(config)
running_count = len(deployed)
# Only count stacks that are both in config AND deployed
running_count = sum(1 for stack in deployed if stack in config.stacks)
stopped_count = len(config.stacks) - running_count
return templates.TemplateResponse(