From c135e248a93ea61626b49ffdcb9983064509dba2 Mon Sep 17 00:00:00 2001 From: Carina Ursu Date: Mon, 20 Mar 2023 10:51:36 -0700 Subject: [PATCH] chore: show correct i/o in details panel Signed-off-by: Carina Ursu --- .../NodeExecutionDetailsPanelContent.tsx | 1 + .../NodeExecutionTabs/NodeExecutionInputs.tsx | 12 ++++++++---- .../NodeExecutionTabs/NodeExecutionOutputs.tsx | 12 ++++++++---- .../ExecutionDetails/NodeExecutionTabs/index.tsx | 10 ++++++++-- .../Executions/TaskExecutionsList/utils.ts | 4 ++-- .../src/components/Literals/LiteralMapViewer.tsx | 14 ++++++++++++-- .../console/src/components/Literals/helpers.ts | 2 +- .../common/MapTaskExecutionsList/TaskNameList.tsx | 2 +- 8 files changed, 41 insertions(+), 16 deletions(-) diff --git a/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionDetailsPanelContent.tsx b/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionDetailsPanelContent.tsx index 40cb0a87b..6d042024f 100644 --- a/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionDetailsPanelContent.tsx +++ b/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionDetailsPanelContent.tsx @@ -495,6 +495,7 @@ export const NodeExecutionDetailsPanelContent: React.FC< phase={taskPhase} taskTemplate={details?.taskTemplate} onTaskSelected={setSelectedTaskExecution} + taskIndex={selectedTaskExecution?.taskIndex || undefined} /> ) : null; diff --git a/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/NodeExecutionInputs.tsx b/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/NodeExecutionInputs.tsx index e4059f153..02c92329f 100644 --- a/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/NodeExecutionInputs.tsx +++ b/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/NodeExecutionInputs.tsx @@ -6,14 +6,18 @@ import { NodeExecution } from 'models/Execution/types'; import * as React from 'react'; /** Fetches and renders the input data for a given `NodeExecution` */ -export const NodeExecutionInputs: React.FC<{ execution: NodeExecution }> = ({ - execution, -}) => { +export const NodeExecutionInputs: React.FC<{ + execution: NodeExecution; + taskIndex?: number; +}> = ({ execution, taskIndex }) => { const executionData = useNodeExecutionData(execution.id); return ( - + ); diff --git a/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/NodeExecutionOutputs.tsx b/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/NodeExecutionOutputs.tsx index 42f7429a1..0aa836661 100644 --- a/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/NodeExecutionOutputs.tsx +++ b/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/NodeExecutionOutputs.tsx @@ -6,14 +6,18 @@ import { NodeExecution } from 'models/Execution/types'; import * as React from 'react'; /** Fetches and renders the output data for a given `NodeExecution` */ -export const NodeExecutionOutputs: React.FC<{ execution: NodeExecution }> = ({ - execution, -}) => { +export const NodeExecutionOutputs: React.FC<{ + execution: NodeExecution; + taskIndex?: number; +}> = ({ execution, taskIndex }) => { const executionData = useNodeExecutionData(execution.id); return ( - + ); diff --git a/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/index.tsx b/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/index.tsx index 3a289b0c0..100d6cd58 100644 --- a/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/index.tsx +++ b/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionTabs/index.tsx @@ -47,12 +47,14 @@ export const NodeExecutionTabs: React.FC<{ onTaskSelected: (val: MapTaskExecution) => void; phase?: TaskExecutionPhase; taskTemplate?: TaskTemplate | null; + taskIndex?: number; }> = ({ nodeExecution, selectedTaskExecution, onTaskSelected, taskTemplate, phase, + taskIndex, }) => { const styles = useStyles(); const tabState = useTabState(tabIds, defaultTab); @@ -80,11 +82,15 @@ export const NodeExecutionTabs: React.FC<{ break; } case tabIds.inputs: { - tabContent = ; + tabContent = ( + + ); break; } case tabIds.outputs: { - tabContent = ; + tabContent = ( + + ); break; } case tabIds.task: { diff --git a/packages/console/src/components/Executions/TaskExecutionsList/utils.ts b/packages/console/src/components/Executions/TaskExecutionsList/utils.ts index f12397eed..e56951146 100644 --- a/packages/console/src/components/Executions/TaskExecutionsList/utils.ts +++ b/packages/console/src/components/Executions/TaskExecutionsList/utils.ts @@ -66,8 +66,8 @@ export const getGroupedLogs = ( // for user to understand which array items are in this state const newLogs = item.logs.length > 0 - ? item.logs.map(l => ({ ...l, index: item.index })) - : [{ name: item.externalId, index: item.index }]; + ? item.logs.map(l => ({ ...l, index: item.index || 0 })) + : [{ name: item.externalId }]; logsByPhase.set( phase, currentValue ? [...currentValue, ...newLogs] : [...newLogs], diff --git a/packages/console/src/components/Literals/LiteralMapViewer.tsx b/packages/console/src/components/Literals/LiteralMapViewer.tsx index 77be18da2..11e8b1782 100644 --- a/packages/console/src/components/Literals/LiteralMapViewer.tsx +++ b/packages/console/src/components/Literals/LiteralMapViewer.tsx @@ -17,7 +17,8 @@ export const LiteralMapViewer: React.FC<{ className?: string; map: LiteralMap | null; showBrackets?: boolean; -}> = ({ map }) => { + mapTaskIndex?: number; +}> = ({ map, mapTaskIndex }) => { if (!map) { return ; } @@ -30,5 +31,14 @@ export const LiteralMapViewer: React.FC<{ const transformedLiterals = transformLiterals(literals); - return ; + let transformedLiteralsFinal = {}; + if (!isNaN(mapTaskIndex as number)) { + const keys = Object.keys(transformedLiterals); + transformedLiteralsFinal[keys?.[0]] = + transformedLiterals?.[keys?.[0]]?.[mapTaskIndex as number]; + } else { + transformedLiteralsFinal = transformedLiterals; + } + + return ; }; diff --git a/packages/console/src/components/Literals/helpers.ts b/packages/console/src/components/Literals/helpers.ts index 22e9c844a..8590d55b2 100644 --- a/packages/console/src/components/Literals/helpers.ts +++ b/packages/console/src/components/Literals/helpers.ts @@ -146,7 +146,7 @@ function processUnionType(union?: Core.IUnionType | null, shortString = false) { } function processUnion(union: Core.IUnion) { - return DEFAULT_UNSUPPORTED; + return processLiteral(union.value!); } /* eslint-enable @typescript-eslint/no-unused-vars */ diff --git a/packages/console/src/components/common/MapTaskExecutionsList/TaskNameList.tsx b/packages/console/src/components/common/MapTaskExecutionsList/TaskNameList.tsx index fd7ce0461..c68acee91 100644 --- a/packages/console/src/components/common/MapTaskExecutionsList/TaskNameList.tsx +++ b/packages/console/src/components/common/MapTaskExecutionsList/TaskNameList.tsx @@ -60,7 +60,7 @@ export const TaskNameList = ({ // Use the resource's index instead of the log index onTaskSelected({ ...taskExecution, - taskIndex: (log as any).index || 0, + taskIndex: (log as any).index, }); };