feat(0.34.0): vue « En vol partout » /inflight (issue #24)
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:
Spark
2026-10-26 10:48:45 -04:00
parent dfb4e595ff
commit 8c889878ee
9 changed files with 274 additions and 2 deletions
+1 -1
View File
@@ -177,7 +177,7 @@ from urllib.parse import urlparse
BASE_DIR = Path(__file__).resolve().parent.parent
APP_VERSION = "0.33.0"
APP_VERSION = "0.34.0"
def _env_bool(name: str, default: bool) -> bool:
+83
View File
@@ -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]] = {}
+1
View File
@@ -20,6 +20,7 @@
("digest", "/digest", "🧠", "Digest"),
]),
("pilotage", "Pilotage", [
("inflight", "/inflight", "🛩️", "En vol"),
("forecast", "/forecast", "🔮", "Prévisions"),
("health", "/health", "🩺", "Santé"),
("rules", "/rules", "⚙️", "Règles"),
+81
View File
@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html lang="fr" data-theme="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>En vol partout — Kanbante</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🛩️</text></svg>">
<link rel="stylesheet" href="/static/css/style.css?v={{ version }}">
</head>
<body>
{% include "_header.html" %}
<main class="focus-main">
<p class="focus-intro">Tout ce qui est <strong>en vol</strong>, tous projets actifs confondus —
regroupé par colonne, les cartes les plus anciennes d'abord.</p>
<div class="inflight-summary">
<span class="inflight-total">🛩️ {{ total }} carte{{ 's' if total != 1 }} en vol</span>
{% for group in groups %}
<span class="col-chip" style="background: {{ column_colors[group.column] }}20; color: {{ column_colors[group.column] }}">
{{ column_labels[group.column] }} · {{ group.cards|length }}{% if wip_globals.get(group.column) %} / limite globale {{ wip_globals[group.column] }}{% endif %}
</span>
{% endfor %}
</div>
{% if not groups %}
<p class="focus-empty">🎉 Rien en vol pour le moment — aucun encours, aucune révision en attente.</p>
{% endif %}
{% for group in groups %}
<section class="focus-group">
<h2>
<span class="filter-chip-dot" style="background: {{ column_colors[group.column] }}"></span>
{{ column_labels[group.column] }}
<span class="badge secondary">{{ group.cards|length }}</span>
{% if wip_globals.get(group.column) %}
<span class="inflight-wip">limite WIP globale : {{ wip_globals[group.column] }} (somme des projets qui en définissent une)</span>
{% endif %}
</h2>
<div class="focus-cards">
{% for card in group.cards %}
<div class="kanban-card focus-card">
<div class="card-id">
#{{ card.issue.number }}
<a class="inflight-repo" href="/board/{{ card.repo }}">{{ card.repo }}</a>
{% if card.issue.html_url %}
<a href="{{ card.issue.html_url }}" target="_blank" title="Ouvrir dans Gitea">↗</a>
{% endif %}
</div>
<div class="card-title">{{ card.issue.title }}</div>
{% if card.issue.labels %}
<div class="card-labels">
{% for label in card.issue.labels %}
<span class="label-tag" style="background: #{{ label.color }}30; color: #{{ label.color }}">
{{ label.name }}
</span>
{% endfor %}
</div>
{% endif %}
<div class="card-meta">
{% if card.issue.assignee %}
<img src="{{ card.issue.assignee.avatar_url }}" class="avatar" alt="{{ card.issue.assignee.login }}">
{% endif %}
<span class="age-badge{% if card.age_days >= aging_days * 2 %} stale{% elif card.age_days >= aging_days %} warn{% endif %}"
title="Dans cette colonne depuis le {{ card.age_since[:10] }}">⏳ {{ card.age_days }} j dans la colonne</span>
</div>
</div>
{% endfor %}
</div>
</section>
{% endfor %}
</main>
<footer>
Kanbante v{{ version }} · en vol partout
</footer>
<script src="/static/js/live.js" defer></script>
{% include "_palette.html" %}
<script src="/static/js/palette.js" defer></script>
</body>
</html>