Pull pipeline/ from boilerplate a80ad8a: cadence picker, queue badge, label refresh
The schedule cadence is a picker, the add row is behind a button and off here, a running-jobs chip with Kill and Stop run sits in every header, and a declared schedule's label is refreshed at startup. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
cebe62ddc9
commit
3a240e51df
16 files changed
+828
-167
No files matched your search
+12
-2
@@ -60,6 +60,16 @@ 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. 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.
|
||||
|
||||
Attributes, all optional: `idle="hide"` (the default) takes up no space while nothing is running or queued; `idle="show"` stays and says "Nothing running."; `base` prefixes the HTTP calls; `socket` overrides the socket URL; `probe="/api/status"` names an authenticated endpoint to try when the socket closes, and raises `desk-jobs:signed-out` on a 401 or 403.
|
||||
|
||||
The same file defines `<desk-queue>`, a chip for a top bar:
|
||||
|
||||
```html
|
||||
<desk-queue href="/jobs">All runs</desk-queue>
|
||||
```
|
||||
|
||||
The chip is a dot, the running count and the first running job's label and progress ("Embedding roles, 6 of 6, +2 waiting"), with the job's message as its tooltip. It is grey and says "Idle" when nothing runs, and shows a red dot and "Offline" while the socket is down; under `40rem` it shrinks to the dot and the count. Pressing it opens a popover listing every running and queued job with its message, done/total, a ticking age and Kill, one Stop run per live cascade of more than one job (`POST /api/cascades/{id}/cancel`), and, with `href`, a link to the app's own page whose text is the element's content ("All runs" without any). It reads the `--desk-jobs-*` properties with fallbacks instead of setting them, so a theme on `:root` or an ancestor reaches it and without one it takes the bar's colour and font. It does not re-raise notices, because it sits next to a `<desk-jobs>` on some pages. `idle="hide"` hides it while idle; `base`, `socket` and `probe` are as above.
|
||||
|
||||
## Many jobs and one report
|
||||
|
||||
```python
|
||||
@@ -119,7 +129,7 @@ declare("nightly tick", "tick", "daily at 06:00", label="A tick, nightly")
|
||||
declare("hourly count", "count", "every 1h", {"n": 5})
|
||||
```
|
||||
|
||||
`declare` goes next to `@job` in the app's jobs module and fills `SCHEDULES` the way `@job` fills `JOBS`. On `JobQueue.start()` every declared name with no row gets one, and a row that already exists is left exactly as it was edited — cadence, payload and enabled alike. So a declaration is a starting point, not a setting: switching one off on screen survives the next deploy.
|
||||
`declare` goes next to `@job` in the app's jobs module and fills `SCHEDULES` the way `@job` fills `JOBS`. On `JobQueue.start()` every declared name with no row gets one, and a row that already exists keeps its cadence, payload and enabled as they were edited. So a declaration is a starting point, not a setting: switching one off on screen survives the next deploy. The label is the exception: no screen edits it, so it is refreshed from the declaration on every start while the row still has the declared kind.
|
||||
|
||||
Five cadences and nothing else:
|
||||
|
||||
@@ -144,7 +154,7 @@ Over HTTP, from `pipeline.web.connect`: `GET/POST /api/schedules`, `PATCH`/`DELE
|
||||
<desk-schedules></desk-schedules>
|
||||
```
|
||||
|
||||
`<desk-schedules>` 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 `<desk-jobs>`, 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`.
|
||||
`<desk-schedules>` is the table: name, kind, cadence, an on/off toggle, next and last run with the last job's state, Run now, Delete, and an "Add a schedule" button that opens a row for adding one, its kind starting on "Choose a job…". The cadence is a picker rather than a text box: Every (15m to 7d), Daily at (a time, in 15-minute steps) or Weekly on (a day and a time). It builds the canonical string the API takes, so the grammar is unchanged and a 422 is still the backstop; a stored cadence outside the presets, such as `every 50m`, is added to the options. `add="off"` removes adding altogether, for an app whose schedules are all declared; `base` and `socket` are as for `<desk-jobs>`. Same `--desk-jobs-*` custom properties as `<desk-jobs>`, 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
|
||||
|
||||
|
||||
Reference in new issue
Block a user