Merge schedule summary and timezone into one line in trigger config
Show the user's timezone inline next to clock-pinned schedules (Runs every day at 09:00 (GMT-3)) instead of on a separate hint line, and only when the schedule pins a time of day — minute/hour intervals omit it.
This commit is contained in:
parent
a129b6b5cd
commit
867c8d8acf
4 changed files with 17 additions and 5 deletions
|
|
@ -249,7 +249,6 @@
|
|||
'minute' => 'Trigger at minute',
|
||||
'weekdays' => 'Trigger on weekdays',
|
||||
'day_of_month' => 'Day of month',
|
||||
'timezone_hint' => 'All times in :tz',
|
||||
'weekday_names' => [
|
||||
'sun' => 'Sun',
|
||||
'mon' => 'Mon',
|
||||
|
|
|
|||
|
|
@ -249,7 +249,6 @@
|
|||
'minute' => 'Disparar al minuto',
|
||||
'weekdays' => 'Disparar en días',
|
||||
'day_of_month' => 'Día del mes',
|
||||
'timezone_hint' => 'Todos los horarios en :tz',
|
||||
'weekday_names' => [
|
||||
'sun' => 'Dom',
|
||||
'mon' => 'Lun',
|
||||
|
|
|
|||
|
|
@ -249,7 +249,6 @@
|
|||
'minute' => 'Disparar no minuto',
|
||||
'weekdays' => 'Disparar nos dias',
|
||||
'day_of_month' => 'Dia do mês',
|
||||
'timezone_hint' => 'Todos os horários em :tz',
|
||||
'weekday_names' => [
|
||||
'sun' => 'Dom',
|
||||
'mon' => 'Seg',
|
||||
|
|
|
|||
|
|
@ -84,6 +84,22 @@ const isWeekdaySelected = (value: number) =>
|
|||
const generatedCron = computed(() => generateScheduleCron(local.value));
|
||||
const humanSchedule = computed(() => scheduleSummary(local.value));
|
||||
|
||||
// Append the user's timezone only for schedules pinned to a clock time
|
||||
// (days/weeks/months). Minute/hour intervals are relative, so a timezone
|
||||
// would be meaningless next to them.
|
||||
const scheduleSummaryLine = computed(() => {
|
||||
if (!humanSchedule.value) {
|
||||
return '';
|
||||
}
|
||||
const pinsClockTime = local.value.schedule_field === ScheduleField.Days
|
||||
|| local.value.schedule_field === ScheduleField.Weeks
|
||||
|| local.value.schedule_field === ScheduleField.Months;
|
||||
|
||||
return pinsClockTime
|
||||
? `${humanSchedule.value} (${timezoneAbbr.value})`
|
||||
: humanSchedule.value;
|
||||
});
|
||||
|
||||
watch(generatedCron, (cron) => {
|
||||
if (local.value.trigger_type === TriggerType.Schedule) {
|
||||
local.value.cron = cron;
|
||||
|
|
@ -269,8 +285,7 @@ watch(local, (val) => emit('update', val), { deep: true });
|
|||
</div>
|
||||
</template>
|
||||
|
||||
<p class="rounded-md bg-muted px-3 py-2 text-xs text-foreground/70">{{ humanSchedule }}</p>
|
||||
<p class="text-xs text-foreground/50">{{ $t('automations.config.trigger.schedule.timezone_hint', { tz: timezoneAbbr }) }}</p>
|
||||
<p class="rounded-md bg-muted px-3 py-2 text-xs text-foreground/70">{{ scheduleSummaryLine }}</p>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
|
|
|||
Loading…
Reference in a new issue