From c139200b10bfd32c47f254e15de001b5ba4dda7c Mon Sep 17 00:00:00 2001 From: Ken Hibino Date: Wed, 30 Mar 2022 06:49:28 -0700 Subject: [PATCH] (ui): Add api functions for aggregating task actions --- ui/src/api.ts | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) diff --git a/ui/src/api.ts b/ui/src/api.ts index 215400e..b13cb2d 100644 --- a/ui/src/api.ts +++ b/ui/src/api.ts @@ -608,6 +608,115 @@ export async function deleteAllPendingTasks( return resp.data; } +export async function deleteAggregatingTask( + qname: string, + gname: string, + taskId: string +): Promise { + await axios({ + method: "delete", + url: `${getBaseUrl()}/queues/${qname}/groups/${gname}/aggregating_tasks/${taskId}`, + }); +} + +export async function batchDeleteAggregatingTasks( + qname: string, + gname: string, + taskIds: string[] +): Promise { + const resp = await axios({ + method: "post", + url: `${getBaseUrl()}/queues/${qname}/groups/${gname}/aggregating_tasks:batch_delete`, + data: { + task_ids: taskIds, + }, + }); + return resp.data; +} + +export async function deleteAllAggregatingTasks( + qname: string, + gname: string +): Promise { + const resp = await axios({ + method: "delete", + url: `${getBaseUrl()}/queues/${qname}/groups/${gname}/aggregating_tasks:delete_all`, + }); + return resp.data; +} + +export async function runAggregatingTask( + qname: string, + gname: string, + taskId: string +): Promise { + await axios({ + method: "post", + url: `${getBaseUrl()}/queues/${qname}/groups/${gname}/aggregating_tasks/${taskId}:run`, + }); +} + +export async function batchRunAggregatingTasks( + qname: string, + gname: string, + taskIds: string[] +): Promise { + const resp = await axios({ + method: "post", + url: `${getBaseUrl()}/queues/${qname}/groups/${gname}/aggregating_tasks:batch_run`, + data: { + task_ids: taskIds, + }, + }); + return resp.data; +} + +export async function runAllAggregatingTasks( + qname: string, + gname: string +): Promise { + await axios({ + method: "post", + url: `${getBaseUrl()}/queues/${qname}/groups/${gname}/aggregating_tasks:run_all`, + }); +} + +export async function archiveAggregatingTask( + qname: string, + gname: string, + taskId: string +): Promise { + await axios({ + method: "post", + url: `${getBaseUrl()}/queues/${qname}/groups/${gname}/aggregating_tasks/${taskId}:archive`, + }); +} + +export async function batchArchiveAggregatingTasks( + qname: string, + gname: string, + taskIds: string[] +): Promise { + const resp = await axios({ + method: "post", + url: `${getBaseUrl()}/queues/${qname}/groups/${gname}/aggregating_tasks:batch_archive`, + data: { + task_ids: taskIds, + }, + }); + return resp.data; +} + +export async function archiveAllAggregatingTasks( + qname: string, + gname: string +): Promise { + await axios({ + method: "post", + url: `${getBaseUrl()}/queues/${qname}/groups/${gname}/aggregating_tasks:archive_all`, + }); +} + export async function runScheduledTask( qname: string, taskId: string