From 0b1015e221b6d5dddb0e2aca6bc7c2cf07fee5b2 Mon Sep 17 00:00:00 2001 From: zhsama Date: Tue, 28 Oct 2025 14:12:20 +0800 Subject: [PATCH] feat(workflow): enhance variable inspector to support schedule trigger events with next execution time display --- .../workflow/variable-inspect/listening.tsx | 21 ++++++++++++++----- web/i18n/en-US/workflow.ts | 2 ++ web/i18n/ja-JP/workflow.ts | 2 ++ web/i18n/zh-Hans/workflow.ts | 2 ++ web/i18n/zh-Hant/workflow.ts | 2 ++ 5 files changed, 24 insertions(+), 5 deletions(-) diff --git a/web/app/components/workflow/variable-inspect/listening.tsx b/web/app/components/workflow/variable-inspect/listening.tsx index e325df2175..2eb250ee4b 100644 --- a/web/app/components/workflow/variable-inspect/listening.tsx +++ b/web/app/components/workflow/variable-inspect/listening.tsx @@ -8,6 +8,8 @@ import { StopCircle } from '@/app/components/base/icons/src/vender/line/mediaAnd import { useStore } from '../store' import { useGetToolIcon } from '@/app/components/workflow/hooks/use-tool-icon' import type { TFunction } from 'i18next' +import { getNextExecutionTime } from '@/app/components/workflow/nodes/trigger-schedule/utils/execution-time-calculator' +import type { ScheduleTriggerNodeType } from '@/app/components/workflow/nodes/trigger-schedule/types' const resolveListeningDescription = ( message: string | undefined, @@ -18,9 +20,13 @@ const resolveListeningDescription = ( if (message) return message - const nodeDescription = (triggerNode?.data as { desc?: string })?.desc - if (nodeDescription) - return nodeDescription + if (triggerType === BlockEnum.TriggerSchedule) { + const scheduleData = triggerNode?.data as ScheduleTriggerNodeType | undefined + const nextTriggerTime = scheduleData ? getNextExecutionTime(scheduleData) : '' + return t('workflow.debug.variableInspect.listening.tipSchedule', { + nextTriggerTime: nextTriggerTime || t('workflow.debug.variableInspect.listening.defaultScheduleTime'), + }) + } if (triggerType === BlockEnum.TriggerPlugin) { const pluginName = (triggerNode?.data as { provider_name?: string; title?: string })?.provider_name @@ -34,6 +40,10 @@ const resolveListeningDescription = ( return t('workflow.debug.variableInspect.listening.tip', { nodeName }) } + const nodeDescription = (triggerNode?.data as { desc?: string })?.desc + if (nodeDescription) + return nodeDescription + return t('workflow.debug.variableInspect.listening.tipFallback') } @@ -71,7 +81,6 @@ const Listening: FC = ({ const listeningTriggerNodeId = useStore(s => s.listeningTriggerNodeId) const listeningTriggerNodeIds = useStore(s => s.listeningTriggerNodeIds) const listeningTriggerIsAll = useStore(s => s.listeningTriggerIsAll) - const triggerType = listeningTriggerType || BlockEnum.TriggerWebhook const getToolIcon = useGetToolIcon() @@ -81,6 +90,8 @@ const Listening: FC = ({ const triggerNode = listeningTriggerNodeId ? nodes.find(node => node.id === listeningTriggerNodeId) : undefined + const inferredTriggerType = (triggerNode?.data as { type?: BlockEnum })?.type + const triggerType = listeningTriggerType || inferredTriggerType || BlockEnum.TriggerWebhook let displayNodes: Node[] = [] @@ -138,7 +149,7 @@ const Listening: FC = ({
{t('workflow.debug.variableInspect.listening.title')}
-
{description}
+
{description}