mirror of
https://github.com/GlueOps/autoglue.git
synced 2026-02-13 12:50:05 +01:00
feat: adding background jobs ui page and apis - requires user is_admin to be set to true
This commit is contained in:
40
ui/src/api/archer_admin.ts
Normal file
40
ui/src/api/archer_admin.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { withRefresh } from "@/api/with-refresh.ts"
|
||||
import { makeArcherAdminApi } from "@/sdkClient.ts"
|
||||
|
||||
const archerAdmin = makeArcherAdminApi()
|
||||
|
||||
type ListParams = {
|
||||
status?: "queued" | "running" | "succeeded" | "failed" | "canceled" | "retrying" | "scheduled"
|
||||
queue?: string
|
||||
q?: string
|
||||
page?: number
|
||||
pageSize?: number
|
||||
}
|
||||
|
||||
export const archerAdminApi = {
|
||||
listJobs: (params: ListParams = {}) => {
|
||||
return withRefresh(async () => {
|
||||
return await archerAdmin.adminListArcherJobs(params)
|
||||
})
|
||||
},
|
||||
enqueue: (body: { queue: string; type: string; payload?: unknown; run_at?: string }) => {
|
||||
return withRefresh(async () => {
|
||||
return await archerAdmin.adminEnqueueArcherJob({ body })
|
||||
})
|
||||
},
|
||||
retryJob: (id: string) => {
|
||||
return withRefresh(async () => {
|
||||
return await archerAdmin.adminRetryArcherJob({ id })
|
||||
})
|
||||
},
|
||||
cancelJob: (id: string) => {
|
||||
return withRefresh(async () => {
|
||||
return await archerAdmin.adminCancelArcherJob({ id })
|
||||
})
|
||||
},
|
||||
listQueues: () => {
|
||||
return withRefresh(async () => {
|
||||
return await archerAdmin.adminListArcherQueues()
|
||||
})
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user