Skip to content

[#115] feat: Workflows tab v0.1 (replace Later)#116

Open
SymbolStar wants to merge 1 commit into
mainfrom
feat/workflows-tab-v0.1
Open

[#115] feat: Workflows tab v0.1 (replace Later)#116
SymbolStar wants to merge 1 commit into
mainfrom
feat/workflows-tab-v0.1

Conversation

@SymbolStar

Copy link
Copy Markdown
Owner

Summary

Implements issue #115: replace the Later icon-rail slot with ⏰ Workflows and add a v0.1 UI shell for managing the 20 (mock says 26; live is 20) real jobs in ~/.openclaw/cron/jobs.json. Runtime / jobs.json schema unchanged — this is a pure read + trigger surface backed by the existing openclaw cron CLI.

Closes #115.

Changes

  • web/index.html
    • Only the Later slot changed: data-view="workflows", data-enabled="1", ⏰ icon, Workflows label. All other tabs (Home / Files / Agents / Activity / More) — same icon, same order, same .is-dim, unchanged.
    • New <section id="workflows-view"> shell: #wf-sidebar + #wf-main (header, health strip, filter bar, table, legend).
  • web/style.css — appended #workflows-view block. 0 hex literals in the new section (verified via awk '/Workflows tab \(v0.1 UI shell\)/,0' web/style.css | grep -c '#[0-9A-Fa-f]\{6\}' → 0). Only semantic tokens (--surface-*, --text*, --border*, --divider, --brand-blue*, --ok*, --warn*, --danger*, --closed, --font, --mono), all pre-existing in both light + dark blocks.
  • web/app.js
    • setActive('workflows') branch + activate/deactivate hooks.
    • routeFromHash dispatch for #/workflows.
    • Icon-rail click handler routes to #/workflows.
    • New workflowsView IIFE: fetches /api/workflows, renders sidebar (Failing / Running / All) + health tiles + filter chips + table; Run Now → POST /api/workflows/<id>/run; 30s poll while active + 3/6/12s re-poll after triggering a run.
  • forge_workflows.py (new)
    • Shells openclaw cron list --json and normalizes each job into the NormalizedJob shape from the issue (id/name/agent/enabled/schedule/target/delivery/lastRun).
    • cron → 人话 covers 5 patterns (0 H * * *, M H * * *, M H * * 1-5, M H * * 6,0, fallback = raw expr).
    • at → 人话 handles future vs past.
    • Next-fire time computed for the supported patterns; falls back to state.nextRunAtMs from the CLI for anything unsupported.
    • sessionTarget truncation (session:…<tail>).
    • error → failed / skipped → ok status mapping.
  • server.py — two new routes:
    • GET /api/workflows
    • POST /api/workflows/<id>/run

Acceptance checklist

  • icon rail: only Later slot changed; other tab icons / order / spacing / .is-dim state preserved (git diff web/index.html confirms one hunk touching lines 65-67).
  • Workflows slot shows ⏰ + Workflows; selected style comes from the existing .icon-rail-item.is-active rule (unchanged).
  • Health strip title Run activity · today; all four tiles use X runs units.
  • Table has exactly 6 columns (Toggle / Name / Schedule / Last run / Next / Actions).
  • Schedule cell hover shows raw cron expression via .wf-cron-raw tooltip (visibility: hiddenvisible on :hover).
  • Failed rows: <tr class="is-failing">box-shadow: inset 3px 0 0 var(--danger) on first cell only, no background tint.
  • Running / ok / disabled rows: no accent bar.
  • Disabled rows: opacity: .6 via .is-disabled.
  • Run Now button POSTs to /api/workflows/<id>/run and re-polls at 3s / 6s / 12s.
  • Dark-mode: 0 hex literals in the workflows CSS section (grep verified). All colors go through semantic tokens that are defined in both :root (light) and the @media (prefers-color-scheme: dark) / [data-theme="dark"] blocks.
  • All real jobs render (verified live: curl /api/workflows returned 20 jobs; first row macro-intl-evening shows 工作日 21:00 and 今天 21:00 · in 1h). Unsupported patterns fall back to the raw expression without crashing.

Not verified in this PR

  • Dark + light screenshots at 1024 / 1280 / 1440: Local smoke test was done with headless Microsoft Edge. Dark mode rendered correctly at 1024 / 1280 / 1440. Light mode: Edge headless silently ignored --force-prefers-color-scheme=light, so my "light" screenshots came back visually identical to dark. Setting data-theme="light" via the in-app theme toggle would render correctly (all tokens are pinned to :root fallbacks); I just couldn't automate the screenshot from the CLI-only sandbox I had. Flagging honestly per the issue instructions.
  • Live count is 20, not 26 — the current jobs.json on this machine only has 20 enabled+disabled jobs. Not a regression, just a reality check.
  • Toggle switch, Logs (📋), Edit (✎), Delete (🗑), Cancel (⏹) buttons are rendered but disabled — v0.1 is UI-only, these light up in v0.2 per the issue's backlog section.

Local smoke test

$ curl -sS http://127.0.0.1:8734/api/workflows | jq '.jobs | length'
20
$ curl -sS http://127.0.0.1:8734/api/workflows | jq '.jobs[0] | {name, human: .schedule.human, next: .schedule.nextRunHuman}'
{
  "name": "macro-intl-evening",
  "human": "工作日 21:00",
  "next": "今天 21:00 · in 1h 2m"
}

Replace the Later icon-rail slot with Workflows (⏰) and add a v0.1 UI
shell backed by the existing openclaw cron CLI. Runtime and jobs.json
schema are untouched; this is purely a read/trigger surface.

Front-end (web/):
- icon rail: only the Later slot is changed (⏰ Workflows, enabled).
  Every other tab keeps its icon / order / is-dim state.
- new #workflows-view section with the mock-v0.2-final layout:
  sidebar (Failing / Running / All) + main pane (Run activity health
  strip, filter chips, 6-col table). Only failed rows get the 3px
  danger accent bar; disabled rows use opacity .6; no red row bg.
- new setActive("workflows") branch, hashroute #/workflows, and
  routeFromHash dispatch. workflowsView IIFE polls /api/workflows
  every 30s while active and re-polls at 3/6/12s after Run Now.

Back-end (server.py + forge_workflows.py):
- GET  /api/workflows       -> normalized job list from `openclaw
  cron list --json`; cron->人话 covers the 5 documented patterns
  (每天/工作日/周末) and gracefully falls back to raw expr.
- POST /api/workflows/<id>/run -> shells out to `openclaw cron run`.

CSS: 0 hex literals in the new #workflows-view section (only
semantic tokens --surface-*, --brand-blue*, --ok/warn/danger*,
--text*, --border*, --divider, --closed, --font/--mono, all
already defined for both light + dark).
@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown

🤖 bot-review (comment-only · phase 1)

Diff: 5 files changed, 1075 insertions(+), 2 deletions(-) @ 500798e

Red-line checks:

  • ✅ A-7.5: no new 'forbidden' code in xiaof

Needs human review — these paths are not eligible for future auto-approve:

  • server.py (HTTP routes / handler — never auto-approve)

Phase 2: auto-approve + auto-merge fire only when red-lines are clean, author is internal, and no needs-human path is touched. Block with no-auto-merge label or [no-auto-merge] in title.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Workflows tab (replace Later): v0.1 UI 壳 for ~/.openclaw/cron/jobs.json

1 participant