feat(0.34.0): vue « En vol partout » /inflight (issue #24)
CI / test (push) Successful in 2m24s
CI / test (push) Successful in 2m24s
- L'encours (colonnes en vol de l'espace) tous projets actifs, regroupé PAR colonne, trié par âge décroissant dans la colonne (pipeline _card_ages du board). - En-tête : total + compteurs par colonne + limite WIP globale (somme des projets qui en définissent). - Entrées Pilotage (menu latéral) et palette Ctrl+K ; SSE /api/stream via live.js comme les autres vues. - Réutilise _collect_focus_groups : aucun appel forge en plus. 286 tests verts (5 nouveaux, palier 23) ; vérifié en Chromium réel (356 cartes en vol sur les vraies données, dont la carte #24 elle-même).
This commit is contained in:
+83
@@ -2118,6 +2118,7 @@ _NAV_BY_TEMPLATE = {
|
||||
"capture.html": "capture",
|
||||
"digest.html": "digest",
|
||||
"forecast.html": "forecast",
|
||||
"inflight.html": "inflight",
|
||||
"rules.html": "rules",
|
||||
"health.html": "health",
|
||||
"health_project.html": "health",
|
||||
@@ -4030,6 +4031,88 @@ async def focus(request: Request):
|
||||
)
|
||||
|
||||
|
||||
async def _collect_inflight(ws_repos, ws_id: int) -> dict:
|
||||
"""The work in flight, grouped BY COLUMN (issue #24).
|
||||
|
||||
Reuses the Focus pipeline (per-project groups of cards in
|
||||
the workspace's in-flight columns), then pivots: one group
|
||||
per column, cards sorted by age in column, oldest first —
|
||||
the oldest cards are the signal. Ages come from the same
|
||||
_card_ages pipeline as the board.
|
||||
"""
|
||||
per_repo = await _collect_focus_groups(ws_repos, ws_id)
|
||||
columns: dict[str, list[dict]] = {
|
||||
key: [] for key in bcols.focus_keys(ws_id)
|
||||
}
|
||||
for group in per_repo:
|
||||
full_name = group["full_name"]
|
||||
cid = group.get("conn_id", registry.default_id)
|
||||
open_issues = [c["issue"] for c in group["cards"]]
|
||||
board = get_board_state(
|
||||
full_name, workspace_id=ws_id, connection_id=cid
|
||||
)
|
||||
ages = _card_ages(
|
||||
full_name, open_issues, board,
|
||||
workspace_id=ws_id, connection_id=cid,
|
||||
)
|
||||
for card in group["cards"]:
|
||||
age = ages.get(card["issue"]["number"]) or {}
|
||||
columns.setdefault(card["column"], []).append(
|
||||
{
|
||||
"issue": card["issue"],
|
||||
"repo": full_name,
|
||||
"column": card["column"],
|
||||
"age_days": age.get("days", 0),
|
||||
"age_since": age.get("since", ""),
|
||||
}
|
||||
)
|
||||
groups = []
|
||||
total = 0
|
||||
for key in bcols.keys(ws_id):
|
||||
cards = columns.get(key)
|
||||
if not cards:
|
||||
continue
|
||||
cards.sort(key=lambda c: (-c["age_days"], c["repo"], c["issue"]["number"]))
|
||||
groups.append({"column": key, "cards": cards})
|
||||
total += len(cards)
|
||||
for key, cards in columns.items():
|
||||
if key not in {g["column"] for g in groups} and cards:
|
||||
cards.sort(key=lambda c: (-c["age_days"], c["repo"], c["issue"]["number"]))
|
||||
groups.append({"column": key, "cards": cards})
|
||||
total += len(cards)
|
||||
# Limites WIP globales lisibles : somme, par colonne, des
|
||||
# limites définies dans les projets (0.33.0 : lecture seule).
|
||||
settings = get_settings()
|
||||
wip_globals: dict[str, int] = {}
|
||||
for _repo, limits in (settings.wip_limits or {}).items():
|
||||
for col, limit in (limits or {}).items():
|
||||
try:
|
||||
wip_globals[col] = wip_globals.get(col, 0) + int(limit)
|
||||
except (TypeError, ValueError):
|
||||
continue
|
||||
wip_globals = {c: v for c, v in wip_globals.items() if v > 0}
|
||||
return {"groups": groups, "total": total, "wip_globals": wip_globals}
|
||||
|
||||
|
||||
@app.get("/inflight", response_class=HTMLResponse)
|
||||
async def inflight(request: Request):
|
||||
"""Everything in flight, all projects, grouped by column (#24)."""
|
||||
workspace, _role = _current_workspace(request)
|
||||
ws_id = workspace["id"] if workspace else 1
|
||||
ws_repos, _ws = await _workspace_repos(request)
|
||||
data = await _collect_inflight(ws_repos, ws_id)
|
||||
return render(
|
||||
request,
|
||||
"inflight.html",
|
||||
groups=data["groups"],
|
||||
total=data["total"],
|
||||
wip_globals=data["wip_globals"],
|
||||
column_labels=bcols.names(ws_id),
|
||||
column_colors=bcols.colors(ws_id),
|
||||
aging_days=get_settings().aging_days,
|
||||
)
|
||||
|
||||
|
||||
def _group_issue_results(issues: list[dict]) -> list[dict]:
|
||||
"""Group search results by repo, annotated with the board column."""
|
||||
by_repo: dict[str, list[dict]] = {}
|
||||
|
||||
Reference in New Issue
Block a user