From c7a66c22b6cc858f70f6350f2be3ce8a6087bf4f Mon Sep 17 00:00:00 2001 From: CNWei Date: Mon, 2 Nov 2026 23:32:03 +0800 Subject: [PATCH] =?UTF-8?q?feat(frontend):=20=E6=97=B6=E5=8C=BA=E4=B8=8B?= =?UTF-8?q?=E6=8B=89=E3=80=81=E8=A1=A8=E6=A0=BC=E6=97=B6=E5=8C=BA=E5=88=97?= =?UTF-8?q?=E4=B8=8E=E5=88=B7=E6=96=B0=E5=8F=8D=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 编辑器 IANA 时区改为 Select,当前只保留 Asia/Shanghai;编辑旧任务时保留其已有值 - 任务表新增「时区」列,类型标签并入名称列,重新分配列宽 - 手动刷新改为独立状态 + 顶部进度条 + 固定按钮宽度,避免刷新时工具栏左右跳动与旧内容残留的观感 --- frontend/src/App.css | 54 ++++++++++++++++++- frontend/src/components/TaskEditorModal.tsx | 41 +++++++-------- frontend/src/pages/TaskDashboard.tsx | 58 ++++++++++++++------- 3 files changed, 110 insertions(+), 43 deletions(-) diff --git a/frontend/src/App.css b/frontend/src/App.css index 7e55f13..35a4df1 100644 --- a/frontend/src/App.css +++ b/frontend/src/App.css @@ -62,9 +62,44 @@ /* ---------- 任务列表 ---------- */ .task-card { + position: relative; overflow: hidden; } +/* 手动刷新时的顶部进度条:不改变表格布局,也避免旧数据看起来像「残影」 */ +.refresh-bar { + position: absolute; + z-index: 2; + top: 0; + right: 0; + left: 0; + height: 2px; + overflow: hidden; + background-color: var(--su-color-primary-soft); + pointer-events: none; +} + +.refresh-bar::after { + content: ''; + position: absolute; + top: 0; + bottom: 0; + left: 0; + width: 40%; + background-color: var(--su-color-primary); + animation: refresh-slide 1.1s ease-in-out infinite; +} + +@keyframes refresh-slide { + from { + transform: translateX(-100%); + } + + to { + transform: translateX(250%); + } +} + /* 表格嵌在卡片里:去掉自身描边与圆角,避免「卡片套卡片」 */ .task-table { border: 0; @@ -99,6 +134,12 @@ min-width: 140px; } +/* 「刷新」和「同步中...」字数不同,固定宽度避免刷新时工具栏左右跳动 */ +.refresh-button { + min-width: 68px; + justify-content: center; +} + .task-name-cell { display: flex; min-width: 0; @@ -106,9 +147,16 @@ gap: 2px; } +.task-name-row { + display: flex; + min-width: 0; + align-items: center; + gap: 6px; +} + .task-name { display: block; - max-width: 240px; + max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; @@ -119,6 +167,10 @@ font-family: var(--su-font-mono); } +.timezone-cell { + white-space: nowrap; +} + .schedule-cell { display: flex; align-items: flex-start; diff --git a/frontend/src/components/TaskEditorModal.tsx b/frontend/src/components/TaskEditorModal.tsx index 900ec86..8197e85 100644 --- a/frontend/src/components/TaskEditorModal.tsx +++ b/frontend/src/components/TaskEditorModal.tsx @@ -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({
- - + ( +