diff --git a/frontend/src/app/pages/Dashboard/DashboardToolbar.tsx b/frontend/src/app/pages/Dashboard/DashboardToolbar.tsx index a1a96759..379ce197 100644 --- a/frontend/src/app/pages/Dashboard/DashboardToolbar.tsx +++ b/frontend/src/app/pages/Dashboard/DashboardToolbar.tsx @@ -8,7 +8,6 @@ import Snackbar from '@mui/material/Snackbar'; import Icon from '@mui/material/Icon'; import { styled } from '@mui/material/styles'; import AddRounded from '@mui/icons-material/AddRounded'; -import CalendarMonthRounded from '@mui/icons-material/CalendarMonthRounded'; import ChatBubbleTeardrop from './ChatBubbleTeardrop'; @@ -770,7 +769,10 @@ const DashboardToolbar = React.forwardRef( ...popIn(3), }} > - + + + + diff --git a/frontend/src/app/pages/Workflows/app/RepeatField.tsx b/frontend/src/app/pages/Workflows/app/RepeatField.tsx new file mode 100644 index 00000000..25517e82 --- /dev/null +++ b/frontend/src/app/pages/Workflows/app/RepeatField.tsx @@ -0,0 +1,83 @@ +import React, { useEffect, useRef, useState } from 'react'; +import { WC } from './uiKit'; + +// Combobox for the run limit: pick a preset OR type any count. Self-rendered +// (no native { setEditing(true); setDraft(value == null ? '' : String(value)); setOpen(true); }} + onChange={(e) => commit(e.target.value)} + style={{ flex: 1, minWidth: 0, border: 'none', outline: 'none', background: 'transparent', fontSize: 13, color: value == null && !editing ? WC.muted : WC.ink, fontFamily: "'JetBrains Mono',monospace" }} + /> + + + {open && ( +
+ {OPTIONS.map((o) => { + const active = (o.val == null && value == null) || o.val === value; + return ( +
{ e.preventDefault(); pick(o.val); }} + style={{ padding: '7px 9px', borderRadius: 6, fontSize: 13, cursor: 'pointer', color: WC.ink, background: active ? WC.selBg : 'transparent', fontWeight: active ? 600 : 400 }} + > + {o.label} +
+ ); + })} +
+ )} + + ); +}; + +export default RepeatField; diff --git a/frontend/src/app/pages/Workflows/app/ScheduleCard.tsx b/frontend/src/app/pages/Workflows/app/ScheduleCard.tsx index 7dd80b6f..e015eeb2 100644 --- a/frontend/src/app/pages/Workflows/app/ScheduleCard.tsx +++ b/frontend/src/app/pages/Workflows/app/ScheduleCard.tsx @@ -7,10 +7,10 @@ import { freqOf, patchForFreq, intervalMinutes, timeInputValue, parseTimeInput, ordinal, nextRunText, type Freq, } from './model'; import { useWorkflowPatch } from './useWorkflowPatch'; +import RepeatField from './RepeatField'; const FREQS: Array<[Freq, string]> = [['daily', 'Daily'], ['weekly', 'Weekly'], ['monthly', 'Monthly'], ['interval', 'Interval']]; const DAY_LABELS: Array<[string, number]> = [['S', 0], ['M', 1], ['T', 2], ['W', 3], ['T', 4], ['F', 5], ['S', 6]]; -const REPEAT_PRESETS = [1, 3, 10]; const ScheduleCard: React.FC<{ workflow: Workflow }> = ({ workflow }) => { const patch = useWorkflowPatch(); @@ -42,13 +42,8 @@ const ScheduleCard: React.FC<{ workflow: Workflow }> = ({ workflow }) => { const dom = sched.day_of_month ?? 1; const maxRuns = sched.max_runs; - const repeatSel = maxRuns == null ? 'forever' : REPEAT_PRESETS.includes(maxRuns) ? String(maxRuns) : 'custom'; // Picking a finite limit resets the lifetime counter so "run 3 times" always means 3 from now. - const onRepeat = (val: string) => { - if (val === 'forever') return patchSched({ max_runs: null }); - if (val === 'custom') return patchSched({ max_runs: maxRuns && !REPEAT_PRESETS.includes(maxRuns) ? maxRuns : 2, runs_count: 0 }); - patchSched({ max_runs: parseInt(val, 10), runs_count: 0 }); - }; + const setMaxRuns = (n: number | null) => patchSched(n == null ? { max_runs: null } : { max_runs: n, runs_count: 0 }); return (
@@ -92,7 +87,7 @@ const ScheduleCard: React.FC<{ workflow: Workflow }> = ({ workflow }) => { type="time" value={timeInputValue(sched)} onChange={(e) => { const t = parseTimeInput(e.target.value); if (t) patchSched(t); }} - style={{ background: '#FFFFFF', border: '1px solid rgba(33,30,27,0.12)', borderRadius: 8, padding: '6px 9px', fontSize: 13, fontFamily: "'JetBrains Mono',monospace", color: WC.ink }} + style={{ width: 134, boxSizing: 'border-box', height: 32, background: '#FFFFFF', border: '1px solid rgba(33,30,27,0.12)', borderRadius: 8, padding: '0 9px', fontSize: 13, fontFamily: "'JetBrains Mono',monospace", color: WC.ink }} />
) : ( @@ -124,26 +119,7 @@ const ScheduleCard: React.FC<{ workflow: Workflow }> = ({ workflow }) => {
Repeat -
- - {repeatSel === 'custom' && ( - patchSched({ max_runs: Math.max(1, parseInt(e.target.value, 10) || 1), runs_count: 0 })} - style={{ width: 56, background: '#FFFFFF', border: '1px solid rgba(33,30,27,0.12)', borderRadius: 8, padding: '6px 9px', fontSize: 13, fontFamily: "'JetBrains Mono',monospace", color: WC.ink, textAlign: 'right' }} - /> - )} -
+