fix: rename cron phrases to be mare accurate

This commit is contained in:
2026-07-19 14:49:19 +02:00
parent 5032906d91
commit dd7f0b5df7
5 changed files with 16 additions and 16 deletions
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"cron": { "cron": {
"type": { "type": {
"one_time": "One time", "manual": "Manual",
"every_day": "Every day", "every_day": "Every day",
"every_week": "Every week", "every_week": "Every week",
"every_month": "Every month", "every_month": "Every month",
"every_year": "Every year", "every_year": "Every year",
"specific": "Specific" "custom": "Custom (crontab)"
}, },
"week": [ "week": [
"Monday", "Monday",
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"cron": { "cron": {
"type": { "type": {
"one_time": "Une seule fois", "manual": "Manuel",
"every_day": "Tous les jours", "every_day": "Tous les jours",
"every_week": "Toutes les semaines", "every_week": "Toutes les semaines",
"every_month": "Tous les mois", "every_month": "Tous les mois",
"every_year": "Tous les ans", "every_year": "Tous les ans",
"specific": "Spécifique" "custom": "Personnalisé (crontab)"
}, },
"week": [ "week": [
"Lundi", "Lundi",
+7 -7
View File
@@ -10,7 +10,7 @@ const rawCron = ref<string>(DEFAULT_CRON);
const valid = ref<boolean>(true); const valid = ref<boolean>(true);
const props = defineProps<{ editMode: boolean }>(); const props = defineProps<{ editMode: boolean }>();
const cronType = ref<CronType>(CronType.ONE_TIME); const cronType = ref<CronType>(CronType.MANUAL);
const cronValue = ref<number>(0); const cronValue = ref<number>(0);
function onCronChanged() { function onCronChanged() {
@@ -34,7 +34,7 @@ function onChangeCronType() {
case CronType.EVERY_YEAR: case CronType.EVERY_YEAR:
cronValue.value = 1; cronValue.value = 1;
break; break;
case CronType.SPECIFIC: case CronType.CUSTOM:
cron.value ??= DEFAULT_CRON; cron.value ??= DEFAULT_CRON;
break; break;
} }
@@ -64,8 +64,8 @@ watch(cron, () => {
<template> <template>
<div class="flex gap-2"> <div class="flex gap-2">
<select v-model="cronType" class="select flex-1" @change="onChangeCronType"> <select v-model="cronType" class="select flex-1" @change="onChangeCronType">
<option :value="CronType.ONE_TIME"> <option :value="CronType.MANUAL">
{{ $t("cron.type.one_time") }} {{ $t("cron.type.manual") }}
</option> </option>
<option :value="CronType.EVERY_DAY"> <option :value="CronType.EVERY_DAY">
{{ $t("cron.type.every_day") }} {{ $t("cron.type.every_day") }}
@@ -79,8 +79,8 @@ watch(cron, () => {
<option :value="CronType.EVERY_YEAR"> <option :value="CronType.EVERY_YEAR">
{{ $t("cron.type.every_year") }} {{ $t("cron.type.every_year") }}
</option> </option>
<option :value="CronType.SPECIFIC"> <option :value="CronType.CUSTOM">
{{ $t("cron.type.specific") }} {{ $t("cron.type.custom") }}
</option> </option>
</select> </select>
<select <select
@@ -149,7 +149,7 @@ watch(cron, () => {
</option> </option>
</select> </select>
<input <input
v-if="cronType === CronType.SPECIFIC" v-if="cronType === CronType.CUSTOM"
v-model="rawCron" v-model="rawCron"
type="text" type="text"
class="input font-mono flex-1" class="input font-mono flex-1"
+2 -2
View File
@@ -1,10 +1,10 @@
export enum CronType { export enum CronType {
ONE_TIME, MANUAL,
EVERY_DAY, EVERY_DAY,
EVERY_WEEK, EVERY_WEEK,
EVERY_MONTH, EVERY_MONTH,
EVERY_YEAR, EVERY_YEAR,
SPECIFIC, CUSTOM,
} }
export enum SortType { export enum SortType {
+3 -3
View File
@@ -8,7 +8,7 @@ export function parseCron(cron: string | null): {
let value: RegExpMatchArray | null; let value: RegExpMatchArray | null;
if (cron === null) { if (cron === null) {
return { return {
type: CronType.ONE_TIME, type: CronType.MANUAL,
value: 0, value: 0,
}; };
} else if ((value = /^0 (\d+) \* \* \*$/i.exec(cron)) !== null) { } else if ((value = /^0 (\d+) \* \* \*$/i.exec(cron)) !== null) {
@@ -33,7 +33,7 @@ export function parseCron(cron: string | null): {
}; };
} else { } else {
return { return {
type: CronType.SPECIFIC, type: CronType.CUSTOM,
value: 0, value: 0,
}; };
} }
@@ -53,7 +53,7 @@ export function getCron(
return `0 0 ${value.toFixed(0)} * *`; return `0 0 ${value.toFixed(0)} * *`;
case CronType.EVERY_YEAR: case CronType.EVERY_YEAR:
return `0 0 1 ${value.toFixed(0)} *`; return `0 0 1 ${value.toFixed(0)} *`;
case CronType.SPECIFIC: case CronType.CUSTOM:
if (validCron(fallback)) { if (validCron(fallback)) {
return fallback; return fallback;
} }