feat: Cancel specific run from dashboard#313
feat: Cancel specific run from dashboard#313jamescmartinez merged 1 commit intoopenworkflowdev:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a "Cancel Run" feature to the workflow run details page in the dashboard, allowing users to cancel workflow runs that are in pending, running, or sleeping states. The implementation includes a new reusable component with a confirmation dialog, backend API integration, and status utility functions.
Changes:
- Added a new
RunCancelActioncomponent that displays a destructive action button and confirmation dialog for canceling workflow runs - Introduced API endpoint
cancelWorkflowRunServerFnto handle workflow run cancellation via the backend - Added
CANCELABLE_RUN_STATUSESconstant andisRunCancelableStatushelper function to determine which runs can be canceled
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/dashboard/src/components/run-cancel-action.tsx | New component implementing the cancel run UI with AlertDialog confirmation and error handling |
| packages/dashboard/src/lib/api.ts | Added cancelWorkflowRunServerFn server function to call backend's cancelWorkflowRun method |
| packages/dashboard/src/lib/status.ts | Added CANCELABLE_RUN_STATUSES constant and isRunCancelableStatus utility function |
| packages/dashboard/src/routes/runs/$runId.tsx | Integrated RunCancelAction component into run details page with router invalidation on successful cancellation |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| </AlertDialogDescription> | ||
| </AlertDialogHeader> | ||
|
|
||
| {error && <p className="text-destructive text-xs">{error}</p>} |
There was a problem hiding this comment.
The inline error message is rendered as a plain <p>, which won’t be announced reliably by screen readers. Elsewhere in the codebase FieldError uses role="alert"; consider using the same pattern here (e.g., add role="alert" and/or aria-live) so cancellation failures are accessible.
| {error && <p className="text-destructive text-xs">{error}</p>} | |
| {error && ( | |
| <p role="alert" aria-live="assertive" className="text-destructive text-xs"> | |
| {error} | |
| </p> | |
| )} |
| interface RunCancelActionProps { | ||
| runId: string; | ||
| status: WorkflowRunStatus; | ||
| onCanceled?: (() => Promise<void>) | (() => void); |
There was a problem hiding this comment.
onCanceled?: (() => Promise<void>) | (() => void) can be simplified to a single signature like () => void | Promise<void>, which is easier to read and avoids an unnecessary union of function types.
| onCanceled?: (() => Promise<void>) | (() => void); | |
| onCanceled?: () => void | Promise<void>; |
91126f1 to
4d8bcde
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
thanks! |
This PR adds "Cancel Run" action to the run details page in dashboard