Draw Activity runs as duration bars

Merged
RY
2mo ago
+495-40

Fix Activity view drawing every run as a single line

Fixes #3218

The lanes in the Activity view drew each run as a fixed-width mark at its start time, so a run that took almost two hours looked the same as one that took a second. Each run is now drawn as a bar from its start to its end. A finished run ends at finishedAt, and a running or waiting run grows to the current time. Queued runs, and runs with no end time, keep a thin mark. Very short runs keep a minimum width so they stay visible and clickable.

Hover, keyboard navigation and click behavior are unchanged; they still key off the run's start.

Tests

  • runEnd unit tests for finished, running and queued runs
  • ActivityLanes test that a run lasting a quarter of the range renders a bar 25% wide
  • pnpm vitest run src/features/activity, tsc --noEmit, eslint and prettier on the changed files

Summary by cubic

Draws Activity runs as duration bars so run length is visible at a glance. Previously every run was a fixed-width mark at its start time, so a two-hour run looked like a one-second run.

Finished runs end at finishedAt; running and waiting runs extend to the current time. Queued runs and runs with no end time keep a thin mark, and very short runs keep a minimum width. Runs extending into the window from before it start at the window's edge, and back-to-back runs are separated by a thin gap so they don't merge. Hover, keyboard focus, and click now work anywhere along the bar, and hit-testing matches the drawn mark: a pointer inside a mark's drawn box picks it, with the topmost mark winning where they overlap. The tooltip shows how long a running run has run so far. Clicking still opens the run.

The empty states now count in-progress runs that began before the window, so a run still going is no longer hidden by "No runs" or "No workflows match the filter."

The Overview day picker now reads the picked date as that day in the server's time zone instead of the browser's, so a browser ahead of the server no longer loads the previous day.

Summary by CodeRabbit

  • Bug Fixes
    • Activity lane marks now reflect each run’s duration instead of appearing as fixed-width ticks.
    • In-progress runs extend to the current time, and longer runs display across their full duration.
    • Active runs that began before the displayed time window remain visible, with elapsed duration shown. Runs can be opened by clicking anywhere along their displayed span.
    • Unloaded time is shaded correctly when active runs began before the displayed window.
    • Selecting a calendar day now applies the server time-zone offset while preserving the selected date’s local time.