mirror of https://github.com/langgenius/dify.git
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 { 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<ListeningProps> = ({
|
|||
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<ListeningProps> = ({
|
|||
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<ListeningProps> = ({
|
|||
</div>
|
||||
<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-xs-regular text-text-tertiary'>{description}</div>
|
||||
<div className='system-xs-regular whitespace-pre-line text-text-tertiary'>{description}</div>
|
||||
</div>
|
||||
<div>
|
||||
<Button
|
||||
|
|
|
|||
|
|
@ -1230,9 +1230,11 @@ const translation = {
|
|||
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.',
|
||||
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.',
|
||||
defaultNodeName: 'this trigger',
|
||||
defaultPluginName: 'this plugin trigger',
|
||||
defaultScheduleTime: 'Not configured',
|
||||
selectedTriggers: 'selected triggers',
|
||||
stopButton: 'Stop',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1173,9 +1173,11 @@ const translation = {
|
|||
title: 'トリガーからのイベントを待機中…',
|
||||
tip: 'HTTP {{nodeName}} エンドポイントにテストリクエストを送信するか、ライブイベントデバッグ用のコールバック URL として利用してイベントトリガーをシミュレートできます。すべての出力は Variable Inspector で直接確認できます。',
|
||||
tipPlugin: '{{- pluginName}} でイベントを作成し、これらのイベントの出力を Variable Inspector で取得できます。',
|
||||
tipSchedule: 'スケジュールトリガーからのイベントを待機しています。\n次回の予定実行: {{nextTriggerTime}}',
|
||||
tipFallback: 'トリガーイベントを待機しています。出力はここに表示されます。',
|
||||
defaultNodeName: 'このトリガー',
|
||||
defaultPluginName: 'このプラグイントリガー',
|
||||
defaultScheduleTime: '未設定',
|
||||
selectedTriggers: '選択したトリガー',
|
||||
stopButton: '停止',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1203,9 +1203,11 @@ const translation = {
|
|||
title: '正在监听触发器事件…',
|
||||
tip: '您现在可以向 HTTP {{nodeName}} 端点发送测试请求以模拟事件触发,或将其用作实时事件调试的回调 URL。所有输出都可以在变量检查器中直接查看。',
|
||||
tipPlugin: '现在您可以在 {{- pluginName}} 中创建事件,并在变量检查器中查看这些事件的输出。',
|
||||
tipSchedule: '正在监听计划触发器事件。\n下一次计划运行时间:{{nextTriggerTime}}',
|
||||
tipFallback: '正在等待触发器事件,输出结果将在此显示。',
|
||||
defaultNodeName: '此触发器',
|
||||
defaultPluginName: '此插件触发器',
|
||||
defaultScheduleTime: '未设置',
|
||||
selectedTriggers: '所选触发器',
|
||||
stopButton: '停止',
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1012,9 +1012,11 @@ const translation = {
|
|||
title: '正在監聽觸發器事件…',
|
||||
tip: '您現在可以向 HTTP {{nodeName}} 端點發送測試請求來模擬事件觸發,或將其作為即時事件除錯的回呼 URL。所有輸出都可在變數檢視器中直接查看。',
|
||||
tipPlugin: '您現在可以在 {{- pluginName}} 中建立事件,並在變數檢視器中檢視這些事件的輸出。',
|
||||
tipSchedule: '正在監聽排程觸發器事件。\n下一次排程執行時間:{{nextTriggerTime}}',
|
||||
tipFallback: '正在等待觸發器事件,輸出會顯示在此處。',
|
||||
defaultNodeName: '此觸發器',
|
||||
defaultPluginName: '此插件觸發器',
|
||||
defaultScheduleTime: '未設定',
|
||||
selectedTriggers: '已選觸發器',
|
||||
stopButton: '停止',
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue