feat/dossiers-ngi: sticky bar vs-parent loc-on-roots split plus/minus 45rem
This commit is contained in:
parent
8cb55e57e8
commit
c14e215ad8
6 changed files with 148 additions and 85 deletions
|
|
@ -58,7 +58,8 @@ Per branch in JSON / sticky bar:
|
|||
| `tip_time` | committer time of tip (`%cI`) |
|
||||
| `built_at` | when this edition freeze was written |
|
||||
| `build_seconds` | wall time of that freeze |
|
||||
| `vs_main_plus` / `vs_main_minus` | `git diff --numstat` tip vs **main** tip (sticky bar +grün/−rot; omitted on `main` itself) |
|
||||
| `vs_parent_plus` / `vs_parent_minus` | `git diff --numstat` tip vs **parent** tip (sticky bar +grün/−rot; omitted when `parent` is empty or not in the tree, e.g. `main` and `feature/nl-net-injestion-injestor-update`) |
|
||||
| `loc` | text-file line count of the tip vs the empty tree (gray `N LOC` in the plus/minus columns; only when there is no parent) |
|
||||
|
||||
Rebuild runs **only when** `.edition-tip` ≠ current tip (timer never forces).
|
||||
Each run also: `git fetch --prune`, `worktree prune`, drop stale
|
||||
|
|
@ -105,13 +106,14 @@ rsync -avz --exclude .DS_Store "$SITE/branch-status.json" "$WWW/branch-status.js
|
|||
`bar.js` fetches `/branch-status.json` and draws:
|
||||
|
||||
```
|
||||
main sep01 16:52 8.4s sep30 15:23
|
||||
├── feat/sm-content sep30 16:11 13s sep30 15:23 +N −M
|
||||
│ └── feat/website-features …
|
||||
└── project_template sep28 15:03 2.2s sep30 15:23 +N −M
|
||||
feature/nl-net-injestion-injestor-update … N LOC
|
||||
main … N LOC
|
||||
├── feat/sm-content … +N −M # vs main
|
||||
│ └── feat/website-features … +N −M # vs sm-content
|
||||
└── project_template … +N −M # vs main
|
||||
```
|
||||
|
||||
Visible cells: name (tree prefix + branch) · tip `monDD HH:MM` · `Ns monDD HH:MM` (build seconds + freeze time) · `+N −M` vs main. No `@sha`, no `default` label (`data-default` stays for flask/cookie). The bar is **viewport-centered**, inner tree `max-width: min(80rem, 100vw − 1.5rem)` (was 45em at 11px ≈ 495px, which clipped long names). Rear cells are right-aligned `tabular-nums`. Poll every 30s **updates when/built/diff in place** when the branch structure is unchanged (no full tree remount).
|
||||
Visible cells: name (tree prefix + branch) · tip `monDD HH:MM` · `Ns monDD HH:MM` (build seconds + freeze time) · plus column · minus column. `+N −M` vs the **parent** tip, in two right-aligned columns so `+898` and `+1200` share an edge. Roots with no parent show gray `N` in the plus column and `LOC` in the minus column. No `@sha`, no `default` label (`data-default` stays for flask/cookie). Inner tree `max-width: 45rem` (same as site `#navigation` / `#content` 45em at root 16px), so names line up with About and the minus column with the page edge; below 45rem the tree is full width with a small pad. Rear cells are right-aligned `tabular-nums`. Poll every 30s **updates when/built/plus/minus in place** when the branch structure is unchanged (no full tree remount).
|
||||
|
||||
Each name links to `/_cascade/use/<edition>` (cookie + 302 `/`). Caddy map:
|
||||
|
||||
|
|
|
|||
|
|
@ -258,6 +258,17 @@ def diff_numstat(repo: Path, a: str, b: str) -> tuple[int, int]:
|
|||
return plus, minus
|
||||
|
||||
|
||||
def empty_tree_oid(repo: Path) -> str:
|
||||
cp = git(repo, "hash-object", "-t", "tree", "/dev/null")
|
||||
return (cp.stdout or "").strip()
|
||||
|
||||
|
||||
def loc_at_tip(repo: Path, tip: str, empty: str) -> int:
|
||||
"""Text-file line count of tip vs the empty tree."""
|
||||
plus, _ = diff_numstat(repo, empty, tip)
|
||||
return plus
|
||||
|
||||
|
||||
def tip_commit_time(repo: Path, tip: str) -> str:
|
||||
"""Committer ISO time of tip (empty on failure)."""
|
||||
cp = git(repo, "log", "-1", "--format=%cI", tip, check=False)
|
||||
|
|
@ -564,10 +575,7 @@ def build_payload(repo: Path, tips: dict[str, str], rebuild: bool) -> dict:
|
|||
sync_flask_alias(ed_root, tips)
|
||||
|
||||
tip_times = {name: tip_commit_time(repo, tip) for name, tip in tips.items()}
|
||||
main_tip = tips.get("main", "")
|
||||
vs_main = {
|
||||
name: diff_numstat(repo, main_tip, tip) for name, tip in tips.items()
|
||||
}
|
||||
empty = empty_tree_oid(repo)
|
||||
branches_out = []
|
||||
for row in rows:
|
||||
name = row["branch"]
|
||||
|
|
@ -593,11 +601,14 @@ def build_payload(repo: Path, tips: dict[str, str], rebuild: bool) -> dict:
|
|||
entry["built_at"] = meta["built_at"]
|
||||
if "build_seconds" in meta:
|
||||
entry["build_seconds"] = meta["build_seconds"]
|
||||
# sticky bar: +grün / −rot vs main (omit on main itself)
|
||||
if name != "main" and main_tip:
|
||||
plus, minus = vs_main.get(name, (0, 0))
|
||||
entry["vs_main_plus"] = plus
|
||||
entry["vs_main_minus"] = minus
|
||||
# sticky bar: +grün/−rot vs parent tip; gray loc when no parent in tree
|
||||
parent = row["parent"]
|
||||
if parent and parent in tips:
|
||||
plus, minus = diff_numstat(repo, tips[parent], row["tip"])
|
||||
entry["vs_parent_plus"] = plus
|
||||
entry["vs_parent_minus"] = minus
|
||||
else:
|
||||
entry["loc"] = loc_at_tip(repo, row["tip"], empty)
|
||||
branches_out.append(entry)
|
||||
|
||||
payload = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue