feat: Cron management API and frontend page (Phase 5)
Backend: CRON API with list/logs/run/pause/resume endpoints, Hermes CLI integration, system cron jobs, audit logging for operations. Frontend: CronPage with filter bar (status/profile), table with 30s polling, log modal with level-colored messages, action buttons (run/pause/resume), run confirmation dialog, 4-state coverage. Sidebar shows cron failure badge. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import client from './client'
|
||||
|
||||
export interface CronJob {
|
||||
id: string
|
||||
job_name: string
|
||||
profile: string
|
||||
schedule: string
|
||||
status: string
|
||||
last_run: string | null
|
||||
last_run_success: boolean | null
|
||||
success_rate: number
|
||||
has_logs: boolean
|
||||
system: boolean
|
||||
consecutive_failures: number
|
||||
}
|
||||
|
||||
export interface CronListResponse {
|
||||
jobs: CronJob[]
|
||||
has_failures: boolean
|
||||
}
|
||||
|
||||
export interface CronLogItem {
|
||||
time: string
|
||||
status: string
|
||||
message: string
|
||||
}
|
||||
|
||||
export interface CronLogsResponse {
|
||||
logs: CronLogItem[]
|
||||
}
|
||||
|
||||
export interface CronActionResponse {
|
||||
success: boolean
|
||||
action: string
|
||||
job_id: string
|
||||
detail: string
|
||||
}
|
||||
|
||||
export const getCronJobs = (params?: { status?: string; profile?: string }) =>
|
||||
client.get<CronListResponse>('/cron/jobs', { params })
|
||||
|
||||
export const getCronLogs = (jobId: string) =>
|
||||
client.get<CronLogsResponse>(`/cron/jobs/${jobId}/logs`)
|
||||
|
||||
export const runCronJob = (jobId: string) =>
|
||||
client.post<CronActionResponse>(`/cron/jobs/${jobId}/run`)
|
||||
|
||||
export const pauseCronJob = (jobId: string) =>
|
||||
client.post<CronActionResponse>(`/cron/jobs/${jobId}/pause`)
|
||||
|
||||
export const resumeCronJob = (jobId: string) =>
|
||||
client.post<CronActionResponse>(`/cron/jobs/${jobId}/resume`)
|
||||
Reference in New Issue
Block a user