diff --git a/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionDetailsPanelContent.tsx b/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionDetailsPanelContent.tsx index 6d042024f..179c7151b 100644 --- a/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionDetailsPanelContent.tsx +++ b/packages/console/src/components/Executions/ExecutionDetails/NodeExecutionDetailsPanelContent.tsx @@ -495,7 +495,7 @@ export const NodeExecutionDetailsPanelContent: React.FC< phase={taskPhase} taskTemplate={details?.taskTemplate} onTaskSelected={setSelectedTaskExecution} - taskIndex={selectedTaskExecution?.taskIndex || undefined} + taskIndex={selectedTaskExecution?.taskIndex!} /> ) : null; diff --git a/packages/console/src/components/Literals/LiteralMapViewer.tsx b/packages/console/src/components/Literals/LiteralMapViewer.tsx index 11e8b1782..a09fd9ae5 100644 --- a/packages/console/src/components/Literals/LiteralMapViewer.tsx +++ b/packages/console/src/components/Literals/LiteralMapViewer.tsx @@ -29,16 +29,7 @@ export const LiteralMapViewer: React.FC<{ return ; } - const transformedLiterals = transformLiterals(literals); + const transformedLiterals = transformLiterals(literals, mapTaskIndex); - 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 ; + return ; }; diff --git a/packages/console/src/components/Literals/helpers.ts b/packages/console/src/components/Literals/helpers.ts index 33e7f9931..53a8ccb5b 100644 --- a/packages/console/src/components/Literals/helpers.ts +++ b/packages/console/src/components/Literals/helpers.ts @@ -351,27 +351,37 @@ function processScalar( } } -function processCollection(collection?: Core.ILiteralCollection | null) { - const literals = collection?.literals; +function processCollection( + collection?: Core.ILiteralCollection | null, + mapTaskIndex?: number, +) { + let literals = collection?.literals; if (!literals) { return 'invalid collection'; } - return literals?.map(literal => processLiteral(literal)); + if (!isNaN(mapTaskIndex!)) { + literals = (literals || []).splice(mapTaskIndex!, 1); + } + + return literals?.map(literal => processLiteral(literal, mapTaskIndex)); } -function processMap(map?: Core.ILiteralMap | null) { +function processMap(map?: Core.ILiteralMap | null, mapTaskIndex?: number) { const literals = map?.literals; if (!literals) { return 'invalid map'; } - return transformLiterals(literals); + return transformLiterals(literals, mapTaskIndex); } -function processLiteral(literal?: Core.ILiteral & Pick) { +function processLiteral( + literal?: Core.ILiteral & Pick, + mapTaskIndex?: number, +) { const type = literal?.value; if (!literal) { @@ -382,18 +392,21 @@ function processLiteral(literal?: Core.ILiteral & Pick) { case 'scalar': return processScalar(literal.scalar); case 'collection': - return processCollection(literal.collection); + return processCollection(literal.collection, mapTaskIndex); case 'map': - return processMap(literal.map); + return processMap(literal.map, mapTaskIndex); default: return DEFAULT_UNSUPPORTED; } } -export function transformLiterals(json: { [k: string]: Core.ILiteral }) { +export function transformLiterals( + json: { [k: string]: Core.ILiteral }, + mapTaskIndex?: number, +) { const obj = Object.entries(json) .map(([key, literal]) => ({ - [key]: processLiteral(literal), + [key]: processLiteral(literal, mapTaskIndex), })) .reduce( (acc, cur) => ({ diff --git a/website/package.json b/website/package.json index f77846c17..ee73c71ff 100644 --- a/website/package.json +++ b/website/package.json @@ -37,7 +37,7 @@ }, "dependencies": { "@flyteorg/common": "^0.0.3", - "@flyteorg/console": "^0.0.14", + "@flyteorg/console": "^0.0.15", "long": "^4.0.0", "protobufjs": "~6.11.3", "react-ga4": "^1.4.1", diff --git a/yarn.lock b/yarn.lock index 9e9a32076..f6f3db62c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1995,7 +1995,7 @@ __metadata: resolution: "@flyteconsole/client-app@workspace:website" dependencies: "@flyteorg/common": ^0.0.3 - "@flyteorg/console": ^0.0.14 + "@flyteorg/console": ^0.0.15 "@types/long": ^3.0.32 long: ^4.0.0 protobufjs: ~6.11.3 @@ -2034,7 +2034,7 @@ __metadata: languageName: unknown linkType: soft -"@flyteorg/console@^0.0.14, @flyteorg/console@workspace:packages/console": +"@flyteorg/console@^0.0.15, @flyteorg/console@workspace:packages/console": version: 0.0.0-use.local resolution: "@flyteorg/console@workspace:packages/console" dependencies: