feat(web): schedule control, next-run, broken badge, run-log modal

This commit is contained in:
2026-07-03 13:19:14 +07:00
parent d2c69c6a5e
commit e8acab6920
5 changed files with 147 additions and 2 deletions
+20
View File
@@ -18,6 +18,9 @@ export interface Task {
dst_endpoint_id: number
status: string
folder_mapping?: Record<string, string>
schedule_interval_seconds?: number
broken?: boolean
next_run_at?: string | null
}
export type TestStatus = 'pending' | 'ok' | 'fail' | string
@@ -137,6 +140,23 @@ export const testAccounts = (id: number) => api(`/api/tasks/${id}/test`, { metho
export const runTask = (id: number) => api(`/api/tasks/${id}/run`, { method: 'POST' })
export interface Run {
id: number
task_id: number
status: string
started_at: string
finished_at: string | null
total_copied: number
total_skipped: number
total_errors: number
trigger: string
}
export const setTaskSchedule = (taskId: number, intervalSeconds: number) =>
api(`/api/tasks/${taskId}/schedule`, { ...jsonBody({ interval_seconds: intervalSeconds }), method: 'PUT' })
export const listRuns = (taskId: number) => api<Run[]>(`/api/tasks/${taskId}/runs`)
export const importCSV = (id: number, file: File) => {
const fd = new FormData()
fd.append('file', file)