Skip to content

Commit

Permalink
chore: backfill index on execution task logs
Browse files Browse the repository at this point in the history
Signed-off-by: Carina Ursu <[email protected]>
  • Loading branch information
ursucarina committed Mar 16, 2023
1 parent 80edd63 commit 02f310b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ export const getGroupedLogs = (
): LogsByPhase => {
const logsByPhase: LogsByPhase = new Map();

resources = resources.map((r, i) => ({
index: i,
...r,
}));

// sort output sample [0-2, 0-1, 0, 1, 2], where 0-1 means index = 0 retry = 1
resources.sort((a, b) => {
const aIndex = a.index ?? 0;
Expand Down Expand Up @@ -65,7 +70,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 : [{ 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],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const TaskNameList = ({
)?.cacheStatus;

const handleClick = () => {
onTaskSelected({ ...taskExecution, taskIndex });
onTaskSelected({ ...taskExecution, taskIndex: (log as any).index });
};

return (
Expand Down

0 comments on commit 02f310b

Please sign in to comment.