mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-08 00:26:37 +08:00
优化任务管理
This commit is contained in:
@@ -3,6 +3,7 @@ import type {
|
||||
AdminUser,
|
||||
AuthSource,
|
||||
AuthSourceRequest,
|
||||
CreateScheduleRequest,
|
||||
CreateSystemConfigRequest,
|
||||
CreateTemplateRequest,
|
||||
CreateUserRequest,
|
||||
@@ -12,6 +13,7 @@ import type {
|
||||
ListTaskExecutionsResponse,
|
||||
ListUsersRequest,
|
||||
ListUsersResponse,
|
||||
Schedule,
|
||||
SystemConfig,
|
||||
SystemStatus,
|
||||
TaskExecution,
|
||||
@@ -19,6 +21,7 @@ import type {
|
||||
TaskTypeResponse,
|
||||
Template,
|
||||
ToggleAuthSourceRequest,
|
||||
UpdateScheduleRequest,
|
||||
UpdateSystemConfigRequest,
|
||||
UpdateTemplateRequest,
|
||||
UpdateUserStatusRequest,
|
||||
@@ -235,6 +238,36 @@ export class AdminService extends BaseService {
|
||||
return this.post<string>(`/tasks/executions/${ id }/retry`);
|
||||
}
|
||||
|
||||
// ==================== 定时任务管理 ====================
|
||||
|
||||
/**
|
||||
* 获取定时任务列表
|
||||
*/
|
||||
static async listSchedules(): Promise<Schedule[]> {
|
||||
return this.get<Schedule[]>('/tasks/schedules');
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建定时任务
|
||||
*/
|
||||
static async createSchedule(request: CreateScheduleRequest): Promise<Schedule> {
|
||||
return this.post<Schedule>('/tasks/schedules', request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新定时任务
|
||||
*/
|
||||
static async updateSchedule(id: string, request: UpdateScheduleRequest): Promise<Schedule> {
|
||||
return this.put<Schedule>(`/tasks/schedules/${ id }`, request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除定时任务
|
||||
*/
|
||||
static async deleteSchedule(id: string): Promise<void> {
|
||||
return this.delete<void>(`/tasks/schedules/${ id }`);
|
||||
}
|
||||
|
||||
// ==================== 用户管理 ====================
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,4 +40,7 @@ export type {
|
||||
UpdateUserStatusRequest,
|
||||
SystemStatus,
|
||||
DatabaseInfo,
|
||||
Schedule,
|
||||
CreateScheduleRequest,
|
||||
UpdateScheduleRequest,
|
||||
} from './types';
|
||||
|
||||
@@ -188,6 +188,42 @@ export interface ListTaskExecutionsResponse {
|
||||
page_size: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 定时任务配置信息
|
||||
*/
|
||||
export interface Schedule {
|
||||
id: string;
|
||||
name: string;
|
||||
task_type: string;
|
||||
cron: string;
|
||||
payload: string;
|
||||
is_active: boolean;
|
||||
created_at: string;
|
||||
updated_at: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建定时任务请求参数
|
||||
*/
|
||||
export interface CreateScheduleRequest {
|
||||
name: string;
|
||||
task_type: string;
|
||||
cron: string;
|
||||
payload: string;
|
||||
is_active: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改定时任务请求参数
|
||||
*/
|
||||
export interface UpdateScheduleRequest {
|
||||
name: string;
|
||||
task_type: string;
|
||||
cron: string;
|
||||
payload: string;
|
||||
is_active: boolean;
|
||||
}
|
||||
|
||||
// ==================== 用户管理 ====================
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user