diff --git a/app/static/app.css b/app/static/app.css index bdc4adb..cd38c96 100644 --- a/app/static/app.css +++ b/app/static/app.css @@ -192,6 +192,13 @@ button.secondary { font-size: 0.8rem; } +/* -- pulls ------------------------------------------------------------------ */ +/* "Run one stage" on the Pulls page: extract, embed and score on their own, + under the schedule rather than beside Pull now. */ + +details.stage summary { cursor: pointer; color: var(--dim); font-size: 0.95rem; font-weight: 600; } +details.stage[open] summary { margin-bottom: 0.75rem; } + /* -- the notice log ------------------------------------------------------- */ .notice { @@ -277,8 +284,13 @@ desk-jobs, desk-schedules, auth-account { --desk-jobs-gap: var(--gap); --desk-jobs-radius: var(--radius); } -/* The schedule table has no narrow layout of its own yet, and what overflows - a shadow root widens the page. It scrolls inside its own box instead. */ +/* pipeline 21c5faa gave the schedule table a narrow layout, but its + kind/next/last columns are sized to their untruncated content rather than + the width their own ellipsis implies, which still squeezes the name and + cadence columns to a sliver at 375px -- a fix that has to land in + ../boilerplate first, or the next refresh reverts it (see CLAUDE.md). Kept + until then so the odd pixel that still overflows scrolls inside its own + box rather than widening the page. */ desk-schedules { overflow-x: auto; } /* -- roledesk's tabs ------------------------------------------------------ */ diff --git a/app/static/jobs.js b/app/static/jobs.js index 199c689..1fcaa01 100644 --- a/app/static/jobs.js +++ b/app/static/jobs.js @@ -1,8 +1,11 @@ -/* The Pulls page: a button per kind. +/* The Pulls page: Pull now on top, one button per remaining kind under + * "Run one stage". * * The list comes from `/api/jobs/kinds`, which is the registry, so a new - * `@job` in `app/jobs.py` is a new button and this file is not edited. What - * the queue is doing is ``'s business, and it draws itself. + * `@job` in `app/jobs.py` is a new button and this file is not edited -- + * except that `pull` itself is pulled out of the list and wired to the + * dedicated button instead of appearing twice. What the queue is doing is + * ``'s business, and it draws itself. * * Failures are the server's sentence through `api()`, which toasts it -- so * there is no error handling here beyond keeping the button usable. @@ -12,7 +15,7 @@ "use strict"; const host = document.getElementById("kinds"); - if (!host) return; + const pullButton = document.getElementById("pull-now"); async function start(kind, button) { button.disabled = true; @@ -26,7 +29,12 @@ } } + if (pullButton) { + pullButton.addEventListener("click", () => start("pull", pullButton)); + } + async function draw() { + if (!host) return; let kinds; try { kinds = await window.api("/api/jobs/kinds"); @@ -34,6 +42,7 @@ host.innerHTML = 'could not read the job kinds'; return; } + kinds = kinds.filter((k) => k.kind !== "pull"); if (!kinds.length) { host.innerHTML = 'nothing is registered'; return; @@ -42,6 +51,7 @@ kinds.forEach((k) => { const button = document.createElement("button"); button.type = "button"; + button.className = "secondary"; button.textContent = k.label || k.kind; button.title = k.solo ? `${k.kind} -- one at a time` : k.kind; button.dataset.kind = k.kind; diff --git a/app/templates/settings/messages.html b/app/templates/settings/messages.html index 63e2fca..1e6a67b 100644 --- a/app/templates/settings/messages.html +++ b/app/templates/settings/messages.html @@ -5,7 +5,7 @@

Settings

{% include "settings/_tabs.html" %} -

What the server said that nobody has cleared yet, newest first, with the fix when there is one. A message goes when you clear it, or two weeks after it was last said.

+

What the server said that nobody has cleared, newest first. A message goes when you clear it, or a fortnight after it was last said.

diff --git a/app/templates/settings/pulls.html b/app/templates/settings/pulls.html index 7fcc32e..7e1a6a4 100644 --- a/app/templates/settings/pulls.html +++ b/app/templates/settings/pulls.html @@ -8,21 +8,16 @@

Every 6 hours roledesk reads every board and search, then fills in what each posting says, embeds and scores. Change the cadence below.

-

Start something

-
- loading… +
+

What is running

+
-
- -
- {# The queue's own element, served by its own router. Two lines, and the - module owns what they draw — see pipeline/web/static/jobs.js. - - The heading is the app's, because the element takes up no space while - nothing is running — that is its `idle="hide"` default, and a strip that - is always there is furniture — and a card with nothing in it and nothing - above it reads as something that failed to load. #} -

What is running

+ {# The heading and the idle line are the app's: the element takes up no + space while the queue is idle — that is its `idle="hide"` default, and a + strip that is always there is furniture — and a card with nothing in it + and nothing above it reads as something that failed to load. The element + and its script are the queue's own, served by its own router — see + pipeline/web/static/jobs.js. #}

Nothing at the moment.

@@ -30,13 +25,20 @@
{# The element and its script are the scheduler's own, served by its own - router — see pipeline/web/static/schedules.js. Two lines, as with jobs. - A cadence is typed as `every 15m`, `every 6h`, `daily at 06:00` or - `weekly mon 07:00`; its add row's placeholder shows two. #} + router — see pipeline/web/static/schedules.js. A cadence is typed as + `every 15m`, `every 6h`, `daily at 06:00` or `weekly mon 07:00`; its add + row's placeholder shows two. #}

Schedule

+ +
+ Run one stage +
+ loading… +
+
{% endblock %} {% block scripts %} 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; }