feat(cron): enhance delivery modes and job configuration
- Updated isolated cron jobs to support new delivery modes: `announce` and `none`, improving output management. - Refactored job configuration to remove legacy fields and streamline delivery settings. - Enhanced the `CronJobEditor` UI to reflect changes in delivery options, including a new segmented control for delivery mode selection. - Updated documentation to clarify the new delivery configurations and their implications for job execution. - Improved tests to validate the new delivery behavior and ensure backward compatibility with legacy settings. This update provides users with greater flexibility in managing how isolated jobs deliver their outputs, enhancing overall usability and clarity in job configurations.
This commit is contained in:
committed by
Peter Steinberger
parent
ab9f06f4ff
commit
3f82daefd8
@@ -60,18 +60,18 @@ export function parseDurationMs(input: string): number | null {
|
||||
return Math.floor(n * factor);
|
||||
}
|
||||
|
||||
export function parseAtMs(input: string): number | null {
|
||||
export function parseAt(input: string): string | null {
|
||||
const raw = input.trim();
|
||||
if (!raw) {
|
||||
return null;
|
||||
}
|
||||
const absolute = parseAbsoluteTimeMs(raw);
|
||||
if (absolute) {
|
||||
return absolute;
|
||||
return new Date(absolute).toISOString();
|
||||
}
|
||||
const dur = parseDurationMs(raw);
|
||||
if (dur) {
|
||||
return Date.now() + dur;
|
||||
return new Date(Date.now() + dur).toISOString();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -97,13 +97,14 @@ const truncate = (value: string, width: number) => {
|
||||
return `${value.slice(0, width - 3)}...`;
|
||||
};
|
||||
|
||||
const formatIsoMinute = (ms: number) => {
|
||||
const d = new Date(ms);
|
||||
const formatIsoMinute = (iso: string) => {
|
||||
const parsed = parseAbsoluteTimeMs(iso);
|
||||
const d = new Date(parsed ?? NaN);
|
||||
if (Number.isNaN(d.getTime())) {
|
||||
return "-";
|
||||
}
|
||||
const iso = d.toISOString();
|
||||
return `${iso.slice(0, 10)} ${iso.slice(11, 16)}Z`;
|
||||
const isoStr = d.toISOString();
|
||||
return `${isoStr.slice(0, 10)} ${isoStr.slice(11, 16)}Z`;
|
||||
};
|
||||
|
||||
const formatDuration = (ms: number) => {
|
||||
@@ -143,7 +144,7 @@ const formatRelative = (ms: number | null | undefined, nowMs: number) => {
|
||||
|
||||
const formatSchedule = (schedule: CronSchedule) => {
|
||||
if (schedule.kind === "at") {
|
||||
return `at ${formatIsoMinute(schedule.atMs)}`;
|
||||
return `at ${formatIsoMinute(schedule.at)}`;
|
||||
}
|
||||
if (schedule.kind === "every") {
|
||||
return `every ${formatDuration(schedule.everyMs)}`;
|
||||
|
||||
Reference in New Issue
Block a user