feat(desktop): redesign automations dashboard with stats, grouped list, and cleaner top bar

Merged
KI
3mo ago
+1041-509

Links

  • Plan: apps/desktop/plans/automations-ui-improvements.md (this PR ships Phase 1 + the layout redesign; Phases 2-4 deferred)

Summary

  • Redesigns the automations list page modeled on Cursor Automations and OpenAI Codex Scheduled tasks, after a competitive UX research pass (screenshot corpus referenced in the plan doc).
  • Adds glanceable health: stat cards (Active / Created·7d / Failed·7d with success percentages), last-run relative times, and a Codex-style "Up next" grouping ordered by soonest run.
  • Cleans the board: Workspace/Device/Agent columns removed (uniform values, still editable on the detail page), project folded into the name cell as a muted tag, dispatch wording changed to "created/creating" — a run's terminal success state is workspace creation.

Why / Context

The list previously answered neither "is this working?" nor "what happens next": last run rendered as a bare ran/failed word with no timestamp, nextRunAt was synced on every row but never shown, pause required opening each automation, and 9 columns of mostly-uniform data buried the signal. Competitor research (Cursor, Codex, ChatGPT Tasks, Devin, n8n, Windmill, Kestra, Dagster, Val Town...) converged on: few columns, health stats up top, soonest-run-first ordering, and calm failure surfacing.

How It Works

  • Layout: content in a centered max-w-5xl column (page title → stat cards → Mine/Team tabs + retry-all + search → table in a rounded card → dismissible CLI hint footnote). Window chrome is a bare drag-leaf strip, per the drag-region rule.
  • Stats are client-side aggregates over the Electric-synced automation_runs collection, scoped to the active tab; no new queries to the server.
  • Default (unsorted) table body groups rows into "Up next" (enabled, sorted by nextRunAt asc) and "Paused" sections; clicking any sortable header switches to a flat sorted list.
  • The Failed stat card is a filter toggle for automations whose latest run failed; it renders inert (with an explanatory tooltip) when nothing is currently failing, and self-clears when failures resolve.
  • Status column shows Active · in 2h / Paused (countdown via a shared 30s ticking clock passed down from the page — no per-row timers); the absolute next-run time in the automation's timezone is on hover.
  • useFailedAutomations now also exposes lastRunAtById (it already computed the timestamps internally).

Manual QA Checklist

Verified end-to-end over CDP against the running dev app with real org data (screenshots captured at each step):

  • Dashboard renders with real data: cards showed Active 9 / Created·7d 35 · 63.6% / Failed·7d 20 · 36.4%
  • "Up next" ordering matches next-run times (soon → in 21h → in 2d → in 22d), paused rows grouped below
  • Search live-filters (typing "docs" → exactly 1 row), cleared afterwards
  • Row context menu shows Pause (enabled rows) via trusted right-click
  • Status hover shows absolute next-run time; last-run hover shows absolute timestamp
  • Rows still render from cached data while the collection is not yet isReady (readiness only gates loading/empty states)
  • Failed-card filter click-through — could not be exercised live: no automation's latest run is currently failing, so the card was correctly disabled (logic is code-reviewed + the disabled/tooltip state was verified live)
  • Empty states — not reachable with existing data; code-reviewed only
  • Pause/Resume mutation from the row menu — deliberately not clicked to avoid mutating real automations; it calls the same automation.setEnabled the detail page already uses

Testing

  • bun run typecheck
  • bun run lint
  • Manual CDP verification as above

Design Decisions

  • "created" instead of "ran": runs don't complete — they create a workspace; dispatched is the terminal success state, so the UI now says so instead of implying a finished job.
  • Countdown inside Status rather than a Next-run column: keeps the column budget minimal while making the "Up next" ordering legible (Codex's "Starts in 13m" pattern).
  • Sections only in the default view: grouping and column sorting compose badly; sorting flattens, clearing sort restores groups.
  • Failed % muted, not red: matches Cursor; the red alarm lives on failing rows and the sidebar badge instead of permanent dashboard chrome.

Known Limitations

  • Stat percentages use runs-in-last-7-days as the denominator while the Failed card's filter targets currently-failing automations — the card tooltip explains the distinction when they diverge.
  • Run error text is still a hover tooltip (pre-existing); moving it to selectable text is part of the plan's Phase 3.

Follow-ups (in the plan doc)

  • Phase 2: in-chat creation via the existing automations_* MCP tools (NL box → drafting chat → confirmation card)
  • Phase 3: Run History tab as a review queue + "Run History →" stat card
  • Phase 4: SchedulePicker validation/preview + consecutive-failure circuit breaker

Summary by cubic

Redesigned the Automations dashboard with stat cards, a grouped list (Needs attention → Up next → Paused), and a cleaner top bar. The table is slimmer, searchable, and adds run‑now, pause/resume, last‑run links, and a sticky header.

  • New Features

    • Stat cards: Active / Created·7d / Failed·7d with muted percentages; Failed card toggles a failing-only filter and self‑clears.
    • Default grouped view with “Needs attention” pinned; sorting switches to a flat list.
    • Status shows “Active · in Xm” with a countdown; hover reveals the absolute next run time in the automation’s timezone.
    • Last run shows “created/creating” with relative time; click opens the run’s workspace (deep‑links the session) with clearer failure tooltips.
    • Live name search; “Retry all” when viewing Mine with failures; Run now on hover for owned rows; skeleton loading; minimal empty state with per‑category template suggestions.
  • Refactors

    • Removed Workspace/Device/Agent columns; project appears as a muted tag next to the name; project‑less automations show a “Session” tag.
    • useFailedAutomations now exposes lastRunById (status, timestamp, and workspace/session ids); stats computed client‑side from synced runs (no new server queries).
    • Widened the actions column to prevent button overlap; sticky table header restored; search input has an aria‑label; improved tooltips on the Failed stat card.

Summary by CodeRabbit

  • New Features

    • Redesigned the automations dashboard with active, recently created, and failed-run statistics.
    • Added search, failure filtering, “Mine” and “Team” views, sorting, loading states, and run-now controls.
    • Added pause/resume controls and clearer scheduling, status, and last-run details.
    • Completed runs can open their associated workspace and session.
    • Improved empty states with creation actions, documentation access, and suggested templates.
  • Documentation

    • Added plans for automation onboarding, scheduling, run reviews, and future UI enhancements.
  • Usability

    • Simplified template selection and improved accessible button interactions.