feat(trigger): add API endpoint to retrieve trigger plugin icons and enhance workflow response handling

- Introduced `TriggerProviderIconApi` to fetch icons for trigger plugins based on tenant and provider ID.
- Updated `WorkflowResponseConverter` to include trigger plugin icons in the response.
- Implemented `get_trigger_plugin_icon` method in `TriggerManager` for icon retrieval logic.
- Adjusted `Node` class to correctly set provider information for trigger plugins.
- Modified TypeScript types to accommodate new provider ID field in workflow nodes.
This commit is contained in:
Harry
2025-10-13 16:50:12 +08:00
parent cce729916a
commit b283a2b3d9
7 changed files with 55 additions and 7 deletions

View File

@ -7,7 +7,6 @@ import type { TestRunOptions, TriggerOption } from '../header/test-run-menu'
import { TriggerAll } from '@/app/components/base/icons/src/vender/workflow'
import BlockIcon from '../block-icon'
import { useStore } from '../store'
import { canFindTool } from '@/utils'
import { useAllTriggerPlugins } from '@/service/use-triggers'
export const useDynamicTestRunOptions = (): TestRunOptions => {
@ -74,18 +73,18 @@ export const useDynamicTestRunOptions = (): TestRunOptions => {
})
}
else if (nodeData.type === BlockEnum.TriggerPlugin) {
let toolIcon: string | any
let triggerIcon: string | any
if (nodeData.provider_id) {
const targetTools = triggerPlugins || []
toolIcon = targetTools.find(toolWithProvider => canFindTool(toolWithProvider.id, nodeData.provider_id!))?.icon
const targetTriggers = triggerPlugins || []
triggerIcon = targetTriggers.find(toolWithProvider => toolWithProvider.name === nodeData.provider_id)?.icon
}
const icon = (
<BlockIcon
type={BlockEnum.TriggerPlugin}
size='md'
toolIcon={toolIcon}
toolIcon={triggerIcon}
/>
)

View File

@ -104,6 +104,7 @@ export type CommonNodeType<T = {}> = {
default_value?: DefaultValueForm[]
credential_id?: string
subscription_id?: string
provider_id?: string
_dimmed?: boolean
} & T & Partial<PluginDefaultValue>