From d5a17a27cd2403dc8c8c1a25faebca419b931d76 Mon Sep 17 00:00:00 2001 From: Carina Ursu Date: Thu, 16 Mar 2023 16:06:45 -0700 Subject: [PATCH] fix: backfill index on execution task logs (#725) * chore: backfill index on execution task logs Signed-off-by: Carina Ursu * chore: add comments Signed-off-by: Carina Ursu * chore: bump version Signed-off-by: Carina Ursu * chore: remove backfill Signed-off-by: Carina Ursu * chore: lint Signed-off-by: Carina Ursu --------- Signed-off-by: Carina Ursu Signed-off-by: 4nalog <4nalog@protonmail.com> --- packages/console/package.json | 2 +- .../src/components/Executions/TaskExecutionsList/utils.ts | 4 +++- .../common/MapTaskExecutionsList/TaskNameList.tsx | 8 ++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/console/package.json b/packages/console/package.json index f348cf25c..db5ad95bf 100644 --- a/packages/console/package.json +++ b/packages/console/package.json @@ -1,6 +1,6 @@ { "name": "@flyteorg/console", - "version": "0.0.13", + "version": "0.0.14", "description": "Flyteconsole main app module", "main": "./dist/index.js", "module": "./lib/index.js", diff --git a/packages/console/src/components/Executions/TaskExecutionsList/utils.ts b/packages/console/src/components/Executions/TaskExecutionsList/utils.ts index 0f06b11c3..f12397eed 100644 --- a/packages/console/src/components/Executions/TaskExecutionsList/utils.ts +++ b/packages/console/src/components/Executions/TaskExecutionsList/utils.ts @@ -65,7 +65,9 @@ export const getGroupedLogs = ( // if there is no log with active url, just create an item with externalId, // for user to understand which array items are in this state const newLogs = - item.logs.length > 0 ? item.logs : [{ name: item.externalId }]; + item.logs.length > 0 + ? item.logs.map(l => ({ ...l, index: item.index })) + : [{ name: item.externalId, index: item.index }]; logsByPhase.set( phase, currentValue ? [...currentValue, ...newLogs] : [...newLogs], diff --git a/packages/console/src/components/common/MapTaskExecutionsList/TaskNameList.tsx b/packages/console/src/components/common/MapTaskExecutionsList/TaskNameList.tsx index 4d2dd4984..fd7ce0461 100644 --- a/packages/console/src/components/common/MapTaskExecutionsList/TaskNameList.tsx +++ b/packages/console/src/components/common/MapTaskExecutionsList/TaskNameList.tsx @@ -43,7 +43,7 @@ export const TaskNameList = ({ return ( <> - {logs.map((log, taskIndex) => { + {logs.map((log, _taskIndex) => { const taskLogName = getTaskLogName( taskExecution.id.taskId.name, log.name ?? '', @@ -57,7 +57,11 @@ export const TaskNameList = ({ )?.cacheStatus; const handleClick = () => { - onTaskSelected({ ...taskExecution, taskIndex }); + // Use the resource's index instead of the log index + onTaskSelected({ + ...taskExecution, + taskIndex: (log as any).index || 0, + }); }; return (