diff --git a/app/nullius/progress.py b/app/nullius/progress.py index 1208bb1f..8aa2d26c 100644 --- a/app/nullius/progress.py +++ b/app/nullius/progress.py @@ -52,6 +52,8 @@ _WORD = re.compile(r'([A-Za-z_][A-Za-z0-9_]*)=("(?:[^"\\]|\\.)*"|\S*)') _BARE = re.compile(r'^[^\s"=]+$') +# an image digest, shown short as ``docker images`` does: its first 12 hex +_DIGEST = re.compile(r"(sha256:[0-9a-f]{12})[0-9a-f]{52}") def _value(v) -> str: @@ -269,13 +271,16 @@ def fold(events: Iterable[dict]) -> dict: if key != st and st in stages and stages[st]["state"] == "waiting": stages = {(key if k == st else k): v for k, v in stages.items()} stages[key]["key"] = key - stages.setdefault(key, {"key": key, "stage": st, "label": label(ev), "state": "waiting"}) + stages.setdefault(key, {"key": key, "stage": st, "state": "waiting"}) row = stages[key] if state == "start": # A later part or retry starts this stage afresh. for field in ("seconds", "bytes", "total", "detail"): row.pop(field, None) - row["label"] = label(ev) + full = label(ev) + row["label"] = _DIGEST.sub(r"\1", full) + if row["label"] != full: + row["full"] = full if ev.get("detail") is not None: row["detail"] = ev["detail"] if state == "start": diff --git a/app/static/runs/board.js b/app/static/runs/board.js index d15aea2b..249a53d1 100644 --- a/app/static/runs/board.js +++ b/app/static/runs/board.js @@ -128,6 +128,12 @@ r.style.transition = 'transform .28s var(--ease)'; r.style.transform = ''; }); })); + // a split that would open past the window's right edge (a narrow screen) opens leftwards instead + $$('.pop', page).forEach(d => d.addEventListener('toggle', () => { + const m = $('.popm', d); m.style.left = m.style.right = ''; + if (d.open && m.getBoundingClientRect().right > innerWidth) Object.assign(m.style, {left: 'auto', right: '0'}); + })); + // ---- Esc closes what is open, else clears the filters ---- document.addEventListener('keydown', e => { if (e.key !== 'Escape') return; diff --git a/app/static/style.css b/app/static/style.css index 830b5100..04ff2132 100644 --- a/app/static/style.css +++ b/app/static/style.css @@ -767,6 +767,11 @@ button.seg:hover { filter: brightness(1.25); } .wf-tick:first-child { transform: none; } .wf-tick:last-child { transform: translateX(-100%); } .wf-head .wf-dur { text-align: right; } +/* a phone: the name column gives way, and the axis keeps its first and last ticks */ +@media (max-width: 640px) { + .wf-head, .wf-row { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr) 5.5rem; } + .wf-tick:not(:first-child):not(:last-child) { display: none; } +} .wf-row { height: 24px; position: relative; } .wf-row:hover { background: var(--surface-2); } @@ -1699,8 +1704,9 @@ pre.instruction { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 32 .execution-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; } .run-delete { margin-left: auto; color: var(--text-dim); } .execution-stages { container: xs / inline-size; margin: 14px 0 8px; } -.xs-list { --mark: 1.6rem; list-style: none; margin: 0; padding: 0; display: flex; align-items: flex-start; } -.xs { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding-right: .9rem; font-size: .82rem; line-height: 1.3; color: var(--text-dim); } +/* more stages than the width holds scroll inside the strip, never the page; the padding keeps the running mark's ring unclipped */ +.xs-list { --mark: 1.6rem; list-style: none; margin: -6px; padding: 6px; display: flex; align-items: flex-start; overflow-x: auto; } +.xs { position: relative; flex: 1 1 0; min-width: 7rem; display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; padding-right: .9rem; font-size: .82rem; line-height: 1.3; color: var(--text-dim); } .xs:last-child { flex: 0 1 auto; padding-right: 0; } .xs::before { content: ""; position: absolute; top: calc(var(--mark) / 2 - 1px); left: calc(var(--mark) + .4rem); right: .4rem; height: 2px; border-radius: 1px; background: var(--border-soft); transition: background .3s; } .xs:last-child::before { display: none; } @@ -1714,9 +1720,10 @@ pre.instruction { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 32 .xs.running { color: var(--text); font-weight: 500; } .xs.waiting { color: var(--text-faint); } .xs-time { font-family: var(--mono); font-size: .75rem; font-weight: 400; color: var(--text-faint); } -.xs-detail { font-size: .75rem; font-weight: 400; color: var(--text-faint); overflow-wrap: anywhere; } +.xs-detail { font-size: .75rem; font-weight: 400; color: var(--text-faint); } +.xs-label, .xs-detail { overflow-wrap: anywhere; } @container xs (max-width: 44rem) { - .xs-list { flex-direction: column; } + .xs-list { flex-direction: column; margin: 0; padding: 0; overflow: visible; } .xs, .xs:last-child { flex: none; width: 100%; min-height: var(--mark); padding: .1rem 0 .95rem calc(var(--mark) + .7rem); } .xs:last-child { padding-bottom: 0; } .xs::before { top: calc(var(--mark) + .3rem); bottom: .3rem; left: calc(var(--mark) / 2 - 1px); right: auto; width: 2px; height: auto; } diff --git a/app/templates/runs/_execution.html b/app/templates/runs/_execution.html index d026880f..c4a424bd 100644 --- a/app/templates/runs/_execution.html +++ b/app/templates/runs/_execution.html @@ -27,7 +27,7 @@ {% set sp = ex.stages() %}
    {% for st in sp.stages %} -
  1. {{ st.label }} +
  2. {{ st.label }} {%- if st.state == 'cached' %}cached{% elif st.get('seconds') is not none and st.state in ('done', 'failed') %}{{ st.seconds|secs }}{% endif %} {%- if st.state in ('running', 'failed') and st.detail and st.detail != sp.detail %}{{ st.detail }}{% endif %}
  3. {% endfor %}
@@ -60,7 +60,7 @@ if (!mark) { mark = el('i'); mark.setAttribute('aria-hidden', 'true'); li.append(mark); } mark.textContent = {done: '', cached: '', failed: '✕'}[st.state] ?? String(n + 1); while (mark.nextSibling) mark.nextSibling.remove(); - li.append(el('span', 'xs-label', st.label)); + const name = li.appendChild(el('span', 'xs-label', st.label)); if (st.full) name.title = st.full; if (st.state === 'cached') li.append(el('span', 'xs-time', 'cached')); else if (st.state === 'running' && st.t) li.append(el('span', 'xs-time', clock(Math.max(0, Date.now() / 1000 - st.t)))); else if (st.seconds != null && (st.state === 'done' || st.state === 'failed')) li.append(el('span', 'xs-time', secs(st.seconds))); diff --git a/app/tests/test_progress.py b/app/tests/test_progress.py index a7c33d12..4df04980 100644 --- a/app/tests/test_progress.py +++ b/app/tests/test_progress.py @@ -106,6 +106,12 @@ def test_a_planned_stage_said_with_what_it_is_of_takes_its_place(self): got = progress.fold([ev("plan", stages="install,units"), ev("install", "start", agent="codex@2.2.2")]) self.assertEqual([(s["key"], s["label"]) for s in got["stages"]], [("install:codex@2.2.2", "Install codex@2.2.2"), ("units", "Units")]) + def test_an_image_digest_is_shown_short_with_the_full_label_kept(self): + digest = "sha256:" + "0123456789ab" + "c" * 52 + got = progress.fold([ev("environment", "start", name="tasks@" + digest), ev("install", "start", agent="terminus-2")]) + self.assertEqual([(s["label"], s.get("full")) for s in got["stages"]], + [("Environment tasks@sha256:0123456789ab", "Environment tasks@" + digest), ("Install terminus-2", None)]) + def test_a_planned_stage_a_later_one_overtook_was_not_needed(self): got = progress.fold([ev("plan", stages="image,dataset,install"), ev("image", "cached"), ev("install", "start", agent="a")]) self.assertEqual([s["stage"] for s in got["stages"]], ["image", "install"])