mirror of
https://github.com/basnijholt/compose-farm.git
synced 2026-02-03 06:03:25 +00:00
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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user