Skip to content

Commit d7a08c7

Browse files
authored
add documentation link for cron input field (#4779)
1 parent 495d448 commit d7a08c7

File tree

2 files changed

+48
-22
lines changed

2 files changed

+48
-22
lines changed

frontend/src/lib/components/CronInput.svelte

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,12 @@
210210
<div class="text-red-600 text-xs"> Invalid cron syntax </div>
211211
{/if}
212212
</svelte:fragment>
213+
<div class="flex flex-row-reverse text-2xs text-tertiary -mt-1">
214+
<a
215+
class="text-tertiary"
216+
href="https://www.windmill.dev/docs/core_concepts/scheduling#cron-syntax">Croner</a
217+
>
218+
</div>
213219
<input
214220
class="inline-block"
215221
type="text"

frontend/src/lib/components/ScheduleEditorInner.svelte

Lines changed: 42 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@
3838
let edit = true
3939
let schedule: string = '0 0 12 * *'
4040
let cronVersion: string = 'v2'
41-
let isLatestCron = true;
41+
let isLatestCron = true
4242
let initialCronVersion: string = 'v2'
43-
let initialSchedule: string;
43+
let initialSchedule: string
4444
let timezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone
4545
let paused_until: string | undefined = undefined
4646
@@ -432,7 +432,7 @@
432432
no_flow_overlap: no_flow_overlap,
433433
tag: tag,
434434
paused_until: paused_until,
435-
cron_version: cronVersion,
435+
cron_version: cronVersion
436436
}
437437
})
438438
sendUserToast(`Schedule ${path} updated`)
@@ -466,7 +466,7 @@
466466
no_flow_overlap: no_flow_overlap,
467467
tag: tag,
468468
paused_until: paused_until,
469-
cron_version: cronVersion,
469+
cron_version: cronVersion
470470
}
471471
})
472472
sendUserToast(`Schedule ${path} created`)
@@ -507,11 +507,15 @@
507507
$: !showPauseUntil && (paused_until = undefined)
508508
509509
function onVersionChange() {
510-
cronVersion = isLatestCron? 'v2' : 'v1'
510+
cronVersion = isLatestCron ? 'v2' : 'v1'
511511
if (cronVersion === 'v2' && initialCronVersion === 'v1') {
512512
// switches day-of-week from v1 -> v2
513513
schedule = cronV1toV2(schedule)
514-
} else if (cronVersion === 'v1' && initialCronVersion === 'v1' && (schedule !== initialSchedule)) {
514+
} else if (
515+
cronVersion === 'v1' &&
516+
initialCronVersion === 'v1' &&
517+
schedule !== initialSchedule
518+
) {
515519
// revert back to original
516520
schedule = initialSchedule
517521
}
@@ -635,25 +639,41 @@
635639

636640
<Section label="Schedule">
637641
<svelte:fragment slot="header">
638-
<Tooltip>Schedules use CRON syntax. Seconds are mandatory.</Tooltip>
642+
{#if cronVersion === 'v1'}
643+
<Tooltip>Schedules use CRON syntax. Seconds are mandatory.</Tooltip>
644+
{:else}
645+
<Tooltip
646+
>Schedules use <a
647+
href="https://www.windmill.dev/docs/core_concepts/scheduling#cron-syntax"
648+
>extended CRON syntax</a
649+
>.</Tooltip
650+
>
651+
{/if}
639652
</svelte:fragment>
640653
{#if initialCronVersion !== 'v2'}
641-
<div class='flex flex-row'>
642-
<AlertTriangle color='orange' class='mr-2' size={16} />
643-
<Toggle
644-
options={{
645-
right: 'enable latest Cron syntax',
646-
rightTooltip:
647-
'The latest Cron syntax is more flexible and allows for more complex schedules. See the documentation for more information.',
648-
rightDocumentationLink: 'https://www.windmill.dev/docs/core_concepts/scheduling#cron-syntax'
649-
}}
650-
size='xs'
651-
bind:checked={isLatestCron}
652-
on:change={onVersionChange}
653-
/>
654-
</div>
654+
<div class="flex flex-row">
655+
<AlertTriangle color="orange" class="mr-2" size={16} />
656+
<Toggle
657+
options={{
658+
right: 'enable latest Cron syntax',
659+
rightTooltip:
660+
'The latest Cron syntax is more flexible and allows for more complex schedules. See the documentation for more information.',
661+
rightDocumentationLink:
662+
'https://www.windmill.dev/docs/core_concepts/scheduling#cron-syntax'
663+
}}
664+
size="xs"
665+
bind:checked={isLatestCron}
666+
on:change={onVersionChange}
667+
/>
668+
</div>
655669
{/if}
656-
<CronInput disabled={!can_write} bind:schedule bind:timezone bind:validCRON bind:cronVersion />
670+
<CronInput
671+
disabled={!can_write}
672+
bind:schedule
673+
bind:timezone
674+
bind:validCRON
675+
bind:cronVersion
676+
/>
657677
<Toggle
658678
options={{
659679
right: 'Pause schedule until...',

0 commit comments

Comments
 (0)