From c87c42fee1db533dfaaf530f21cc050104a3e935 Mon Sep 17 00:00:00 2001 From: Carina Ursu Date: Thu, 16 Mar 2023 15:13:02 -0700 Subject: [PATCH] chore: add comments Signed-off-by: Carina Ursu --- .../src/components/Executions/TaskExecutionsList/utils.ts | 3 ++- .../components/common/MapTaskExecutionsList/TaskNameList.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/console/src/components/Executions/TaskExecutionsList/utils.ts b/packages/console/src/components/Executions/TaskExecutionsList/utils.ts index 4fdb94ffc..d2809ac6f 100644 --- a/packages/console/src/components/Executions/TaskExecutionsList/utils.ts +++ b/packages/console/src/components/Executions/TaskExecutionsList/utils.ts @@ -38,6 +38,7 @@ export const getGroupedLogs = ( ): LogsByPhase => { const logsByPhase: LogsByPhase = new Map(); + // backfill the index as some resources come back without an index. resources = resources.map((r, i) => ({ index: i, ...r, @@ -70,7 +71,7 @@ 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.map(l => ({...l, index:item.index})) : [{ name: item.externalId, index:item.index }]; + 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 9a20aa2da..107b9121f 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,6 +57,7 @@ export const TaskNameList = ({ )?.cacheStatus; const handleClick = () => { + // Use the resource's index instead of the log index onTaskSelected({ ...taskExecution, taskIndex: (log as any).index }); };