Route commands, jobs and prompt icons

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WzxdWYNS1qAMRdgAtbr5Rq
This commit is contained in:
Krzysztof Rudnicki 2026-11-16 10:51:32 +01:00
parent b913ff67f5
commit fee4ccdd88
14 changed files with 356 additions and 138 deletions

View File

@ -5,7 +5,6 @@
import type { CommandName, CommandSpec, InstalledGame } from '../api/contract'
import type { IconId } from '../icons/registry'
import { iconFor } from '../icons/render'
export type SectionPath =
| '/'
@ -51,21 +50,6 @@ export function commandIcon(name: CommandName): IconId {
return `cmd.${name}` as const satisfies IconId
}
/**
* The glyph a command paints, for sites not yet on `glyph(commandIcon(…))`
* (they get the chosen alternative glyph, not the word). Live getters, so a
* ledger change shows without re-importing.
*/
export const COMMAND_ICON: Readonly<Record<CommandName, string>> = Object.defineProperties(
{},
Object.fromEntries(
(Object.keys(COMMAND_HOME) as CommandName[]).map((name) => [
name,
{ enumerable: true, get: () => iconFor(commandIcon(name)).glyph },
]),
),
) as Record<CommandName, string>
/** Title-case label for buttons and the palette (`pick-manual` → `Pick manual`). */
export function commandLabel(name: CommandName): string {
const s = name.replace(/-/g, ' ')

View File

@ -6,7 +6,8 @@
import type { CommandName } from '../api/contract'
import { q } from '../api/queries'
import { iconMark, iconWord } from '../icons/render'
import type { IconId } from '../icons/registry'
import { iconInline, iconMark, iconWord } from '../icons/render'
import { define, h, jsonAttr } from '../lib/dom'
import { LiveElement } from '../lib/element'
import { pageHref, runner, type Preset } from '../lib/runner'
@ -54,13 +55,13 @@ export function commandButton({ name, preset, label, tone = 'ghost' }: ButtonPro
},
},
glyph,
locked === null ? null : h('span', { class: 'cmd-lock', 'aria-hidden': 'true' }, '🔒'),
locked === null ? null : h('span', { class: 'cmd-lock', 'aria-hidden': 'true' }, iconInline('state.locked')),
)
}
/** A card flag (root, countdown): glyph painted, its word spoken. */
function flag(glyph: string, spoken: string): HTMLSpanElement {
return h('span', { class: 'pill pill-neutral', 'aria-label': spoken, role: 'img' }, glyph)
function flag(id: IconId, spoken: string): HTMLSpanElement {
return h('span', { class: 'pill pill-neutral', 'aria-label': spoken, role: 'img' }, iconInline(id))
}
export class CommandButtonElement extends LiveElement {
@ -90,8 +91,8 @@ export class CommandCardElement extends LiveElement {
'h3',
{ class: 'cmd-name' },
h('span', { class: 'sr-only' }, commandLabel(p.name)),
spec?.privileged ? flag('🔑', 'root') : null,
spec?.friction?.countdown_seconds ? flag('⏳', 'countdown') : null,
spec?.privileged ? flag('cmdflag.root', 'root') : null,
spec?.friction?.countdown_seconds ? flag('cmdflag.countdown', 'countdown') : null,
),
h('p', { class: 'cmd-desc sr-only' }, locked ?? spec?.description ?? '…'),
commandButton(p),

View File

@ -0,0 +1,109 @@
// Pass-2 icon wiring for the command UI: the user's word shows right of the
// icon, a chosen alternative glyph replaces the default, and the spoken
// names (aria-label, .sr-only) stay as they were.
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
import { makeSpec, makePending } from '../test/fixtures'
import { mount, stubApi } from '../test/harness'
import { useIcons } from '../test/iconLedger'
import { must } from '../test/events'
import { painted } from '../test/painted'
import { visibleWords } from '../test/visibleWords'
import { NAV } from '../shell/nav'
import './commandButton'
import { CommandPaletteElement } from './palette'
import { PendingCountdown } from './pendingCountdown'
import { commandFlags, fillHint, lockedNotice, terminalFallback } from './runnerParts'
describe('command button and card', () => {
it('draws the lock badge with its word and glyph, aria unchanged', async () => {
useIcons({ 'state.locked': { word: 'closed', glyph: '🔐' } })
stubApi({ 'GET /api/commands': [makeSpec('scan', { locked_reason: 'A pick is active' })] })
const el = mount('<command-button name="scan"></command-button>')
await vi.waitFor(() => { expect(el.querySelector('.cmd-lock')).not.toBeNull() })
const lock = must(el.querySelector('.cmd-lock'))
expect(lock.textContent).toBe('🔐Closed')
expect(lock.querySelector('.icon-word')).toHaveAttribute('data-icon-word', 'state.locked')
expect(el.querySelector('button')).toHaveAttribute('aria-label', 'Run scan')
expect(el.querySelector('button')).toHaveAttribute('aria-description', 'A pick is active')
expect(visibleWords(el)).toEqual([])
})
it('draws the root and countdown flags of a card by id', async () => {
useIcons({ 'cmdflag.root': { word: 'admin' }, 'cmdflag.countdown': { glyph: '⏲️' } })
stubApi({ 'GET /api/commands': [makeSpec('gaming-reset', { privileged: true, friction: { phrase_template: 'x', countdown_seconds: 300 } })] })
const el = mount('<command-card name="gaming-reset"></command-card>')
await vi.waitFor(() => { expect(el.querySelector('.cmd-name .pill')).not.toBeNull() })
const flags = [...el.querySelectorAll('.cmd-name .pill')]
expect(flags.map((f) => f.getAttribute('aria-label'))).toEqual(['root', 'countdown'])
expect(flags[0]?.textContent).toBe('🔑Admin')
expect(flags[1]?.textContent).toBe('⏲️')
})
})
describe('command palette', () => {
it('shows the search icon and its word in the placeholder, hint icons by id', async () => {
useIcons({ 'cmdpal.search': { word: 'find' }, 'cmdpal.open': { word: 'page', glyph: '🔗' }, 'cmdpal.go': { word: 'jump' } })
stubApi({ 'GET /api/commands': [makeSpec('status', { kind: 'view', description: 'Show status.' })] })
const el = new CommandPaletteElement()
document.body.append(el)
el.open()
await vi.waitFor(() => { expect(document.querySelectorAll('[role=option]').length).toBeGreaterThan(NAV.length + 1) })
expect(document.querySelector<HTMLInputElement>('[role=combobox]')).toHaveAttribute('placeholder', '🔍 Find')
const hints = [...document.querySelectorAll('.palette-hint')]
expect(hints[0]?.textContent).toContain('🔗Page')
expect(hints[0]?.querySelector('.sr-only')?.textContent).toBe('open /')
expect(hints.at(-1)?.textContent).toContain('🧭Jump')
})
})
describe('run dialog parts', () => {
it('draws the command flags by id', () => {
useIcons({ 'cmdflag.readonly': { word: 'safe' }, 'cmdflag.cancellable': { glyph: '🛑' } })
const flags = commandFlags(makeSpec('scan', { mutating: false, cancellable: true }))
const [, readonly, cancellable] = flags
expect(painted(readonly)).toBe('👁️Safe')
expect(readonly?.querySelector('.sr-only')?.textContent).toBe('Read-only')
expect(painted(cancellable)).toBe('🛑')
})
it('paints the lock mark in the warning notice and keeps the spoken reason', () => {
useIcons({ 'state.locked': { word: 'sealed' } })
const el = lockedNotice('Daemon is down')
expect(el).toHaveAttribute('aria-label', 'Locked: Daemon is down')
expect(el.textContent).toBe('🔒Sealed')
expect(el.querySelector('.notice-icon')).toHaveAttribute('data-icon', 'state.locked')
})
it('draws the fill hint and the terminal fallback by id', () => {
useIcons({ 'runner.fill': { word: 'above' }, 'runner.terminal': { glyph: '🐚' } })
expect(fillHint(['app_id']).textContent).toContain('⬆️Above')
const [line] = terminalFallback('sudo ./run.sh gaming-unblock')
expect(line).toHaveAttribute('aria-label', 'Run it from a terminal instead:')
expect(line.textContent).toBe('🐚')
})
})
describe('pending countdown', () => {
beforeEach(() => {
vi.useFakeTimers({ now: Date.parse('2026-10-10T10:00:00Z') })
})
const made: PendingCountdown[] = []
afterEach(() => {
for (const c of made.splice(0)) c.dispose()
})
it('draws the lock beside the clock and the heartbeat, words and glyphs from the ledger', () => {
useIcons({ 'state.locked': { word: 'locked' }, 'pending.beat': { word: 'pulse', glyph: '💗' } })
const cbs = { onCommitted: vi.fn(), onCancel: vi.fn(), onRearm: vi.fn() }
const countdown = new PendingCountdown(makePending({ ready_at: '2026-10-10T10:00:30Z' }), cbs)
made.push(countdown)
document.body.append(countdown.el)
const clock = must(countdown.el.querySelector('.countdown-clock'))
expect(clock.textContent).toContain('🔒Locked')
expect(clock.querySelector('.sr-only')?.textContent).toBe('until commit unlocks')
expect(countdown.el.textContent).toContain('💗Pulse 0s')
expect(countdown.el.querySelector('button')).toHaveAttribute('aria-label', 'Cancel countdown')
expect(countdown.el.querySelector('button')?.textContent).toBe('✖️')
})
})

View File

@ -4,6 +4,8 @@
// via aria-activedescendant.
import { q } from '../api/queries'
import { iconText } from '../icons/iconText'
import type { IconId } from '../icons/registry'
import { define, h } from '../lib/dom'
import { uid } from '../lib/ids'
import { pageHref, runner } from '../lib/runner'
@ -17,10 +19,9 @@ interface Entry {
title: string
detail: string
hint: string
/** A registered icon id (painted with the user's word) or a raw glyph. */
icon: string
/** Painted in place of the hint: ▶️ run, ↗️ open, 🧭 navigate. */
hintIcon: string
icon: IconId
/** Painted in place of the hint: run, open the page, or navigate. */
hintIcon: IconId
locked: string | null
act: () => void
}
@ -49,7 +50,7 @@ export class CommandPaletteElement extends HTMLElement {
'aria-expanded': 'true',
'aria-controls': `${this.listId}-list`,
'aria-label': 'Search commands',
placeholder: '🔍',
placeholder: iconText('cmdpal.search'),
autofocus: true,
})
this.list = h('ul', { id: `${this.listId}-list`, role: 'listbox', class: 'palette-list', 'aria-label': 'Commands' })
@ -112,13 +113,13 @@ export class CommandPaletteElement extends HTMLElement {
private entries(): Entry[] {
return [
...(q.commands.state.data ?? []).map((c) => ({
...(q.commands.state.data ?? []).map((c): Entry => ({
key: c.name,
title: commandLabel(c.name),
detail: c.description,
hint: c.kind === 'job' ? (c.friction ? 'run · confirm' : 'run') : `open ${COMMAND_HOME[c.name]}`,
icon: commandIcon(c.name),
hintIcon: c.kind === 'job' ? (c.friction ? '▶️⌨️' : '▶️') : '↗️',
hintIcon: c.kind === 'job' ? (c.friction ? 'cmdpal.run-phrase' : 'runner.run') : 'cmdpal.open',
locked: c.locked_reason,
act: () => {
if (c.kind === 'job') runner.run(c.name)
@ -128,13 +129,13 @@ export class CommandPaletteElement extends HTMLElement {
}
},
})),
...[...NAV, ...PALETTE_PAGES].map((n) => ({
...[...NAV, ...PALETTE_PAGES].map((n): Entry => ({
key: `nav:${n.to}`,
title: `Go to ${n.label}`,
detail: n.blurb,
hint: 'navigate',
icon: n.icon,
hintIcon: '🧭',
hintIcon: 'cmdpal.go',
locked: null,
act: () => {
this.close()
@ -157,7 +158,7 @@ export class CommandPaletteElement extends HTMLElement {
'li',
{ id: `${this.listId}-${i}`, role: 'option', 'aria-selected': String(i === this.active), class: i === this.active ? 'palette-item active' : 'palette-item' },
// Textgate: glyphs painted; title, detail and hint spoken only.
h('span', { class: 'palette-title' }, glyph(e.icon, e.title), e.locked ? pill('warning', 'locked', '🔒') : null),
h('span', { class: 'palette-title' }, glyph(e.icon, e.title), e.locked ? pill('warning', 'locked', 'state.locked') : null),
h('span', { class: 'palette-detail sr-only' }, e.locked ?? e.detail),
h('span', { class: 'palette-hint' }, glyph(e.hintIcon, e.hint)),
)

View File

@ -3,34 +3,32 @@
// never re-creates an input.
import type { ParamSpec } from '../api/contract'
import type { IconId } from '../icons/registry'
import { iconInline } from '../icons/render'
import { h } from '../lib/dom'
import { uid } from '../lib/ids'
import { glyph } from '../ui/build'
import { paramError, type GameOption, type ParamValues } from './params'
/** Painted glyph per parameter (textgate); the catalog label is spoken only. */
const PARAM_ICON: Record<string, string> = {
app_id: '🎮',
backup_id: '🗄️',
days: '📅',
minutes: '⏱️',
reason: '💬',
replace: '🔁',
demo: '🧪',
/** Painted icon per parameter (textgate); the catalog label is spoken only. */
const PARAM_ICON: Record<string, IconId> = {
app_id: 'params.app_id',
backup_id: 'params.backup_id',
days: 'params.days',
minutes: 'params.minutes',
reason: 'params.reason',
replace: 'params.replace',
demo: 'params.demo',
}
function paramGlyph(spec: ParamSpec): HTMLSpanElement {
return h(
'span',
{},
h('span', { 'aria-hidden': 'true' }, PARAM_ICON[spec.name] ?? '✏️'),
h('span', { class: 'sr-only' }, spec.label),
)
return glyph(PARAM_ICON[spec.name] ?? 'params.other', spec.label)
}
/** Field help: optional painted mark, sentence spoken only. */
function spokenHelp(el: HTMLElement, mark: string | null, sentence: string): void {
function spokenHelp(el: HTMLElement, mark: IconId | null, sentence: string): void {
el.replaceChildren(
mark ? h('span', { 'aria-hidden': 'true' }, mark) : '',
mark ? iconInline(mark) : '',
sentence ? h('span', { class: 'sr-only' }, sentence) : '',
)
}
@ -137,9 +135,9 @@ export class ParamsForm {
input.setAttribute('aria-invalid', String(bad))
help.className = bad ? 'field-help text-danger' : 'field-help'
const game = spec.type === 'app_id' ? this.games.find((g) => g.app_id === Number(raw)) : undefined
// Textgate: an error paints ⚠️, a matched game paints its name (content);
// the error sentence and the field help are spoken only.
if (bad) spokenHelp(help, '⚠️', err)
// Textgate: an error paints the warn mark, a matched game paints its name
// (content); the error sentence and the field help are spoken only.
if (bad) spokenHelp(help, 'state.warn', err)
else if (game) help.replaceChildren(game.name)
else spokenHelp(help, null, spec.help ?? (spec.type === 'app_id' ? 'Type an app id or pick a game from the list.' : ''))
if (datalist && datalist.childElementCount !== this.games.length) {

View File

@ -6,6 +6,7 @@
import { api, ApiFailure } from '../api/client'
import type { Job, PendingAction } from '../api/jobContract'
import { iconInline } from '../icons/render'
import { progressBar } from '../jobs/progress'
import { Action } from '../lib/action'
import { h } from '../lib/dom'
@ -21,9 +22,9 @@ import { PhraseField } from './phraseField'
*/
export const CLOCK_SLACK_MS = 1000
/** ⚠️ 🚪: leaving cancels the countdown; the sentence is spoken only. */
/** Warning plus the leave mark: leaving cancels the countdown; the sentence is spoken only. */
function stayNotice(): HTMLDivElement {
const el = notice('warning', null, h('span', { 'aria-hidden': 'true' }, '🚪✖️'))
const el = notice('warning', null, iconInline('pending.leave'))
el.setAttribute('aria-label', 'Closing this dialog, navigating away or closing the tab cancels the countdown.')
return el
}
@ -109,7 +110,7 @@ export class PendingCountdown {
this.el.className = 'stack'
this.el.replaceChildren(
errorNotice(this.beatError),
h('div', { class: 'actions' }, h('button', { type: 'button', class: 'btn btn-primary', autofocus: true, 'aria-label': 'Arm again', onclick: this.cb.onRearm }, '🔁')),
h('div', { class: 'actions' }, h('button', { type: 'button', class: 'btn btn-primary', autofocus: true, 'aria-label': 'Arm again', onclick: this.cb.onRearm }, iconInline('pending.rearm'))),
)
this.el.querySelector<HTMLElement>('[autofocus]')?.focus()
return
@ -120,17 +121,18 @@ export class PendingCountdown {
const left = Math.max(0, (ready - now) / 1000)
const isReady = left <= 0
this.parts.num.textContent = clock(left)
// Textgate: 🔓/🔒 painted beside the clock; 💓 + seconds since the last
// heartbeat (red 💔 when failing). Sentences are spoken only.
// Textgate: the lock mark painted beside the clock; the heartbeat mark +
// seconds since the last heartbeat (red broken heart when failing).
// Sentences are spoken only.
this.parts.caption.replaceChildren(
h('span', { 'aria-hidden': 'true' }, isReady ? '🔓' : '🔒'),
iconInline(isReady ? 'state.unlocked' : 'state.locked'),
h('span', { class: 'sr-only' }, isReady ? 'Ready to commit' : 'until commit unlocks'),
)
this.parts.bar.replaceChildren(progressBar(Math.min(1, (now - armed) / (ready - armed)), 'Countdown', isReady ? 'success' : 'warning'))
const sinceBeat = Math.round((now - this.lastBeat) / 1000)
const failing = this.beatError !== null
this.parts.beat.replaceChildren(
h('span', { 'aria-hidden': 'true', class: failing ? 'text-danger' : '' }, `${failing ? '💔' : '💓'} ${sinceBeat}s`),
h('span', { 'aria-hidden': 'true', class: failing ? 'text-danger' : '' }, iconInline(failing ? 'pending.beat-lost' : 'pending.beat'), ` ${sinceBeat}s`),
h(
'span',
{ class: 'sr-only' },
@ -154,7 +156,7 @@ export class PendingCountdown {
h(
'button',
{ type: 'button', class: 'btn btn-ghost', autofocus: true, 'aria-label': this.cancel.pending ? 'Cancelling…' : 'Cancel countdown', onclick: () => void this.doCancel() },
this.cancel.pending ? '⏳' : '✖️',
iconInline(this.cancel.pending ? 'state.wait' : 'action.cancel'),
),
),
)
@ -176,7 +178,7 @@ export class PendingCountdown {
{ class: 'stack' },
this.phrase.el,
errorSlot,
h('div', { class: 'actions' }, submitBtn, h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Cancel', onclick: () => void this.doCancel() }, '✖️')),
h('div', { class: 'actions' }, submitBtn, h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Cancel', onclick: () => void this.doCancel() }, iconInline('action.cancel'))),
)
form.addEventListener('submit', (e) => {
e.preventDefault()
@ -188,7 +190,7 @@ export class PendingCountdown {
}
const { submit, errors } = this.commitForm as { submit: HTMLButtonElement; errors: HTMLDivElement }
submit.disabled = !phraseMatches(this.pending.phrase, this.phrase.value) || this.commit.pending
submit.textContent = this.commit.pending ? '⏳' : '✔️'
submit.replaceChildren(iconInline(this.commit.pending ? 'state.wait' : 'action.confirm'))
submit.setAttribute('aria-label', this.commit.pending ? 'Committing…' : 'Commit')
errors.replaceChildren(...(this.commit.error ? [errorNotice(this.commit.error)] : []))
}

View File

@ -3,8 +3,10 @@
// is the friction. The server re-checks; this field only helps get it right.
// The input is built once, so typing never loses focus or caret position.
import { iconInline } from '../icons/render'
import { h } from '../lib/dom'
import { uid } from '../lib/ids'
import { glyph } from '../ui/build'
import { phraseMatches } from './catalog'
export interface PhraseFieldOptions {
@ -48,7 +50,7 @@ export class PhraseField {
this.el = h(
'div',
{ class: 'phrase' },
h('label', { for: id, class: 'field-label' }, h('span', { 'aria-hidden': 'true' }, '⌨️'), h('span', { class: 'sr-only' }, label)),
h('label', { for: id, class: 'field-label' }, glyph('phrase.field', label)),
this.target,
this.input,
h('p', { class: 'sr-only' }, `Phrase: ${phrase}`),
@ -71,12 +73,12 @@ export class PhraseField {
this.input.className = `input mono ${ok ? 'input-ok' : prefixOk ? '' : 'input-bad'}`.trim()
this.input.setAttribute('aria-invalid', String(!prefixOk))
this.status.className = `field-help ${ok ? 'text-success' : prefixOk ? '' : 'text-danger'}`.trim()
// Textgate: ✅ / count / ❌ painted; the sentence is spoken only.
// Textgate: yes mark / count / no mark painted; the sentence is spoken only.
const [mark, spoken] = ok
? ['✅', 'Matches.']
? [iconInline('state.yes'), 'Matches.']
: prefixOk
? [`${typed.length}/${this.phrase.length}`, `${typed.length} of ${this.phrase.length} characters`]
: ['❌', 'Does not match — check case and spacing.']
: [iconInline('state.no'), 'Does not match — check case and spacing.']
this.status.replaceChildren(h('span', { 'aria-hidden': 'true' }, mark), h('span', { class: 'sr-only' }, spoken))
}
}

View File

@ -5,7 +5,7 @@
import { api } from '../api/client'
import { q } from '../api/queries'
import { iconMark, iconWord } from '../icons/render'
import { iconInline, iconMark, iconWord } from '../icons/render'
import { define, h, hx } from '../lib/dom'
import { runner, jobHref, type RunRequest } from '../lib/runner'
import { errorNotice, loading, notice } from '../ui/build'
@ -117,8 +117,8 @@ export class RunnerDialogElement extends HTMLElement {
h(
'div',
{ class: 'actions' },
h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Close (job keeps running)', onclick: () => { this.close() } }, '✖️'),
h('a', { href: jobHref(next.id), class: 'btn btn-ghost', 'aria-label': 'Open in Jobs' }, '⚙️'),
h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Close (job keeps running)', onclick: () => { this.close() } }, iconInline('action.cancel')),
h('a', { href: jobHref(next.id), class: 'btn btn-ghost', 'aria-label': 'Open in Jobs' }, iconInline('nav.jobs')),
),
),
)

View File

@ -5,11 +5,11 @@
import { ApiFailure, startJob } from '../api/client'
import type { CommandName, CommandSpec } from '../api/contract'
import { q } from '../api/queries'
import { iconMark, iconWord } from '../icons/render'
import { iconInline, iconMark, iconWord } from '../icons/render'
import { Action } from '../lib/action'
import { h } from '../lib/dom'
import type { Preset } from '../lib/runner'
import { commandLine, errorNotice, notice, pill } from '../ui/build'
import { errorNotice } from '../ui/build'
import { commandIcon, fillPhrase, phraseMatches } from './catalog'
import { enforcePreset } from './enforcePreset'
import { gameLookup } from './gameLookup'
@ -17,29 +17,13 @@ import { initialValues, paramError, toParams, type ParamValues } from './params'
import { ParamsForm } from './paramsForm'
import { PendingCountdown } from './pendingCountdown'
import { PhraseField } from './phraseField'
import { commandFlags, fillHint, lockedNotice, terminalFallback } from './runnerParts'
/** Recovery commands the UI offers when the root daemon is down. */
const FALLBACK: Partial<Record<CommandName, string>> = {
'gaming-unblock': 'sudo ./run.sh gaming-unblock',
}
/** ⏳ plus the minutes (a number, so painted); the word is spoken only. */
function countdownPill(seconds: number): HTMLSpanElement {
const minutes = Math.round(seconds / 60)
const el = pill('warning', `${minutes} min countdown`, '⏳')
el.append(h('span', { class: 'pill-num', 'aria-hidden': 'true' }, `${minutes}′`))
return el
}
/** 🔒 warning notice; the server's lock reason is spoken only. */
function lockedNotice(reason: string): HTMLDivElement {
const el = notice('warning', null)
el.querySelector('.notice-icon')?.replaceChildren('🔒')
el.setAttribute('aria-label', `Locked: ${reason}`)
return el
}
export type NextPhase = { k: 'pending'; countdown: PendingCountdown } | { k: 'job'; id: string } | { k: 'form'; runner: Runner }
export interface RunnerCallbacks {
@ -85,7 +69,6 @@ export class Runner {
this.start = new Action(startJob, () => {
this.refresh()
})
const countdown = spec.friction?.countdown_seconds
this.submitBtn = h('button', {
type: 'submit',
class: 'btn btn-primary',
@ -100,10 +83,7 @@ export class Runner {
'div',
{ class: 'tags' },
h('span', { class: 'runner-mark' }, iconMark(commandIcon(spec.name), 'runner-glyph'), iconWord(commandIcon(spec.name))),
spec.privileged ? pill('neutral', 'Runs as root via the daemon', '🔑') : null,
spec.mutating ? pill('neutral', 'Changes state', '✏️') : pill('neutral', 'Read-only', '👁️'),
spec.cancellable ? pill('neutral', 'Cancellable', '⏹️') : null,
countdown ? countdownPill(countdown) : null,
commandFlags(spec),
),
spec.locked_reason !== null ? lockedNotice(spec.locked_reason) : null,
this.form.nodes,
@ -113,7 +93,7 @@ export class Runner {
'div',
{ class: 'actions' },
this.submitBtn,
h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Cancel', onclick: () => { cb.onClose() } }, '✖️'),
h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Cancel', onclick: () => { cb.onClose() } }, iconInline('action.cancel')),
),
)
this.el.addEventListener('submit', (e) => {
@ -159,10 +139,7 @@ export class Runner {
if (key !== this.phraseKey) {
this.phraseKey = key
if (phrase && phrase.missing.length > 0) {
// ℹ️ ⬆️: fill the fields above first; the sentence is spoken only.
const hint = notice('info', null, h('span', { 'aria-hidden': 'true' }, '⬆️'))
hint.setAttribute('aria-label', `Fill in the fields above to see the exact phrase (${phrase.missing.join(', ')}).`)
this.phraseSlot.replaceChildren(hint)
this.phraseSlot.replaceChildren(fillHint(phrase.missing))
} else if (phrase && !locked) {
this.typed = ''
const field = new PhraseField({
@ -187,7 +164,7 @@ export class Runner {
errorNotice(
err,
failure?.code === 'daemon_unreachable' && fallback
? [h('p', { class: 'm0', 'aria-label': 'Run it from a terminal instead:' }, h('span', { 'aria-hidden': 'true' }, '💻')), commandLine(fallback)]
? terminalFallback(fallback)
: null,
),
]
@ -196,8 +173,8 @@ export class Runner {
const countdown = this.spec.friction?.countdown_seconds
this.submitBtn.className = phrase ? 'btn btn-danger' : 'btn btn-primary'
this.submitBtn.disabled = !this.canSubmit() || this.start.pending
// Glyph painted, label spoken: ⏳ starting, ⏲️ arm countdown, ▶️ run.
this.submitBtn.textContent = this.start.pending ? '⏳' : countdown ? '⏲️' : '▶️'
// Icon painted, label spoken: busy while starting, arm countdown, or run.
this.submitBtn.replaceChildren(iconInline(this.start.pending ? 'state.wait' : countdown ? 'runner.arm' : 'runner.run'))
this.submitBtn.setAttribute('aria-label', this.start.pending ? 'Starting…' : countdown ? 'Arm countdown' : `Run ${this.spec.name}`)
}

View File

@ -0,0 +1,50 @@
// The small painted parts of the runner form: the command's flags, the lock
// notice, the "fill the fields" hint and the terminal fallback. Every icon is
// a registered id, so the user's word and glyph apply; each sentence is
// spoken only (aria-label / pill text).
import type { CommandSpec } from '../api/contract'
import { iconInline } from '../icons/render'
import { h } from '../lib/dom'
import { commandLine, notice, pill } from '../ui/build'
/** The countdown flag plus the minutes (a number, so painted); the word is spoken only. */
function countdownPill(seconds: number): HTMLSpanElement {
const minutes = Math.round(seconds / 60)
const el = pill('warning', `${minutes} min countdown`, 'cmdflag.countdown')
el.append(h('span', { class: 'pill-num', 'aria-hidden': 'true' }, `${minutes}′`))
return el
}
/** What the command is: root, state-changing or read-only, cancellable, countdown. */
export function commandFlags(spec: CommandSpec): (HTMLSpanElement | null)[] {
const countdown = spec.friction?.countdown_seconds
return [
spec.privileged ? pill('neutral', 'Runs as root via the daemon', 'cmdflag.root') : null,
spec.mutating ? pill('neutral', 'Changes state', 'cmdflag.mutating') : pill('neutral', 'Read-only', 'cmdflag.readonly'),
spec.cancellable ? pill('neutral', 'Cancellable', 'cmdflag.cancellable') : null,
countdown ? countdownPill(countdown) : null,
]
}
/** Warning notice painted with the lock mark; the server's lock reason is spoken only. */
export function lockedNotice(reason: string): HTMLDivElement {
const el = notice('warning', null)
const mark = iconInline('state.locked', 'notice-icon')
if (mark.classList.contains('icon-inline')) mark.classList.add('notice-mark')
el.firstElementChild?.replaceWith(mark)
el.setAttribute('aria-label', `Locked: ${reason}`)
return el
}
/** Info notice: fill the fields above first; the sentence is spoken only. */
export function fillHint(missing: readonly string[]): HTMLDivElement {
const hint = notice('info', null, iconInline('runner.fill'))
hint.setAttribute('aria-label', `Fill in the fields above to see the exact phrase (${missing.join(', ')}).`)
return hint
}
/** The terminal command to run when the daemon cannot be reached. */
export function terminalFallback(command: string): HTMLElement[] {
return [h('p', { class: 'm0', 'aria-label': 'Run it from a terminal instead:' }, iconInline('runner.terminal')), commandLine(command)]
}

View File

@ -7,7 +7,9 @@
import { api } from '../api/client'
import type { JobProgress as Progress, JobState } from '../api/jobContract'
import { q } from '../api/queries'
import { COMMAND_ICON, commandLabel, findCommand } from '../commands/catalog'
import { commandIcon, commandLabel, findCommand } from '../commands/catalog'
import type { IconId } from '../icons/registry'
import { iconInline } from '../icons/render'
import { Action } from '../lib/action'
import { define, h } from '../lib/dom'
import { LiveElement } from '../lib/element'
@ -26,11 +28,11 @@ export function eta(p: Progress, live: LiveJob, now: number): number | null {
}
const DONE: ReadonlySet<JobState> = new Set(['succeeded', 'failed', 'cancelled'])
const DONE_LABEL: Record<'succeeded' | 'failed' | 'cancelled', string> = {
succeeded: '✅',
failed: '⛔',
cancelled: '🚫',
}
const DONE_LABEL = {
succeeded: 'job.state.succeeded',
failed: 'job.state.failed',
cancelled: 'job.state.cancelled',
} as const satisfies Record<'succeeded' | 'failed' | 'cancelled', IconId>
const isDone = (s: JobState): s is keyof typeof DONE_LABEL => DONE.has(s)
export class JobProgressElement extends LiveElement {
@ -130,8 +132,8 @@ export class JobProgressElement extends LiveElement {
f.section.className = compact ? 'job job-compact' : 'job'
f.section.dataset.state = state
f.section.setAttribute('aria-label', `Job ${job ? commandLabel(job.command) : id}`)
// Textgate: the command's glyph painted, its name spoken.
f.title.replaceChildren(...(job ? [glyph(COMMAND_ICON[job.command], title)] : []))
// Textgate: the command's glyph (and its word) painted, its name spoken.
f.title.replaceChildren(...(job ? [glyph(commandIcon(job.command), title)] : []))
f.badge.replaceChildren(stateBadge(state))
f.meta.replaceChildren(
job ? duration(job.started_at, job.ended_at, now) : '',
@ -148,7 +150,7 @@ export class JobProgressElement extends LiveElement {
h(
'span',
{ class: 'job-label' },
isDone(state) ? DONE_LABEL[state] : waiting ? '⏳' : progress ? '▶️' : '',
isDone(state) ? iconInline(DONE_LABEL[state]) : waiting ? iconInline('jobs.waiting') : progress ? iconInline('job.state.running') : '',
progress?.label && !finished ? h('span', { class: 'sr-only' }, progress.label) : null,
),
!finished && progress && progress.total !== null
@ -188,7 +190,7 @@ export class JobProgressElement extends LiveElement {
h(
'button',
{ type: 'button', class: 'btn btn-ghost', disabled: this.cancel.pending, onclick: () => void this.cancel.run(), 'aria-label': this.cancel.pending ? 'Cancelling…' : 'Cancel job' },
this.cancel.pending ? '⏳' : '✕',
iconInline(this.cancel.pending ? 'state.wait' : 'jobs.cancel'),
),
),
]
@ -209,7 +211,7 @@ export class JobProgressElement extends LiveElement {
private updateLog(f: NonNullable<JobProgressElement['frame']>, live: LiveJob, finished: boolean, compact: boolean): void {
const logs = live.logs
f.summary.replaceChildren(
h('span', { class: 'log-count-icon', 'aria-hidden': 'true' }, '📋'),
iconInline('jobs.log', 'log-count-icon'),
h('span', { class: 'log-count', 'aria-hidden': 'true' }, String(logs.length)),
)
f.summary.setAttribute('aria-label', `${logs.length} lines`)

View File

@ -0,0 +1,89 @@
// Pass 2 wiring for the jobs page, the job view, the prompt form and the
// top-bar job chip: ledger words right of the icons, chosen glyphs applied,
// accessible names unchanged.
import { screen } from '@testing-library/dom'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import type { PromptEvent } from './hub'
import { promptForm } from './promptForm'
import { jobChip } from '../shell/jobIndicator'
import '../sections/jobs'
import { makeJob, makeSpec } from '../test/fixtures'
import { installEventSource, mount, stubApi } from '../test/harness'
import { useIcons } from '../test/iconLedger'
import { mountJob } from '../test/jobHelpers'
beforeEach(installEventSource)
const word = (el: Element | null | undefined) => el?.nextElementSibling?.textContent
const prompt = (over: Partial<PromptEvent>): PromptEvent => ({
seq: 1, ts: 't', type: 'prompt', prompt_id: 'q1', kind: 'confirm', message: 'Sure?', ...over,
})
describe('job view icons', () => {
it('the title shows the command word and chosen glyph (cmd id), the name stays spoken', async () => {
useIcons({ 'cmd.scan': { word: 'survey', glyph: '🛰️' } })
const { el } = mountJob({ job: { state: 'running' } })
await vi.waitFor(() => { expect(el.querySelector('h3 .sr-only')).toHaveTextContent('Scan') })
const icon = el.querySelector('h3 [data-icon="cmd.scan"]')
expect(icon?.textContent).toBe('🛰️')
expect(word(icon)).toBe('Survey')
})
it('the phase mark, the log count and the cancel button use their ids', async () => {
useIcons({ 'job.state.running': { word: 'busy' }, 'jobs.log': { word: 'log' }, 'jobs.cancel': { word: 'stop' } })
const { el, send } = mountJob({ job: { state: 'running' }, cancellable: true })
send('progress', { step: 1, total: 3, label: 'Working' })
await vi.waitFor(() => { expect(el.querySelector('.job-label [data-icon="job.state.running"]')).not.toBeNull() })
expect(word(el.querySelector('.job-label [data-icon="job.state.running"]'))).toBe('Busy')
expect(word(el.querySelector('summary [data-icon="jobs.log"]'))).toBe('Log')
await vi.waitFor(() => { expect(screen.getByRole('button', { name: 'Cancel job' })).toBeInTheDocument() })
expect(word(screen.getByRole('button', { name: 'Cancel job' }).querySelector('[data-icon="jobs.cancel"]'))).toBe('Stop')
})
})
describe('jobs page icons', () => {
it('the history headers paint their words, the column names stay spoken', async () => {
history.replaceState({}, '', '/jobs/')
useIcons({ 'jobs.took': { word: 'duration', glyph: '⌛' } })
stubApi({ 'GET /api/jobs': [makeJob({ id: 'a' })], 'GET /api/commands': [makeSpec('scan')] })
mount('<jobs-page></jobs-page>')
const took = (await screen.findByText('Took', { selector: 'th .sr-only' })).closest('th')
expect(took?.querySelector('[data-icon="jobs.took"]')?.textContent).toBe('⌛')
expect(word(took?.querySelector('[data-icon="jobs.took"]'))).toBe('Duration')
})
})
describe('prompt form icons', () => {
it('Yes and No buttons keep their aria-labels and paint their words', () => {
useIcons({ 'prompt.yes': { word: 'agree' }, 'prompt.no': { word: 'refuse', glyph: '👎' } })
const form = promptForm('j', prompt({}))
document.body.append(form)
const yes = screen.getByRole('button', { name: 'Yes' })
expect(word(yes.querySelector('[data-icon="prompt.yes"]'))).toBe('Agree')
const no = screen.getByRole('button', { name: 'No' })
expect(no.querySelector('[data-icon="prompt.no"]')?.textContent).toBe('👎')
expect(word(no.querySelector('[data-icon="prompt.no"]'))).toBe('Refuse')
})
it('the question mark and the answer button follow the ledger', () => {
useIcons({ 'prompt.question': { word: 'ask' }, 'prompt.answer': { word: 'send', glyph: '📤' } })
const form = promptForm('j', prompt({ kind: 'text' }))
document.body.append(form)
expect(word(form.querySelector('[data-icon="prompt.question"]'))).toBe('Ask')
const answer = screen.getByRole('button', { name: 'Answer' })
expect(answer.querySelector('[data-icon="prompt.answer"]')?.textContent).toBe('📤')
expect(word(answer.querySelector('[data-icon="prompt.answer"]'))).toBe('Send')
})
})
describe('job chip icon', () => {
it('the needs-input mark paints its word, the aria-label keeps the sentence', () => {
useIcons({ 'jobchip.needs-input': { word: 'answer', glyph: '🙋' } })
const chip = jobChip(makeJob({ id: 'chip-wait', command: 'scan', state: 'waiting_input' }))
const mark = chip.querySelector('[data-icon="jobchip.needs-input"]')
expect(mark?.textContent).toBe('🙋')
expect(word(mark)).toBe('Answer')
expect(chip).toHaveAttribute('aria-label', 'Scan: needs your input')
})
})

View File

@ -8,15 +8,17 @@ import { q } from '../api/queries'
import { phraseMatches } from '../commands/catalog'
import { PhraseField } from '../commands/phraseField'
import { Action } from '../lib/action'
import type { IconId } from '../icons/registry'
import { iconInline } from '../icons/render'
import { h, hx } from '../lib/dom'
import type { GameBrowserElement } from '../library/pick'
import { errorNotice, glyph } from '../ui/build'
import { hub, type PromptEvent } from './hub'
/** A glyph-only button: `icon` painted, `spoken` its accessible name. */
function sendButton(btn: HTMLButtonElement, spoken: string, icon: string): void {
function sendButton(btn: HTMLButtonElement, spoken: string, icon: IconId): void {
btn.setAttribute('aria-label', spoken)
btn.textContent = icon
btn.replaceChildren(iconInline(icon))
}
function answerAction(jobId: string, prompt: PromptEvent, onChange: () => void): Action<[string], void> {
@ -40,8 +42,8 @@ function answerForm(jobId: string, prompt: PromptEvent): HTMLFormElement {
const submit = (v: string = value) => {
void send.run(v)
}
// Textgate: the server's question is spoken; ❓ marks that the job waits on you.
const form = h('form', { class: 'prompt', 'aria-label': 'Job question' }, h('p', { class: 'prompt-msg' }, glyph('❓', prompt.message)))
// Textgate: the server's question is spoken; the question icon marks that the job waits on you.
const form = h('form', { class: 'prompt', 'aria-label': 'Job question' }, h('p', { class: 'prompt-msg' }, glyph('prompt.question', prompt.message)))
form.addEventListener('submit', (e) => {
e.preventDefault()
if (ready()) submit()
@ -65,7 +67,7 @@ function answerForm(jobId: string, prompt: PromptEvent): HTMLFormElement {
{ class: 'choice' },
radio,
// Option labels are game names (content); the "own game" escape is a glyph.
o.value === 'own' ? glyph('🗂️', o.label, 'choice-label') : h('span', { class: 'choice-label' }, o.label),
o.value === 'own' ? glyph('prompt.own-game', o.label, 'choice-label') : h('span', { class: 'choice-label' }, o.label),
o.detail ? h('span', { class: 'choice-detail sr-only' }, o.detail) : null,
)
label.dataset.value = o.value
@ -103,14 +105,14 @@ function answerForm(jobId: string, prompt: PromptEvent): HTMLFormElement {
errorSlot.replaceChildren(...(send.error ? [errorNotice(send.error)] : []))
if (prompt.kind === 'confirm') {
actions.replaceChildren(
h('button', { type: 'button', class: 'btn btn-primary', 'aria-label': 'Yes', autofocus: prompt.default !== 'no', disabled: send.pending, onclick: () => { submit('yes') } }, '✔️'),
h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'No', autofocus: prompt.default === 'no', disabled: send.pending, onclick: () => { submit('no') } }, '✖️'),
h('button', { type: 'button', class: 'btn btn-primary', 'aria-label': 'Yes', autofocus: prompt.default !== 'no', disabled: send.pending, onclick: () => { submit('yes') } }, iconInline('prompt.yes')),
h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'No', autofocus: prompt.default === 'no', disabled: send.pending, onclick: () => { submit('no') } }, iconInline('prompt.no')),
)
return
}
const btn = actions.querySelector('button') ?? actions.appendChild(h('button', { type: 'submit', class: 'btn btn-primary' }))
btn.disabled = !ready() || send.pending
sendButton(btn, send.pending ? 'Sending…' : 'Answer', send.pending ? '⏳' : '↵')
sendButton(btn, send.pending ? 'Sending…' : 'Answer', send.pending ? 'state.wait' : 'prompt.answer')
}
refresh()
return form
@ -135,7 +137,7 @@ function gamePrompt(jobId: string, prompt: PromptEvent): HTMLFormElement {
}
browser.pick = { appIds, selected, onSelect: pick }
const pickBtn = h('button', { type: 'submit', class: 'btn btn-primary' })
const backBtn = h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Back to the list', onclick: () => void send.run('') }, '↩️')
const backBtn = h('button', { type: 'button', class: 'btn btn-ghost', 'aria-label': 'Back to the list', onclick: () => void send.run('') }, iconInline('prompt.back'))
const errorSlot = h('div', { class: 'contents' })
const form = h(
'form',
@ -143,9 +145,9 @@ function gamePrompt(jobId: string, prompt: PromptEvent): HTMLFormElement {
h(
'p',
{ class: 'prompt-msg' },
glyph('❓', prompt.message),
glyph('prompt.question', prompt.message),
' ',
h('span', { class: 'muted' }, h('span', { 'aria-hidden': 'true' }, `· 🎮 ${appIds.size}`), h('span', { class: 'sr-only' }, `· ${appIds.size} games can be picked`)),
h('span', { class: 'muted' }, h('span', { 'aria-hidden': 'true' }, '· ', iconInline('prompt.games'), ` ${appIds.size}`), h('span', { class: 'sr-only' }, `· ${appIds.size} games can be picked`)),
),
browser,
errorSlot,
@ -159,12 +161,12 @@ function gamePrompt(jobId: string, prompt: PromptEvent): HTMLFormElement {
function refresh(): void {
const name = q.library.state.data?.games.find((g) => g.app_id === selected)?.name ?? String(selected)
pickBtn.disabled = selected === null || send.pending
// 🎯 + the chosen game's name (content) painted; the verb is spoken.
if (send.pending) sendButton(pickBtn, 'Sending…', '⏳')
else if (selected === null) sendButton(pickBtn, 'Select a game', '🎯')
// The pick icon + the chosen game's name (content) painted; the verb is spoken.
if (send.pending) sendButton(pickBtn, 'Sending…', 'state.wait')
else if (selected === null) sendButton(pickBtn, 'Select a game', 'prompt.pick')
else {
pickBtn.setAttribute('aria-label', `Pick ${name}`)
pickBtn.replaceChildren(h('span', { 'aria-hidden': 'true' }, `🎯 ${name}`))
pickBtn.replaceChildren(h('span', { 'aria-hidden': 'true' }, iconInline('prompt.pick'), ` ${name}`))
}
backBtn.disabled = send.pending
errorSlot.replaceChildren(...(send.error ? [errorNotice(send.error)] : []))

View File

@ -7,6 +7,7 @@ import { explain } from '../api/errors'
import type { Job } from '../api/jobContract'
import { q } from '../api/queries'
import { commandIcon, commandLabel } from '../commands/catalog'
import { iconInline } from '../icons/render'
import '../jobs/jobProgress'
import { stateBadge } from '../jobs/progress'
import { define, h, hx } from '../lib/dom'
@ -86,10 +87,10 @@ export class JobListElement extends LiveElement {
h(
'tr',
{},
h('th', { scope: 'col' }, glyph('⌨️', 'Command')),
h('th', { scope: 'col' }, glyph('🚦', 'State')),
h('th', { scope: 'col' }, glyph('🕐', 'Started')),
h('th', { scope: 'col', class: 'num' }, glyph('⏱️', 'Took')),
h('th', { scope: 'col' }, glyph('jobs.command', 'Command')),
h('th', { scope: 'col' }, glyph('jobs.state', 'State')),
h('th', { scope: 'col' }, glyph('jobs.started', 'Started')),
h('th', { scope: 'col', class: 'num' }, glyph('jobs.took', 'Took')),
),
),
this.body,
@ -125,12 +126,12 @@ export class JobListElement extends LiveElement {
}
function notFound(id: string, error: ApiFailure): HTMLDivElement {
// ❓ + the id painted; the explanation and the server's message are spoken.
// The not-found icon + the id painted; the explanation and the server's message are spoken.
const el = notice(
'warning',
null,
h('p', { class: 'm0' }, h('span', { 'aria-hidden': 'true' }, '❓ '), h('span', { class: 'mono' }, id)),
h('p', { class: 'm0' }, link(pageHref('/jobs'), glyph('📋', 'See all jobs'), '')),
h('p', { class: 'm0' }, h('span', { 'aria-hidden': 'true' }, iconInline('jobs.not-found'), ' '), h('span', { class: 'mono' }, id)),
h('p', { class: 'm0' }, link(pageHref('/jobs'), glyph('jobs.all', 'See all jobs'), '')),
)
el.dataset.code = 'not_found'
el.setAttribute('aria-label', `Job not found. There is no job ${id}. It may have been pruned: the history keeps the last 50.${error.message ? ` ${error.message}` : ''}`)
@ -155,7 +156,7 @@ export class JobDetailElement extends LiveElement {
this.sub = h('p', { class: 'sub' })
this.status = h('div', { class: 'contents' })
this.mounted = false
this.replaceChildren(pageHead(this.heading, this.sub, link(pageHref('/jobs'), glyph('📋', 'All jobs'), 'btn btn-ghost')), this.status)
this.replaceChildren(pageHead(this.heading, this.sub, link(pageHref('/jobs'), glyph('jobs.all', 'All jobs'), 'btn btn-ghost')), this.status)
// Subscribed by hand, not via watch(): an unknown id stops polling.
let live = true
const off = q.job(this.jobId).subscribe(() => {
@ -172,12 +173,12 @@ export class JobDetailElement extends LiveElement {
const id = this.jobId
const { data, error, loading: waiting } = q.job(id).state
const missing = !data && error instanceof ApiFailure && error.code === 'not_found' ? error : null
// Heading: the command's glyph (❓ when the id is unknown, ⚙️ while loading), name spoken.
this.heading.replaceChildren(data ? commandGlyph(data.command) : missing ? glyph('❓', 'Job not found') : glyph('⚙️', 'Job'))
// Heading: the command's glyph (the not-found icon when the id is unknown, the job icon while loading), name spoken.
this.heading.replaceChildren(data ? commandGlyph(data.command) : missing ? glyph('jobs.not-found', 'Job not found') : glyph('jobs.job', 'Job'))
this.sub.replaceChildren(
h('span', { class: 'sr-only' }, 'Job '),
h('span', { class: 'mono' }, id),
data ? h('span', {}, h('span', { 'aria-hidden': 'true' }, ' · 🕐 '), h('span', { class: 'sr-only' }, ' · created '), dateTime(data.created_at)) : '',
data ? h('span', {}, h('span', { 'aria-hidden': 'true' }, ' · ', iconInline('jobs.started'), ' '), h('span', { class: 'sr-only' }, ' · created '), dateTime(data.created_at)) : '',
)
this.status.replaceChildren(
...(missing ? [notFound(id, missing)] : error ? [errorNotice(error)] : waiting ? [loading('job')] : []),