|
38 | 38 | let edit = true
|
39 | 39 | let schedule: string = '0 0 12 * *'
|
40 | 40 | let cronVersion: string = 'v2'
|
41 |
| - let isLatestCron = true; |
| 41 | + let isLatestCron = true |
42 | 42 | let initialCronVersion: string = 'v2'
|
43 |
| - let initialSchedule: string; |
| 43 | + let initialSchedule: string |
44 | 44 | let timezone: string = Intl.DateTimeFormat().resolvedOptions().timeZone
|
45 | 45 | let paused_until: string | undefined = undefined
|
46 | 46 |
|
|
432 | 432 | no_flow_overlap: no_flow_overlap,
|
433 | 433 | tag: tag,
|
434 | 434 | paused_until: paused_until,
|
435 |
| - cron_version: cronVersion, |
| 435 | + cron_version: cronVersion |
436 | 436 | }
|
437 | 437 | })
|
438 | 438 | sendUserToast(`Schedule ${path} updated`)
|
|
466 | 466 | no_flow_overlap: no_flow_overlap,
|
467 | 467 | tag: tag,
|
468 | 468 | paused_until: paused_until,
|
469 |
| - cron_version: cronVersion, |
| 469 | + cron_version: cronVersion |
470 | 470 | }
|
471 | 471 | })
|
472 | 472 | sendUserToast(`Schedule ${path} created`)
|
|
507 | 507 | $: !showPauseUntil && (paused_until = undefined)
|
508 | 508 |
|
509 | 509 | function onVersionChange() {
|
510 |
| - cronVersion = isLatestCron? 'v2' : 'v1' |
| 510 | + cronVersion = isLatestCron ? 'v2' : 'v1' |
511 | 511 | if (cronVersion === 'v2' && initialCronVersion === 'v1') {
|
512 | 512 | // switches day-of-week from v1 -> v2
|
513 | 513 | 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 | + ) { |
515 | 519 | // revert back to original
|
516 | 520 | schedule = initialSchedule
|
517 | 521 | }
|
|
635 | 639 |
|
636 | 640 | <Section label="Schedule">
|
637 | 641 | <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} |
639 | 652 | </svelte:fragment>
|
640 | 653 | {#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> |
655 | 669 | {/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 | + /> |
657 | 677 | <Toggle
|
658 | 678 | options={{
|
659 | 679 | right: 'Pause schedule until...',
|
|
0 commit comments