mirror of
https://github.com/continew-org/continew-admin-ui.git
synced 2025-11-04 22:57:10 +08:00
feat: 新增任务调度模块
SnailJob(灵活,可靠和快速的分布式任务重试和分布式任务调度平台)
This commit is contained in:
@@ -4,6 +4,7 @@ export * from './common'
|
||||
export * from './monitor'
|
||||
export * from './system'
|
||||
export * from './tool'
|
||||
export * from './schedule'
|
||||
|
||||
export * from './area/type'
|
||||
export * from './auth/type'
|
||||
@@ -11,3 +12,4 @@ export * from './common/type'
|
||||
export * from './monitor/type'
|
||||
export * from './system/type'
|
||||
export * from './tool/type'
|
||||
export * from './schedule/type'
|
||||
|
||||
2
src/apis/schedule/index.ts
Normal file
2
src/apis/schedule/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from '../schedule/job'
|
||||
export * from '../schedule/log'
|
||||
39
src/apis/schedule/job.ts
Normal file
39
src/apis/schedule/job.ts
Normal file
@@ -0,0 +1,39 @@
|
||||
import type * as Schedule from './type'
|
||||
import http from '@/utils/http'
|
||||
|
||||
const BASE_URL = '/schedule/job'
|
||||
|
||||
/** @desc 查询任务组列表 */
|
||||
export function listGroup() {
|
||||
return http.get(`${BASE_URL}/group`)
|
||||
}
|
||||
|
||||
/** @desc 查询任务列表 */
|
||||
export function listJob(query: Schedule.JobPageQuery) {
|
||||
return http.get<PageRes<Schedule.JobResp[]>>(`${BASE_URL}`, query)
|
||||
}
|
||||
|
||||
/** @desc 新增任务 */
|
||||
export function addJob(data: any) {
|
||||
return http.post(`${BASE_URL}`, data)
|
||||
}
|
||||
|
||||
/** @desc 修改任务 */
|
||||
export function updateJob(data: any, id: number) {
|
||||
return http.put(`${BASE_URL}/${id}`, data)
|
||||
}
|
||||
|
||||
/** @desc 修改任务状态 */
|
||||
export function updateJobStatus(data: any, id: number) {
|
||||
return http.patch(`${BASE_URL}/${id}/status`, data)
|
||||
}
|
||||
|
||||
/** @desc 删除任务 */
|
||||
export function deleteJob(id: number) {
|
||||
return http.del(`${BASE_URL}/${id}`)
|
||||
}
|
||||
|
||||
/** @desc 执行任务 */
|
||||
export function triggerJob(id: number) {
|
||||
return http.post(`${BASE_URL}/trigger/${id}`)
|
||||
}
|
||||
34
src/apis/schedule/log.ts
Normal file
34
src/apis/schedule/log.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import type * as Schedule from './type'
|
||||
import http from '@/utils/http'
|
||||
|
||||
const BASE_URL = '/schedule/log'
|
||||
|
||||
/** @desc 查询任务日志列表 */
|
||||
export function listJobLog(query: Schedule.JobLogPageQuery) {
|
||||
return http.get<PageRes<Schedule.JobLogResp[]>>(`${BASE_URL}`, query)
|
||||
}
|
||||
|
||||
/** @desc 查询任务日志详情 */
|
||||
export function getJobLogDetail(id: number) {
|
||||
return http.get<boolean>(`${BASE_URL}/${id}`)
|
||||
}
|
||||
|
||||
/** @desc 停止任务 */
|
||||
export function stopJob(id: number) {
|
||||
return http.post(`${BASE_URL}/stop/${id}`)
|
||||
}
|
||||
|
||||
/** @desc 重试任务 */
|
||||
export function retryJob(id: number) {
|
||||
return http.post(`${BASE_URL}/retry/${id}`)
|
||||
}
|
||||
|
||||
/** @desc 查询任务实例列表 */
|
||||
export function listJobInstance(query: Schedule.JobInstanceQuery) {
|
||||
return http.get<Schedule.JobInstanceResp[]>(`${BASE_URL}/instance`, query)
|
||||
}
|
||||
|
||||
/** @desc 查询任务实例日志列表 */
|
||||
export function listJobInstanceLog(query: Schedule.JobInstanceLogQuery) {
|
||||
return http.get<Schedule.JobInstanceLogResp>(`${BASE_URL}/instance/log`, query)
|
||||
}
|
||||
85
src/apis/schedule/type.ts
Normal file
85
src/apis/schedule/type.ts
Normal file
@@ -0,0 +1,85 @@
|
||||
/** 任务类型 */
|
||||
export interface JobResp {
|
||||
id: number
|
||||
groupName: string
|
||||
jobName: string
|
||||
description?: string
|
||||
triggerType: number
|
||||
triggerInterval: string | number
|
||||
executorType: number
|
||||
taskType: number
|
||||
executorInfo: string
|
||||
argsStr?: string
|
||||
argsType?: string
|
||||
routeKey: number
|
||||
blockStrategy: number
|
||||
executorTimeout: number
|
||||
maxRetryTimes: number
|
||||
retryInterval: number
|
||||
parallelNum: number
|
||||
jobStatus: number
|
||||
nextTriggerAt?: Date
|
||||
createDt?: Date
|
||||
updateDt?: Date
|
||||
}
|
||||
export interface JobQuery {
|
||||
groupName: string
|
||||
jobName?: string
|
||||
jobStatus?: number
|
||||
}
|
||||
export interface JobPageQuery extends JobQuery, PageQuery {}
|
||||
|
||||
/** 任务日志类型 */
|
||||
export interface JobLogResp {
|
||||
id: number
|
||||
groupName: string
|
||||
jobName: string
|
||||
jobId: number
|
||||
taskBatchStatus: number
|
||||
operationReason: number
|
||||
executorType: number
|
||||
executorInfo: string
|
||||
executionAt: string
|
||||
createDt: string
|
||||
}
|
||||
export interface JobLogQuery {
|
||||
jobId?: number
|
||||
groupName?: string
|
||||
jobName?: string
|
||||
taskBatchStatus?: number
|
||||
datetimeRange?: Array<string>
|
||||
}
|
||||
export interface JobLogPageQuery extends JobLogQuery, PageQuery {}
|
||||
|
||||
/** 任务实例类型 */
|
||||
export interface JobInstanceResp {
|
||||
id: number
|
||||
groupName: string
|
||||
jobId: number
|
||||
taskBatchId: number
|
||||
taskStatus: number
|
||||
retryCount: number
|
||||
resultMessage: string
|
||||
clientInfo: string
|
||||
}
|
||||
export interface JobInstanceQuery {
|
||||
jobId?: string | number
|
||||
taskBatchId?: number | string
|
||||
}
|
||||
|
||||
/** 任务实例日志类型 */
|
||||
export interface JobInstanceLogResp {
|
||||
id: number
|
||||
message: any[]
|
||||
isFinished: number
|
||||
fromIndex: number
|
||||
nextStartId: number
|
||||
}
|
||||
export interface JobInstanceLogQuery {
|
||||
taskBatchId: number
|
||||
jobId: number
|
||||
taskId: number
|
||||
startId: number
|
||||
fromIndex: number
|
||||
size: number
|
||||
}
|
||||
@@ -12,6 +12,7 @@ export interface TableQuery {
|
||||
tableName?: string
|
||||
}
|
||||
export interface TablePageQuery extends PageQuery, TableQuery {}
|
||||
|
||||
export interface FieldConfigResp {
|
||||
tableName: string
|
||||
columnName: string
|
||||
|
||||
Reference in New Issue
Block a user