mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-11 00:06:06 +00:00
* basic cron schedule editing ui * schedules run in a user-specified timezone * fix other uses of CronInput component * use now() from database to schedule next job * offset -> IANA timezone conversion on db migration * sqlx ci --------- Co-authored-by: Ruben Fiszel <ruben@rubenfiszel.com>
33 lines
693 B
TypeScript
33 lines
693 B
TypeScript
import { ScheduleService } from '$lib/gen'
|
|
|
|
export type Schedule = {
|
|
args: Record<string, any>
|
|
cron: string
|
|
timezone: string
|
|
enabled: boolean
|
|
}
|
|
|
|
// Load the schedule of a flow given its path and the workspace
|
|
export async function loadFlowSchedule(path: string, workspace: string = ''): Promise<Schedule> {
|
|
const existsSchedule = await ScheduleService.existsSchedule({
|
|
workspace,
|
|
path
|
|
})
|
|
|
|
if (!existsSchedule) {
|
|
throw new Error(`Flow at path: ${path} doesn't exist`)
|
|
}
|
|
|
|
const schedule = await ScheduleService.getSchedule({
|
|
workspace,
|
|
path
|
|
})
|
|
|
|
return {
|
|
enabled: schedule.enabled,
|
|
cron: schedule.schedule,
|
|
timezone: schedule.timezone,
|
|
args: schedule.args ?? {}
|
|
}
|
|
}
|