Skip to content

Commit b16ad37

Browse files
committed
feat: adding support for function within execution result
1 parent e76f676 commit b16ad37

2 files changed

Lines changed: 26 additions & 3 deletions

File tree

src/packages/ce/src/flow/services/fragments/Flow.fragment.graphql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ fragment Flow on Flow {
150150
value
151151
position
152152
}
153+
functionDefinition {
154+
__typename
155+
id
156+
}
153157
nodeFunction {
154158
__typename
155159
id

src/packages/ce/src/flow/views/FlowExecutionResultView.tsx

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
ExecutionError,
55
ExecutionParameterResult,
66
ExecutionResult,
7-
Flow,
7+
Flow, FunctionDefinition,
88
Maybe,
99
Namespace,
1010
NamespaceProject,
@@ -57,7 +57,7 @@ export interface NodeGanttItem extends GanttItem {
5757
data?: {
5858
displayMessage: string
5959
color: string
60-
payload?: Maybe<NodeFunction> | Maybe<Flow>
60+
payload?: Maybe<NodeFunction> | Maybe<FunctionDefinition> | Maybe<Flow>
6161
input?: ExecutionParameterResult[] | object
6262
success?: object
6363
error?: Maybe<ExecutionError>
@@ -142,6 +142,25 @@ export const FlowExecutionResultView: React.FC = () => {
142142
},
143143
...(result?.nodeResults?.nodes?.map?.(nodeResult => {
144144

145+
if (nodeResult?.functionDefinition) {
146+
const funktion = functions.find(f => f.id === nodeResult?.functionDefinition?.id)
147+
148+
return {
149+
id: nodeResult?.id as string,
150+
type: "function",
151+
start: (nodeResult?.startedAt ?? 0) - (result?.startedAt ?? 0),
152+
end: (nodeResult?.finishedAt ?? 0) - (result?.startedAt ?? 0),
153+
data: {
154+
displayMessage: funktion?.names?.[0].content ?? FALLBACK_FUNCTION_NAME,
155+
color: hashToColor(funktion?.identifier ?? ""),
156+
payload: funktion,
157+
success: nodeResult?.success,
158+
input: nodeResult?.parameterResults ?? [],
159+
error: nodeResult?.error,
160+
}
161+
}
162+
}
163+
145164
const node = flow?.nodes?.nodes?.find(n => n?.id === nodeResult?.nodeFunction?.id)
146165
const funktion = functions.find(f => f.id === nodeResult?.nodeFunction?.functionDefinition?.id)
147166

@@ -252,7 +271,7 @@ export const FlowExecutionResultView: React.FC = () => {
252271
} else {
253272

254273
const DisplayIcon = icon(
255-
item.type === "node" ? item?.data?.payload?.functionDefinition?.displayIcon : item?.data?.payload?.type?.displayIcon,
274+
item.type === "node" ? item?.data?.payload?.functionDefinition?.displayIcon : item.type === "function" ? item?.data?.payload?.displayIcon : item?.data?.payload?.type?.displayIcon,
256275
)
257276

258277
return <Tooltip key={item.id}>

0 commit comments

Comments
 (0)