mirror of
https://github.com/open-webui/open-webui.git
synced 2026-12-03 18:17:56 -05:00
refac
This commit is contained in:
1 parent
f284531049
commit
1d236bfa81
2 files changed
+24
-9
No files matched your search
@@ -847,6 +847,7 @@
|
||||
<ScheduleTrigger
|
||||
bind:this={card.fields}
|
||||
bind:frequency={card.frequency}
|
||||
fallbackStart={dayjs(automation.created_at / 1_000_000).format('YYYY-MM-DD')}
|
||||
onChange={() => scheduleTick++}
|
||||
/>
|
||||
{/if}
|
||||
@@ -967,6 +968,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="mt-3 text-[0.6875rem] text-base-400 dark:text-base-500">
|
||||
{action_type === 'code' ? $i18n.t('Code') : $i18n.t('Prompt')}
|
||||
</div>
|
||||
{#if action_type === 'code'}
|
||||
<div class="relative mt-1 {showCode || !codeClamped ? '' : 'max-h-40 overflow-hidden'}">
|
||||
<CodeEditor
|
||||
|
||||
@@ -16,8 +16,12 @@
|
||||
export let minute = 0;
|
||||
export let selectedDays: string[] = [];
|
||||
export let monthDay = 1;
|
||||
/** Anchors the repeat; empty for rules saved without one. */
|
||||
/** Anchors the repeat. */
|
||||
export let startDate = dayjs().format('YYYY-MM-DD');
|
||||
/** The start shown for a stored rule saved without one, such as the automation's created date. */
|
||||
export let fallbackStart = '';
|
||||
// The shown fallback stays out of the rule until a date is picked.
|
||||
let startFromFallback = false;
|
||||
export let onceDate = '';
|
||||
export let onceTime = '09:00';
|
||||
export let customRrule = '';
|
||||
@@ -44,7 +48,7 @@
|
||||
// Without BYDAY a weekly rule runs on its start date's weekday, the others on every day.
|
||||
$: defaultDays =
|
||||
frequency === 'WEEKLY'
|
||||
? [['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'][dayjs(startDate || undefined).day()]]
|
||||
? [['SU', 'MO', 'TU', 'WE', 'TH', 'FR', 'SA'][dayjs(startDate).day()]]
|
||||
: DAYS.map((day) => day.key);
|
||||
$: activeDays = selectedDays.length ? selectedDays : defaultDays;
|
||||
$: daysLabel =
|
||||
@@ -114,10 +118,8 @@
|
||||
}
|
||||
parts.push(`BYMINUTE=${minute}`);
|
||||
// Hourly repeats count from midnight of the start date.
|
||||
const start = startDate
|
||||
? `DTSTART:${startDate.replace(/-/g, '')}T${freq === 'HOURLY' ? '00' : pad(hour)}${pad(minute)}00\n`
|
||||
: '';
|
||||
return `${start}RRULE:${parts.join(';')}`;
|
||||
const start = `${startDate.replace(/-/g, '')}T${freq === 'HOURLY' ? '00' : pad(hour)}${pad(minute)}00`;
|
||||
return `${startFromFallback ? '' : `DTSTART:${start}\n`}RRULE:${parts.join(';')}`;
|
||||
};
|
||||
|
||||
export const buildRrule = (): string => (frequency === 'CUSTOM' ? customRrule : build(frequency));
|
||||
@@ -164,7 +166,10 @@
|
||||
minute = parseInt(parts.BYMINUTE || match?.[5] || '0');
|
||||
selectedDays = parts.BYDAY ? parts.BYDAY.split(',') : [];
|
||||
monthDay = parseInt(parts.BYMONTHDAY || '1');
|
||||
startDate = match ? `${match[1]}-${match[2]}-${match[3]}` : '';
|
||||
startFromFallback = !match;
|
||||
startDate = match
|
||||
? `${match[1]}-${match[2]}-${match[3]}`
|
||||
: fallbackStart || dayjs().format('YYYY-MM-DD');
|
||||
};
|
||||
|
||||
// Bare values inside the editor's label | value rows.
|
||||
@@ -206,9 +211,15 @@
|
||||
<input
|
||||
aria-label={$i18n.t('Start date')}
|
||||
type="date"
|
||||
bind:value={startDate}
|
||||
value={startDate}
|
||||
required
|
||||
class={fieldClass}
|
||||
on:input={onChange}
|
||||
on:input={(e) => {
|
||||
if (!e.currentTarget.value) return;
|
||||
startDate = e.currentTarget.value;
|
||||
startFromFallback = false;
|
||||
onChange();
|
||||
}}
|
||||
/>
|
||||
<span class={wordClass}>{$i18n.t('every')}</span>
|
||||
<input
|
||||
|
||||
Reference in new issue
Block a user