feat(ui): allow to cancel getFluxTasks operation
parent
72378f7e9a
commit
3065afd748
|
@ -4,7 +4,8 @@ import {FluxTask, Kapacitor} from 'src/types'
|
||||||
|
|
||||||
const tasksBatchLimit = 500
|
const tasksBatchLimit = 500
|
||||||
export const getFluxTasks = async (
|
export const getFluxTasks = async (
|
||||||
kapacitor: Kapacitor
|
kapacitor: Kapacitor,
|
||||||
|
signal?: AbortSignal
|
||||||
): Promise<FluxTask[]> => {
|
): Promise<FluxTask[]> => {
|
||||||
const taskIds: Record<string, FluxTask> = {}
|
const taskIds: Record<string, FluxTask> = {}
|
||||||
let lastID = ''
|
let lastID = ''
|
||||||
|
@ -19,6 +20,7 @@ export const getFluxTasks = async (
|
||||||
encodeURIComponent(
|
encodeURIComponent(
|
||||||
`/kapacitor/v1/api/v2/tasks?limit=${tasksBatchLimit}&after=${lastID}`
|
`/kapacitor/v1/api/v2/tasks?limit=${tasksBatchLimit}&after=${lastID}`
|
||||||
),
|
),
|
||||||
|
signal,
|
||||||
})
|
})
|
||||||
if (!tasks || !tasks.length) {
|
if (!tasks || !tasks.length) {
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue