refactor: Update cron expressions and add helper text for scheduled tasks

This commit is contained in:
Andras Bacsai
2024-08-08 12:50:49 +02:00
parent c2e431d631
commit fa28e952de
4 changed files with 13 additions and 4 deletions

View File

@@ -9,6 +9,11 @@ const VALID_CRON_STRINGS = [
'weekly' => '0 0 * * 0', 'weekly' => '0 0 * * 0',
'monthly' => '0 0 1 * *', 'monthly' => '0 0 1 * *',
'yearly' => '0 0 1 1 *', 'yearly' => '0 0 1 1 *',
'@hourly' => '0 * * * *',
'@daily' => '0 0 * * *',
'@weekly' => '0 0 * * 0',
'@monthly' => '0 0 1 * *',
'@yearly' => '0 0 1 1 *',
]; ];
const RESTART_MODE = 'unless-stopped'; const RESTART_MODE = 'unless-stopped';

View File

@@ -1,5 +1,7 @@
<form class="flex flex-col w-full gap-2 rounded" wire:submit='submit'> <form class="flex flex-col w-full gap-2 rounded" wire:submit='submit'>
<x-forms.input autofocus placeholder="0 0 * * * or daily" id="frequency" label="Frequency" required /> <x-forms.input autofocus placeholder="0 0 * * * or daily" id="frequency"
helper="You can use every_minute, hourly, daily, weekly, monthly, yearly or a cron expression." label="Frequency"
required />
<x-forms.checkbox id="save_s3" label="Save to S3" /> <x-forms.checkbox id="save_s3" label="Save to S3" />
<x-forms.select id="selected_storage_id"> <x-forms.select id="selected_storage_id">
@if ($s3s->count() === 0) @if ($s3s->count() === 0)

View File

@@ -1,7 +1,9 @@
<form class="flex flex-col w-full gap-2 rounded" wire:submit='submit'> <form class="flex flex-col w-full gap-2 rounded" wire:submit='submit'>
<x-forms.input autofocus placeholder="Run cron" id="name" label="Name" /> <x-forms.input autofocus placeholder="Run cron" id="name" label="Name" />
<x-forms.input placeholder="php artisan schedule:run" id="command" label="Command" /> <x-forms.input placeholder="php artisan schedule:run" id="command" label="Command" />
<x-forms.input placeholder="0 0 * * * or daily" id="frequency" label="Frequency" /> <x-forms.input placeholder="0 0 * * * or daily"
helper="You can use every_minute, hourly, daily, weekly, monthly, yearly or a cron expression." id="frequency"
label="Frequency" />
@if ($type === 'application') @if ($type === 'application')
@if ($containerNames->count() > 1) @if ($containerNames->count() > 1)
<x-forms.select id="container" label="Container name"> <x-forms.select id="container" label="Container name">

View File

@@ -60,13 +60,13 @@
<div class="flex items-end gap-2"> <div class="flex items-end gap-2">
<x-forms.input required id="update_check_frequency" label="Update Check Frequency" <x-forms.input required id="update_check_frequency" label="Update Check Frequency"
placeholder="0 * * * *" placeholder="0 * * * *"
helper="Cron expression for update check frequency (check for new Coolify versions and pull new Service Templates from CDN). Default is every hour." /> helper="Cron expression for update check frequency (check for new Coolify versions and pull new Service Templates from CDN).<br>You can use every_minute, hourly, daily, weekly, monthly, yearly.<br><br>Default is every hour." />
<x-forms.button wire:click='checkManually'>Check Manually</x-forms.button> <x-forms.button wire:click='checkManually'>Check Manually</x-forms.button>
</div> </div>
@if (is_null(env('AUTOUPDATE', null)) && $is_auto_update_enabled) @if (is_null(env('AUTOUPDATE', null)) && $is_auto_update_enabled)
<x-forms.input required id="auto_update_frequency" label="Auto Update Frequency" placeholder="0 0 * * *" <x-forms.input required id="auto_update_frequency" label="Auto Update Frequency" placeholder="0 0 * * *"
helper="Cron expression for auto update frequency (automatically update coolify). Default is every day at 00:00" /> helper="Cron expression for auto update frequency (automatically update coolify).<br>You can use every_minute, hourly, daily, weekly, monthly, yearly.<br><br>Default is every day at 00:00" />
@endif @endif
</div> </div>
</form> </form>