mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 01:18:05 +08:00
fix: display plugin trigger labels in logs using i18n metadata
This commit is contained in:
@ -93,16 +93,26 @@ const getTriggerIcon = (triggeredFrom: string, triggerInfo?: TriggerInfo) => {
|
||||
}
|
||||
}
|
||||
|
||||
const pickLabel = (labelMap?: Record<string, string>, language?: string) => {
|
||||
if (!labelMap)
|
||||
return ''
|
||||
if (language && labelMap[language])
|
||||
return labelMap[language]
|
||||
return labelMap.en_US || labelMap['en-US'] || Object.values(labelMap)[0] || ''
|
||||
}
|
||||
|
||||
const TriggerByDisplay: FC<TriggerByDisplayProps> = ({
|
||||
triggeredFrom,
|
||||
className = '',
|
||||
showText = true,
|
||||
triggerInfo,
|
||||
}) => {
|
||||
const { t } = useTranslation()
|
||||
const { t, i18n } = useTranslation()
|
||||
|
||||
const resolvedType = resolveTriggerType(triggerInfo?.type || triggeredFrom)
|
||||
const displayName = triggerInfo?.provider_name || getTriggerDisplayName(resolvedType, t)
|
||||
const providerDisplayName = pickLabel(triggerInfo?.provider_label, i18n.language)
|
||||
|| triggerInfo?.provider_name
|
||||
const displayName = providerDisplayName || getTriggerDisplayName(resolvedType, t)
|
||||
const icon = getTriggerIcon(resolvedType, triggerInfo)
|
||||
|
||||
return (
|
||||
|
||||
@ -249,6 +249,7 @@ export type TriggerInfo = {
|
||||
workflow_trigger_log_id?: string
|
||||
provider_id?: string
|
||||
provider_name?: string
|
||||
provider_label?: Record<string, string>
|
||||
subscription_id?: string
|
||||
event_name?: string
|
||||
plugin_id?: string
|
||||
|
||||
@ -335,6 +335,7 @@ export type AppTrigger = {
|
||||
title: string
|
||||
node_id: string
|
||||
provider_name: string
|
||||
provider_label?: Record<string, string>
|
||||
provider_id?: string
|
||||
subscription_id?: string
|
||||
plugin_id?: string
|
||||
|
||||
Reference in New Issue
Block a user