mirror of
https://github.com/langgenius/dify.git
synced 2026-04-26 18:27:15 +08:00
feat(workflow): enhance variable inspector to support schedule trigger events with next execution time display
This commit is contained in:
parent
96f0d648fa
commit
0b1015e221
@ -8,6 +8,8 @@ import { StopCircle } from '@/app/components/base/icons/src/vender/line/mediaAnd
|
|||||||
import { useStore } from '../store'
|
import { useStore } from '../store'
|
||||||
import { useGetToolIcon } from '@/app/components/workflow/hooks/use-tool-icon'
|
import { useGetToolIcon } from '@/app/components/workflow/hooks/use-tool-icon'
|
||||||
import type { TFunction } from 'i18next'
|
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 = (
|
const resolveListeningDescription = (
|
||||||
message: string | undefined,
|
message: string | undefined,
|
||||||
@ -18,9 +20,13 @@ const resolveListeningDescription = (
|
|||||||
if (message)
|
if (message)
|
||||||
return message
|
return message
|
||||||
|
|
||||||
const nodeDescription = (triggerNode?.data as { desc?: string })?.desc
|
if (triggerType === BlockEnum.TriggerSchedule) {
|
||||||
if (nodeDescription)
|
const scheduleData = triggerNode?.data as ScheduleTriggerNodeType | undefined
|
||||||
return nodeDescription
|
const nextTriggerTime = scheduleData ? getNextExecutionTime(scheduleData) : ''
|
||||||
|
return t('workflow.debug.variableInspect.listening.tipSchedule', {
|
||||||
|
nextTriggerTime: nextTriggerTime || t('workflow.debug.variableInspect.listening.defaultScheduleTime'),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
if (triggerType === BlockEnum.TriggerPlugin) {
|
if (triggerType === BlockEnum.TriggerPlugin) {
|
||||||
const pluginName = (triggerNode?.data as { provider_name?: string; title?: string })?.provider_name
|
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 })
|
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')
|
return t('workflow.debug.variableInspect.listening.tipFallback')
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +81,6 @@ const Listening: FC<ListeningProps> = ({
|
|||||||
const listeningTriggerNodeId = useStore(s => s.listeningTriggerNodeId)
|
const listeningTriggerNodeId = useStore(s => s.listeningTriggerNodeId)
|
||||||
const listeningTriggerNodeIds = useStore(s => s.listeningTriggerNodeIds)
|
const listeningTriggerNodeIds = useStore(s => s.listeningTriggerNodeIds)
|
||||||
const listeningTriggerIsAll = useStore(s => s.listeningTriggerIsAll)
|
const listeningTriggerIsAll = useStore(s => s.listeningTriggerIsAll)
|
||||||
const triggerType = listeningTriggerType || BlockEnum.TriggerWebhook
|
|
||||||
|
|
||||||
const getToolIcon = useGetToolIcon()
|
const getToolIcon = useGetToolIcon()
|
||||||
|
|
||||||
@ -81,6 +90,8 @@ const Listening: FC<ListeningProps> = ({
|
|||||||
const triggerNode = listeningTriggerNodeId
|
const triggerNode = listeningTriggerNodeId
|
||||||
? nodes.find(node => node.id === listeningTriggerNodeId)
|
? nodes.find(node => node.id === listeningTriggerNodeId)
|
||||||
: undefined
|
: undefined
|
||||||
|
const inferredTriggerType = (triggerNode?.data as { type?: BlockEnum })?.type
|
||||||
|
const triggerType = listeningTriggerType || inferredTriggerType || BlockEnum.TriggerWebhook
|
||||||
|
|
||||||
let displayNodes: Node[] = []
|
let displayNodes: Node[] = []
|
||||||
|
|
||||||
@ -138,7 +149,7 @@ const Listening: FC<ListeningProps> = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className='flex flex-col gap-1'>
|
<div className='flex flex-col gap-1'>
|
||||||
<div className='system-sm-semibold text-text-secondary'>{t('workflow.debug.variableInspect.listening.title')}</div>
|
<div className='system-sm-semibold text-text-secondary'>{t('workflow.debug.variableInspect.listening.title')}</div>
|
||||||
<div className='system-xs-regular text-text-tertiary'>{description}</div>
|
<div className='system-xs-regular whitespace-pre-line text-text-tertiary'>{description}</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@ -1230,9 +1230,11 @@ const translation = {
|
|||||||
title: 'Listening for events from triggers...',
|
title: 'Listening for events from triggers...',
|
||||||
tip: 'You can now simulate event triggers by sending test requests to HTTP {{nodeName}} endpoint or use it as a callback URL for live event debugging. All outputs can be viewed directly in the Variable Inspector.',
|
tip: 'You can now simulate event triggers by sending test requests to HTTP {{nodeName}} endpoint or use it as a callback URL for live event debugging. All outputs can be viewed directly in the Variable Inspector.',
|
||||||
tipPlugin: 'Now you can create events in {{- pluginName}}, and retrieve outputs from these events in the Variable Inspector.',
|
tipPlugin: 'Now you can create events in {{- pluginName}}, and retrieve outputs from these events in the Variable Inspector.',
|
||||||
|
tipSchedule: 'Listening for events from schedule triggers.\nNext scheduled run: {{nextTriggerTime}}',
|
||||||
tipFallback: 'Await incoming trigger events. Outputs will appear here.',
|
tipFallback: 'Await incoming trigger events. Outputs will appear here.',
|
||||||
defaultNodeName: 'this trigger',
|
defaultNodeName: 'this trigger',
|
||||||
defaultPluginName: 'this plugin trigger',
|
defaultPluginName: 'this plugin trigger',
|
||||||
|
defaultScheduleTime: 'Not configured',
|
||||||
selectedTriggers: 'selected triggers',
|
selectedTriggers: 'selected triggers',
|
||||||
stopButton: 'Stop',
|
stopButton: 'Stop',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1173,9 +1173,11 @@ const translation = {
|
|||||||
title: 'トリガーからのイベントを待機中…',
|
title: 'トリガーからのイベントを待機中…',
|
||||||
tip: 'HTTP {{nodeName}} エンドポイントにテストリクエストを送信するか、ライブイベントデバッグ用のコールバック URL として利用してイベントトリガーをシミュレートできます。すべての出力は Variable Inspector で直接確認できます。',
|
tip: 'HTTP {{nodeName}} エンドポイントにテストリクエストを送信するか、ライブイベントデバッグ用のコールバック URL として利用してイベントトリガーをシミュレートできます。すべての出力は Variable Inspector で直接確認できます。',
|
||||||
tipPlugin: '{{- pluginName}} でイベントを作成し、これらのイベントの出力を Variable Inspector で取得できます。',
|
tipPlugin: '{{- pluginName}} でイベントを作成し、これらのイベントの出力を Variable Inspector で取得できます。',
|
||||||
|
tipSchedule: 'スケジュールトリガーからのイベントを待機しています。\n次回の予定実行: {{nextTriggerTime}}',
|
||||||
tipFallback: 'トリガーイベントを待機しています。出力はここに表示されます。',
|
tipFallback: 'トリガーイベントを待機しています。出力はここに表示されます。',
|
||||||
defaultNodeName: 'このトリガー',
|
defaultNodeName: 'このトリガー',
|
||||||
defaultPluginName: 'このプラグイントリガー',
|
defaultPluginName: 'このプラグイントリガー',
|
||||||
|
defaultScheduleTime: '未設定',
|
||||||
selectedTriggers: '選択したトリガー',
|
selectedTriggers: '選択したトリガー',
|
||||||
stopButton: '停止',
|
stopButton: '停止',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1203,9 +1203,11 @@ const translation = {
|
|||||||
title: '正在监听触发器事件…',
|
title: '正在监听触发器事件…',
|
||||||
tip: '您现在可以向 HTTP {{nodeName}} 端点发送测试请求以模拟事件触发,或将其用作实时事件调试的回调 URL。所有输出都可以在变量检查器中直接查看。',
|
tip: '您现在可以向 HTTP {{nodeName}} 端点发送测试请求以模拟事件触发,或将其用作实时事件调试的回调 URL。所有输出都可以在变量检查器中直接查看。',
|
||||||
tipPlugin: '现在您可以在 {{- pluginName}} 中创建事件,并在变量检查器中查看这些事件的输出。',
|
tipPlugin: '现在您可以在 {{- pluginName}} 中创建事件,并在变量检查器中查看这些事件的输出。',
|
||||||
|
tipSchedule: '正在监听计划触发器事件。\n下一次计划运行时间:{{nextTriggerTime}}',
|
||||||
tipFallback: '正在等待触发器事件,输出结果将在此显示。',
|
tipFallback: '正在等待触发器事件,输出结果将在此显示。',
|
||||||
defaultNodeName: '此触发器',
|
defaultNodeName: '此触发器',
|
||||||
defaultPluginName: '此插件触发器',
|
defaultPluginName: '此插件触发器',
|
||||||
|
defaultScheduleTime: '未设置',
|
||||||
selectedTriggers: '所选触发器',
|
selectedTriggers: '所选触发器',
|
||||||
stopButton: '停止',
|
stopButton: '停止',
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1012,9 +1012,11 @@ const translation = {
|
|||||||
title: '正在監聽觸發器事件…',
|
title: '正在監聽觸發器事件…',
|
||||||
tip: '您現在可以向 HTTP {{nodeName}} 端點發送測試請求來模擬事件觸發,或將其作為即時事件除錯的回呼 URL。所有輸出都可在變數檢視器中直接查看。',
|
tip: '您現在可以向 HTTP {{nodeName}} 端點發送測試請求來模擬事件觸發,或將其作為即時事件除錯的回呼 URL。所有輸出都可在變數檢視器中直接查看。',
|
||||||
tipPlugin: '您現在可以在 {{- pluginName}} 中建立事件,並在變數檢視器中檢視這些事件的輸出。',
|
tipPlugin: '您現在可以在 {{- pluginName}} 中建立事件,並在變數檢視器中檢視這些事件的輸出。',
|
||||||
|
tipSchedule: '正在監聽排程觸發器事件。\n下一次排程執行時間:{{nextTriggerTime}}',
|
||||||
tipFallback: '正在等待觸發器事件,輸出會顯示在此處。',
|
tipFallback: '正在等待觸發器事件,輸出會顯示在此處。',
|
||||||
defaultNodeName: '此觸發器',
|
defaultNodeName: '此觸發器',
|
||||||
defaultPluginName: '此插件觸發器',
|
defaultPluginName: '此插件觸發器',
|
||||||
|
defaultScheduleTime: '未設定',
|
||||||
selectedTriggers: '已選觸發器',
|
selectedTriggers: '已選觸發器',
|
||||||
stopButton: '停止',
|
stopButton: '停止',
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user