Add Cloud Console cancel action and cancelled status

- Widen TaskStatus to include "cancelled"; add it to TasksView's
  STATUSES filter dropdown.
- Add TaskCancellationResponse type and cancelTask(taskId) to api.ts.
- Add a Cancel button to TasksView's task detail panel, gated on
  tasks:submit and a non-terminal task status; updates the displayed
  status on success and surfaces errors via the existing error path.
- Extract the cancellability rule into a pure taskCancellation.ts
  module (mirroring taskProgress.ts/plannerHistory.ts) with unit
  tests, since the project has no Vue component-mounting test setup.

Task 6/9 of task-cancellation change.
This commit is contained in:
2026-07-15 18:43:55 +08:00
parent 6776ac2f2d
commit 4d04d7ac83
6 changed files with 94 additions and 5 deletions
+7 -1
View File
@@ -3,7 +3,8 @@ export type TaskStatus =
| "assigned"
| "dispatched"
| "done"
| "failed";
| "failed"
| "cancelled";
export interface TaskListItem {
id: string;
@@ -41,6 +42,11 @@ export interface TaskListResponse {
offset: number;
}
export interface TaskCancellationResponse {
task_id: string;
status: TaskStatus;
}
export interface TaskAttempt {
task_id: string;
attempt: number;