mirror of
https://github.com/langgenius/dify.git
synced 2026-01-08 07:14:14 +00:00
refactor(trigger): update variable names for clarity and consistency
- Renamed variables related to triggers to use 'trigger' terminology consistently across the codebase. - Adjusted filtering logic in `TriggerPluginList` to reference 'events' instead of 'triggers' for improved clarity. - Updated the `getTriggerIcon` function to reflect the new naming conventions and ensure proper icon rendering.
This commit is contained in:
@@ -57,15 +57,16 @@ const getTriggerIcon = (trigger: AppTrigger, triggerPlugins: any[]) => {
|
||||
blockType = BlockEnum.TriggerWebhook
|
||||
}
|
||||
|
||||
let toolIcon: string | undefined
|
||||
let triggerIcon: string | undefined
|
||||
if (trigger_type === 'trigger-plugin' && provider_name) {
|
||||
const targetTools = triggerPlugins || []
|
||||
const foundTool = targetTools.find(toolWithProvider =>
|
||||
canFindTool(toolWithProvider.id, provider_name)
|
||||
|| toolWithProvider.id.includes(provider_name)
|
||||
|| toolWithProvider.name === provider_name,
|
||||
const targetTriggers = triggerPlugins || []
|
||||
const foundTrigger = targetTriggers.find(triggerWithProvider =>
|
||||
canFindTool(triggerWithProvider.id, provider_name)
|
||||
|| triggerWithProvider.id.includes(provider_name)
|
||||
|| triggerWithProvider.name === provider_name,
|
||||
)
|
||||
toolIcon = foundTool?.icon
|
||||
triggerIcon = foundTrigger?.icon
|
||||
console.log('triggerIcon', triggerIcon)
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -73,7 +74,7 @@ const getTriggerIcon = (trigger: AppTrigger, triggerPlugins: any[]) => {
|
||||
<BlockIcon
|
||||
type={blockType}
|
||||
size="md"
|
||||
toolIcon={toolIcon}
|
||||
toolIcon={triggerIcon}
|
||||
/>
|
||||
{getStatusDot()}
|
||||
</div>
|
||||
|
||||
@@ -24,13 +24,13 @@ const TriggerPluginList = ({
|
||||
const triggerPlugins = useMemo(() => {
|
||||
// Follow exact same pattern as tools
|
||||
return (triggerPluginsData || []).filter((triggerWithProvider) => {
|
||||
if (triggerWithProvider.triggers.length === 0) return false
|
||||
if (triggerWithProvider.events.length === 0) return false
|
||||
|
||||
// Filter by search text
|
||||
if (searchText) {
|
||||
const matchesSearch = triggerWithProvider.name.toLowerCase().includes(searchText.toLowerCase())
|
||||
|| triggerWithProvider.triggers.some(tool =>
|
||||
tool.label[language].toLowerCase().includes(searchText.toLowerCase()),
|
||||
|| triggerWithProvider.events.some(event =>
|
||||
event.label[language].toLowerCase().includes(searchText.toLowerCase()),
|
||||
)
|
||||
if (!matchesSearch) return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user