feat(run-details-panel): enhance run details display and error handling

- Improved the layout and readability of the run details panel by restructuring sections and adding collapsible error views.
- Introduced a new `RunErrorSection` component to present run-level errors more clearly, allowing users to toggle raw error details.
- Updated the handling of run outputs, step results, and artifacts for better user experience.
- Refactored duration calculation in `RunRow` to utilize a dedicated `formatDuration` function for consistency.
- Added a new `RunStepResult` interface to improve type safety and clarity in handling step results.
This commit is contained in:
DESKTOP-RTLN3BA\$punk 2026-05-29 13:43:58 -07:00
parent cb2e33e083
commit fade9d1b9d
5 changed files with 268 additions and 44 deletions

View file

@ -0,0 +1,19 @@
/**
* Format the wall-clock duration between a run/step's start and finish
* timestamps into a compact, human-readable label (e.g. `850ms`, `4.2s`,
* `1m 30s`). Returns `null` when either bound is missing or the delta is
* negative/non-finite, so callers can simply omit the label.
*/
export function formatDuration(
started: string | null | undefined,
finished: string | null | undefined
): string | null {
if (!started || !finished) return null;
const ms = new Date(finished).getTime() - new Date(started).getTime();
if (!Number.isFinite(ms) || ms < 0) return null;
if (ms < 1000) return `${ms}ms`;
if (ms < 60_000) return `${(ms / 1000).toFixed(1)}s`;
const minutes = Math.floor(ms / 60_000);
const seconds = Math.floor((ms % 60_000) / 1000);
return `${minutes}m ${seconds}s`;
}