feat(frontend): 时区下拉、表格时区列与刷新反馈

- 编辑器 IANA 时区改为 Select,当前只保留 Asia/Shanghai;编辑旧任务时保留其已有值
- 任务表新增「时区」列,类型标签并入名称列,重新分配列宽
- 手动刷新改为独立状态 + 顶部进度条 + 固定按钮宽度,避免刷新时工具栏左右跳动与旧内容残留的观感
This commit is contained in:
2026-11-02 23:32:03 +08:00
parent 608872bf06
commit c7a66c22b6
3 changed files with 110 additions and 43 deletions
+18 -23
View File
@@ -60,13 +60,7 @@ const HTTP_METHOD_OPTIONS = [
{ value: 'POST', label: 'POST' },
]
const TIMEZONE_SUGGESTIONS = [
'Asia/Shanghai',
'Asia/Hong_Kong',
'UTC',
'Europe/London',
'America/New_York',
]
const TIMEZONE_OPTIONS = ['Asia/Shanghai']
const CRON_PREVIEW_COUNTS = [3, 5, 8, 10]
@@ -112,6 +106,11 @@ export function TaskEditorModal({
const cronValue = watch('cron')
const timezoneValue = watch('timezone')
const scriptPreview = watch('script')
// 当前只开放 Asia/Shanghai;编辑旧任务时把它已有的时区也保留成一个选项,
// 避免下拉显示成空值。
const timezoneOptions = Array.from(
new Set(timezoneValue ? [...TIMEZONE_OPTIONS, timezoneValue] : TIMEZONE_OPTIONS),
).map((zone) => ({ value: zone, label: zone }))
const debouncedCron = useDebouncedValue(cronValue, 300)
const debouncedTimezone = useDebouncedValue(timezoneValue, 300)
const debouncedWorkingDir = useDebouncedValue(
@@ -425,23 +424,19 @@ export function TaskEditorModal({
</section>
<div className="form-grid">
<FormField
label="IANA 时区"
htmlFor="task-timezone"
error={errors.timezone?.message}
>
<Input
id="task-timezone"
{...register('timezone')}
list="timezone-options"
placeholder="Asia/Shanghai"
aria-invalid={Boolean(errors.timezone)}
<FormField label="IANA 时区" error={errors.timezone?.message}>
<Controller
control={control}
name="timezone"
render={({ field }) => (
<Select
className="form-select"
options={timezoneOptions}
value={field.value}
onChange={field.onChange}
/>
)}
/>
<datalist id="timezone-options">
{TIMEZONE_SUGGESTIONS.map((zone) => (
<option value={zone} key={zone} />
))}
</datalist>
</FormField>
<FormField label="任务类型 (Action Type)">