diff --git a/src/features/workbench/components/scheduled-condition-feed.tsx b/src/features/workbench/components/scheduled-condition-feed.tsx index bca1ee8..5fd65c0 100644 --- a/src/features/workbench/components/scheduled-condition-feed.tsx +++ b/src/features/workbench/components/scheduled-condition-feed.tsx @@ -5,6 +5,7 @@ import { ChevronRight, ClipboardList, History, + RefreshCw, X, XCircle } from "lucide-react"; @@ -100,6 +101,7 @@ type ScheduledConditionFeedProps = { onTaskReconcile?: (taskId: string, actionId: string, expectedVersion: number) => Promise; onLoadTaskEvidenceSnapshot?: (taskId: string, evidenceId: string) => Promise; onTaskRefresh?: () => void; + onRefresh?: () => void | Promise; onCreateSchedule?: (input: ScheduleCreateRequest) => Promise; }; @@ -133,6 +135,7 @@ export function ScheduledConditionFeed({ onTaskReconcile, onLoadTaskEvidenceSnapshot, onTaskRefresh, + onRefresh, onCreateSchedule }: ScheduledConditionFeedProps) { const [uncontrolledExpanded, setUncontrolledExpanded] = useState(false); @@ -152,6 +155,7 @@ export function ScheduledConditionFeed({ const [scheduleNextRunAt, setScheduleNextRunAt] = useState(() => formatLocalDateTimeInput(new Date(Date.now() + 15 * 60_000))); const [scheduleSubmitting, setScheduleSubmitting] = useState(false); const [scheduleError, setScheduleError] = useState(null); + const [refreshing, setRefreshing] = useState(false); const mobileSheet = presentation === "mobile-sheet"; const desktopDock = presentation === "desktop-dock"; const compactPresentation = mobileSheet || desktopDock; @@ -330,6 +334,23 @@ export function ScheduledConditionFeed({ } finally { setScheduleSubmitting(false); } } + async function handleRefresh() { + if (!onRefresh || refreshing) return; + setRefreshing(true); + try { + await onRefresh(); + } catch (error) { + showMapNotice({ + id: "scheduled-condition-refresh", + tone: "error", + title: "工况任务刷新失败", + message: error instanceof Error ? error.message : "暂时无法重新获取工况任务。" + }); + } finally { + setRefreshing(false); + } + } + function handleSelectTimelineCondition(conditionId: string) { updateSelectedConditionId(conditionId); if (!expanded) { @@ -449,6 +470,22 @@ export function ScheduledConditionFeed({