From c74546d959089bfaa56be1aa93c6158b166f4e82 Mon Sep 17 00:00:00 2001 From: Wolf Date: Fri, 25 Sep 2026 21:37:49 +0200 Subject: [PATCH] Refresh pipeline/ from boilerplate: schedules on a phone git archive of boilerplate main (21c5faa), which gives desk-schedules a two-line narrow layout below 40rem, a data-label per cell, and phone-sized touch targets in both desk-jobs and desk-schedules. pipeline/README.md gained the matching lines. Co-Authored-By: Claude Fable 5.1 --- pipeline/README.md | 4 +- pipeline/web/static/jobs.js | 12 +++++ pipeline/web/static/schedules.js | 79 ++++++++++++++++++++++++++++---- 3 files changed, 85 insertions(+), 10 deletions(-) diff --git a/pipeline/README.md b/pipeline/README.md index ce3d5c3..c019e2e 100644 --- a/pipeline/README.md +++ b/pipeline/README.md @@ -58,7 +58,7 @@ That mounts `GET /api/jobs`, `POST /api/jobs`, `POST /api/jobs/{id}/cancel`, the ``` -It themes from CSS custom properties (`--desk-jobs-bg`, `--desk-jobs-accent`, …) and raises a `desk-jobs:notice` DOM event for failures instead of wording them. The wording is the app's. +It themes from CSS custom properties (`--desk-jobs-bg`, `--desk-jobs-accent`, …) and raises a `desk-jobs:notice` DOM event for failures instead of wording them. The wording is the app's. On a phone it drops its own padding (the app's card around it is the gutter) and under a coarse pointer Kill is a thumb's height; the width it calls a phone is `40rem`, the same number the app's stylesheet uses. ## Many jobs and one report @@ -144,7 +144,7 @@ Over HTTP, from `pipeline.web.connect`: `GET/POST /api/schedules`, `PATCH`/`DELE ``` -`` is the table: name, kind, cadence edited in place, an on/off toggle, next and last run with the last job's state, Run now, Delete, and a row for adding one. Same `--desk-jobs-*` custom properties as ``, and just as silent about failures — it raises `desk-schedules:error` carrying the server's `detail` and leaves the wording to the app. +`` is the table: name, kind, cadence edited in place, an on/off toggle, next and last run with the last job's state, Run now, Delete, and a row for adding one. Same `--desk-jobs-*` custom properties as ``, and just as silent about failures — it raises `desk-schedules:error` carrying the server's `detail` and leaves the wording to the app. Under `40rem` the table is a card per schedule — the name and the switch on the first line, the other columns labelled under it, the two buttons across the bottom — from the same markup, because each cell carries its column's name as `data-label`. ## A worker without the web app diff --git a/pipeline/web/static/jobs.js b/pipeline/web/static/jobs.js index 613eb64..e50a919 100644 --- a/pipeline/web/static/jobs.js +++ b/pipeline/web/static/jobs.js @@ -89,6 +89,18 @@ button:hover { color: var(--desk-jobs-error); } button[disabled] { opacity: .4; cursor: default; } .offline { color: var(--desk-jobs-error); } + +/* A finger: Kill is a thumb's height. Sizes only; the layout is the width + * query below, and neither reads the other. */ +@media (pointer: coarse) { + button { min-height: 2.5rem; padding: 4px 12px; } +} + +/* A phone: the app's card around the strip is the gutter, and a second one + * inside it wasted a fifth of the width. 40rem is app.css's number. */ +@media (max-width: 40rem) { + .strip { padding: 0; } +} `; /** Backing off rather than hammering. The usual reason a socket closed is the diff --git a/pipeline/web/static/schedules.js b/pipeline/web/static/schedules.js index 75ace62..c6a7cd9 100644 --- a/pipeline/web/static/schedules.js +++ b/pipeline/web/static/schedules.js @@ -118,6 +118,61 @@ button[disabled] { opacity: .4; cursor: default; } .empty, .offline { color: var(--desk-jobs-dim); padding: 6px 0; } .offline { color: var(--desk-jobs-error); } + +/* A finger: every control a thumb's height, and no field under 16px, which + * is where iOS zooms the page in on focus and never back out. Sizes only; + * the layout is the width query below, and neither reads the other. */ +@media (pointer: coarse) { + button { min-height: 2.5rem; padding: 4px 12px; } + input, select { font-size: 16px; padding: 6px 8px; } + input[type="checkbox"] { width: 1.4rem; height: 1.4rem; } +} + +/* A phone: seven columns do not fit in 375 pixels, so each row folds to two + * lines instead -- name, kind and the switch on top, cadence, next, last and + * the actions underneath -- and the header goes, since there is nothing left + * to label. */ +@media (max-width: 40rem) { + .panel { padding: 0; } + table, tbody { display: block; } + thead { display: none; } + tr { + display: grid; + grid-template-columns: 1fr auto auto auto; + column-gap: 8px; + row-gap: 2px; + align-items: center; + padding: 8px 0; + border-bottom: 1px solid color-mix(in srgb, var(--desk-jobs-fg) 12%, transparent); + } + tr:last-child { border-bottom: 0; } + td, th { display: block; padding: 0; border: 0; min-width: 0; } + td:empty { display: none; } + td.name { grid-column: 1; grid-row: 1; font-size: 14px; } + td.kind { grid-column: 2 / 4; grid-row: 1; } + td.on { grid-column: 4; grid-row: 1; justify-self: end; } + td.cadence { grid-column: 1; grid-row: 2; } + td.next { grid-column: 2; grid-row: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } + td.last { grid-column: 3; grid-row: 2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } + td.actions { + grid-column: 4; grid-row: 2; justify-self: end; + display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; + } + td.actions button { margin: 0; } + /* A box that looks like text until hovered has nothing to hover with. */ + input.cadence { border-color: color-mix(in srgb, var(--desk-jobs-fg) 20%, transparent); min-width: 0; width: 100%; } + /* The add row: label over field, each field the width of the card. */ + tr.adder { grid-template-columns: 1fr; } + tr.adder td { grid-column: 1; } + tr.adder td[data-label]::before { + content: attr(data-label) " "; + display: block; + font-size: 11px; + color: var(--desk-jobs-dim); + font-weight: 600; + } + tr.adder input, tr.adder select { width: 100%; min-width: 0; border-color: color-mix(in srgb, var(--desk-jobs-fg) 20%, transparent); } +} `; /** The same backoff as ``: the usual reason a socket closed is the @@ -381,7 +436,7 @@ class DeskSchedules extends HTMLElement { row.append(this.#cell("name", schedule.name)); - const kind = this.#cell("kind", schedule.kind); + const kind = this.#cell("kind", schedule.kind, "Kind"); if (schedule.unknown) { // Never fires, and says so rather than sitting there with a next run it // is not going to keep. Deleting it is the only thing left to do. @@ -393,6 +448,8 @@ class DeskSchedules extends HTMLElement { row.append(kind); const cadence = document.createElement("td"); + cadence.className = "cadence"; + cadence.dataset.label = "Cadence"; const box = document.createElement("input"); box.className = "cadence"; box.value = schedule.cadence; @@ -413,6 +470,7 @@ class DeskSchedules extends HTMLElement { row.append(cadence); const onOff = document.createElement("td"); + onOff.className = "on"; const toggle = document.createElement("input"); toggle.type = "checkbox"; toggle.checked = !!schedule.enabled; @@ -424,9 +482,9 @@ class DeskSchedules extends HTMLElement { onOff.append(toggle); row.append(onOff); - row.append(this.#cell("when", schedule.enabled ? when(schedule.next_run) : "—")); + row.append(this.#cell("when next", schedule.enabled ? when(schedule.next_run) : "—", "Next")); - const last = this.#cell("when", when(schedule.last_run)); + const last = this.#cell("when last", when(schedule.last_run), "Last"); if (schedule.last_state) { const state = document.createElement("span"); state.className = `state ${schedule.last_state}`; @@ -454,9 +512,12 @@ class DeskSchedules extends HTMLElement { return row; } - #cell(className, text) { + /** `label` is the column's name, which the phone layout writes in front of + * the value once the header row is gone. */ + #cell(className, text, label) { const cell = document.createElement("td"); cell.className = className; + if (label) cell.dataset.label = label; const span = document.createElement("span"); span.textContent = text; cell.append(span); @@ -468,13 +529,14 @@ class DeskSchedules extends HTMLElement { * each box is for. */ #adder() { const row = document.createElement("tr"); + row.className = "adder"; const busy = this.#busy.has(0); const name = document.createElement("input"); name.className = "text"; name.placeholder = "optional"; name.disabled = busy; - row.append(this.#wrap(name)); + row.append(this.#wrap(name, "Name")); const kind = document.createElement("select"); kind.disabled = busy || !this.#kinds.length; @@ -489,14 +551,14 @@ class DeskSchedules extends HTMLElement { none.textContent = this.#loaded ? "nothing registered" : "loading…"; kind.append(none); } - row.append(this.#wrap(kind)); + row.append(this.#wrap(kind, "Kind")); const cadence = document.createElement("input"); cadence.className = "text"; cadence.placeholder = HINT; cadence.title = FORMS; cadence.disabled = busy; - row.append(this.#wrap(cadence)); + row.append(this.#wrap(cadence, "Cadence")); row.append(document.createElement("td"), document.createElement("td"), document.createElement("td")); @@ -529,8 +591,9 @@ class DeskSchedules extends HTMLElement { return row; } - #wrap(control) { + #wrap(control, label) { const cell = document.createElement("td"); + cell.dataset.label = label; cell.append(control); return cell; }