From 323e183775328e583899f5e6dcbc23ea21f5e13a Mon Sep 17 00:00:00 2001 From: zhsama Date: Fri, 10 Oct 2025 17:28:41 +0800 Subject: [PATCH] refactor(trigger): improve config value formatting in PluginTriggerNode --- .../workflow/nodes/trigger-plugin/node.tsx | 40 +++++++++++++++++-- 1 file changed, 36 insertions(+), 4 deletions(-) diff --git a/web/app/components/workflow/nodes/trigger-plugin/node.tsx b/web/app/components/workflow/nodes/trigger-plugin/node.tsx index 982b3e62d8..f2ae1baf97 100644 --- a/web/app/components/workflow/nodes/trigger-plugin/node.tsx +++ b/web/app/components/workflow/nodes/trigger-plugin/node.tsx @@ -4,6 +4,35 @@ import type { PluginTriggerNodeType } from './types' import type { NodeProps } from '@/app/components/workflow/types' import useConfig from './use-config' +const formatConfigValue = (rawValue: any): string => { + if (rawValue === null || rawValue === undefined) + return '' + + if (typeof rawValue === 'string' || typeof rawValue === 'number' || typeof rawValue === 'boolean') + return String(rawValue) + + if (Array.isArray(rawValue)) + return rawValue.join('.') + + if (typeof rawValue === 'object') { + const { value } = rawValue as { value?: any } + if (value === null || value === undefined) + return '' + if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') + return String(value) + if (Array.isArray(value)) + return value.join('.') + try { + return JSON.stringify(value) + } + catch { + return '' + } + } + + return '' +} + const Node: FC> = ({ id, data, @@ -31,12 +60,15 @@ const Node: FC> = ({ {key}
- {typeof config[key] === 'string' && config[key].includes('secret') - ? '********' - : String(config[key] || '')} + {(() => { + const displayValue = formatConfigValue(config[key]) + if (displayValue.includes('secret')) + return '********' + return displayValue + })()}
))}