Add cancel action to ActiveTasksTable

This commit is contained in:
Ken Hibino
2020-12-23 06:59:44 -08:00
parent cbfc1af9c0
commit 50639cabb8
7 changed files with 274 additions and 8 deletions

View File

@@ -41,6 +41,11 @@ export interface ListSchedulerEntriesResponse {
entries: SchedulerEntry[];
}
export interface BatchCancelTasksResponse {
canceled_ids: string[];
error_ids: string[];
}
export interface BatchDeleteTasksResponse {
deleted_keys: string[];
failed_keys: string[];
@@ -198,6 +203,27 @@ export async function cancelActiveTask(
});
}
export async function cancelAllActiveTasks(qname: string): Promise<void> {
await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/active_tasks:cancel_all`,
});
}
export async function batchCancelActiveTasks(
qname: string,
taskIds: string[]
): Promise<BatchCancelTasksResponse> {
const resp = await axios({
method: "post",
url: `${BASE_URL}/queues/${qname}/active_tasks:batch_cancel`,
data: {
task_ids: taskIds,
},
});
return resp.data;
}
export async function listPendingTasks(
qname: string,
pageOpts?: PaginationOptions