feat: schedule methods on the web api client
This commit is contained in:
+25
-5
@@ -251,6 +251,10 @@ export interface Workflow {
|
||||
target_server_ids: string[];
|
||||
target_tags?: Record<string, string>;
|
||||
steps: WorkflowStepRef[];
|
||||
schedule?: Schedule;
|
||||
next_run_at?: string;
|
||||
last_run_at?: string;
|
||||
last_skipped?: Skip;
|
||||
}
|
||||
|
||||
export interface StepRun {
|
||||
@@ -656,11 +660,7 @@ export const api = {
|
||||
return request<Settings>("/settings");
|
||||
},
|
||||
|
||||
saveSettings(settings: {
|
||||
alerts: AlertSettings;
|
||||
workflow_log_retention_days?: number | null;
|
||||
local_login_enabled?: boolean;
|
||||
}): Promise<{ saved: boolean }> {
|
||||
saveSettings(settings: { alerts: AlertSettings; workflow_log_retention_days?: number | null; local_login_enabled?: boolean }): Promise<{ saved: boolean }> {
|
||||
return request<{ saved: boolean }>("/settings", {
|
||||
method: "PUT",
|
||||
body: JSON.stringify(settings),
|
||||
@@ -863,6 +863,14 @@ export const api = {
|
||||
serverRunLogStreamUrl(runId: string, serverId: string): string {
|
||||
return `/api/runs/${runId}/servers/${serverId}/logs/stream`;
|
||||
},
|
||||
|
||||
setWorkflowSchedule(workflowId: string, schedule: Schedule): Promise<{ schedule: Schedule; next_run_at: string | null }> {
|
||||
return request(`/workflows/${workflowId}/schedule`, { method: "PUT", body: JSON.stringify(schedule) });
|
||||
},
|
||||
|
||||
previewSchedule(workflowId: string, cron: string, tz: string): Promise<{ occurrences: string[] }> {
|
||||
return request(`/workflows/${workflowId}/schedule/preview?cron=${encodeURIComponent(cron)}&tz=${encodeURIComponent(tz)}`);
|
||||
},
|
||||
};
|
||||
|
||||
export type LicenseState = "valid" | "expired" | "invalid";
|
||||
@@ -903,3 +911,15 @@ export const licence = {
|
||||
return request("/license", { method: "POST", body: JSON.stringify({ blob }) });
|
||||
},
|
||||
};
|
||||
|
||||
export interface Schedule {
|
||||
enabled: boolean;
|
||||
cron: string;
|
||||
tz: string;
|
||||
}
|
||||
|
||||
export interface Skip {
|
||||
reason: string;
|
||||
due: string;
|
||||
at: string;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user