1- import React , { memo } from "react" ;
1+ import React , { CSSProperties , memo } from "react" ;
22import { Handle , Node , NodeProps , Position } from "@xyflow/react" ;
33import { Badge , Card , Flex , Text , useService , useStore as usePictorStore } from "@code0-tech/pictor" ;
44import { FunctionNodeComponentProps } from "@edition/function/components/nodes/FunctionNodeComponent" ;
@@ -10,6 +10,8 @@ import {FunctionFileTriggerComponent} from "@edition/function/components/files/F
1010import { NodeFunction } from "@code0-tech/sagittarius-graphql-types" ;
1111import { icon , IconString } from "@core/util/icons" ;
1212import { FALLBACK_FLOW_TYPE_DISPLAY_MESSAGE , FALLBACK_FLOW_TYPE_NAME } from "@core/util/fallback-translations" ;
13+ import { useFlowValidation } from "@edition/flow/hooks/Flow.validation.hook" ;
14+ import { underlineBySeverity } from "@core/util/inspection" ;
1315
1416
1517export type FunctionNodeTriggerComponentProps = NodeProps < Node < FunctionNodeComponentProps > >
@@ -27,6 +29,17 @@ export const FunctionNodeTriggerComponent: React.FC<FunctionNodeTriggerComponent
2729 const flow = React . useMemo ( ( ) => flowService . getById ( data . flowId ) , [ flowStore , data ] )
2830 const definition = React . useMemo ( ( ) => flow ? flowTypeService . getById ( flow . type ?. id ) : undefined , [ flowTypeStore , flow ] )
2931 const DisplayIcon = icon ( definition ?. displayIcon as IconString )
32+ const validation = useFlowValidation ( data . flowId )
33+
34+ const triggerValidations = React . useMemo (
35+ ( ) => validation ?. filter ( v => v . nodeId === null && v . parameterIndex === null ) ,
36+ [ validation ]
37+ )
38+
39+ const triggerValidationStyle : CSSProperties =
40+ triggerValidations ?. length
41+ ? underlineBySeverity [ triggerValidations [ 0 ] . type ]
42+ : { } ;
3043
3144 React . useEffect ( ( ) => {
3245 if ( ! id || ! flow ) return
@@ -80,7 +93,7 @@ export const FunctionNodeTriggerComponent: React.FC<FunctionNodeTriggerComponent
8093 Starting node
8194 </ Badge >
8295
83- < Flex style = { { gap : "0.7rem" } } align = { "center" } >
96+ < Flex style = { { gap : "0.7rem" , ... triggerValidationStyle } } align = { "center" } >
8497 < DisplayIcon color = { data . color } size = { 16 } />
8598 < Text display = { "block" } >
8699 { definition ?. displayMessages ?. [ 0 ] ?. content ?? FALLBACK_FLOW_TYPE_DISPLAY_MESSAGE }
0 commit comments