Skip to content

Commit

Permalink
fix: duration is not always calculated for task executions (#185)
Browse files Browse the repository at this point in the history
Signed-off-by: csirius <[email protected]>
  • Loading branch information
govalt authored Aug 19, 2021
1 parent 950950d commit 2e12418
Showing 1 changed file with 33 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,42 @@ import * as React from 'react';
export const TaskExecutionDetails: React.FC<{
taskExecution: TaskExecution;
}> = ({ taskExecution }) => {
const labelWidthGridUnits = taskExecution.closure.startedAt ? 7 : 10;
const detailItems = React.useMemo(() => {
if (taskExecution.closure.startedAt) {
return [
{
name: 'started',
content: dateWithFromNow(
timestampToDate(taskExecution.closure.startedAt)
)
},
{
name: 'run time',
content: taskExecution.closure.duration
? protobufDurationToHMS(taskExecution.closure.duration)
: unknownValueString
}
];
} else {
return [
{
name: 'last updated',
content: taskExecution.closure.updatedAt
? dateWithFromNow(
timestampToDate(taskExecution.closure.updatedAt)
)
: unknownValueString
}
];
}
}, [taskExecution]);

return (
<section>
<DetailsGroup
labelWidthGridUnits={7}
items={[
{
name: 'started',
content: taskExecution.closure.startedAt
? dateWithFromNow(
timestampToDate(
taskExecution.closure.startedAt
)
)
: unknownValueString
},
{
name: 'run time',
content: taskExecution.closure.duration
? protobufDurationToHMS(
taskExecution.closure.duration
)
: unknownValueString
}
]}
labelWidthGridUnits={labelWidthGridUnits}
items={detailItems}
/>
</section>
);
Expand Down

0 comments on commit 2e12418

Please sign in to comment.