feat(ui): allow to cancel getFluxTasks operation

pull/5868/head
Pavel Zavora 2022-02-17 15:22:26 +01:00
parent 72378f7e9a
commit 3065afd748
1 changed files with 3 additions and 1 deletions

View File

@ -4,7 +4,8 @@ import {FluxTask, Kapacitor} from 'src/types'
const tasksBatchLimit = 500
export const getFluxTasks = async (
kapacitor: Kapacitor
kapacitor: Kapacitor,
signal?: AbortSignal
): Promise<FluxTask[]> => {
const taskIds: Record<string, FluxTask> = {}
let lastID = ''
@ -19,6 +20,7 @@ export const getFluxTasks = async (
encodeURIComponent(
`/kapacitor/v1/api/v2/tasks?limit=${tasksBatchLimit}&after=${lastID}`
),
signal,
})
if (!tasks || !tasks.length) {
break