Skip to content

Commit

Permalink
Don't display a table in the popover if no tasks exist
Browse files Browse the repository at this point in the history
Signed-off-by: Scott J Dickerson <[email protected]>
  • Loading branch information
sjd78 committed Jul 1, 2024
1 parent 9de8187 commit 8cf2f5e
Showing 1 changed file with 37 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,40 +98,43 @@ export const ColumnApplicationName: React.FC<{
const status = statusMap[application.tasksStatus];
const StatusIcon = status.icon;

const bodyContent = (
<Table variant="compact" borders={false}>
<Thead>
<Tr>
<Td>Id</Td>
<Td>Kind</Td>
<Td>Started</Td>
</Tr>
</Thead>
<Tbody>
{Object.entries(application.tasksByKind)
.sort((a, b) => universalComparator(a[0], b[0]))
.map(([kind, [task]]) => {
const startTime = dayjs(task.started ?? task.createTime);
return (
<Tr key={`popover-a${application.id}-k${kind}`}>
<Td>{task.id}</Td>
<Td>
<IconWithLabel
icon={<TaskStateIcon state={task.state} />}
label={<Link to={linkToDetails(task)}>{kind}</Link>}
/>
</Td>
<Td>
<Tooltip content={startTime.format("ll, LTS")}>
<span>{startTime.fromNow()}</span>
</Tooltip>
</Td>
</Tr>
);
})}
</Tbody>
</Table>
);
const bodyContent =
application.tasksStatus === "None" ? (
<></>
) : (
<Table variant="compact" borders={false}>
<Thead>
<Tr>
<Td>Id</Td>
<Td>Kind</Td>
<Td>Started</Td>
</Tr>
</Thead>
<Tbody>
{Object.entries(application.tasksByKind)
.sort((a, b) => universalComparator(a[0], b[0]))
.map(([kind, [task]]) => {
const startTime = dayjs(task.started ?? task.createTime);
return (
<Tr key={`popover-a${application.id}-k${kind}`}>
<Td>{task.id}</Td>
<Td>
<IconWithLabel
icon={<TaskStateIcon state={task.state} />}
label={<Link to={linkToDetails(task)}>{kind}</Link>}
/>
</Td>
<Td>
<Tooltip content={startTime.format("ll, LTS")}>
<span>{startTime.fromNow()}</span>
</Tooltip>
</Td>
</Tr>
);
})}
</Tbody>
</Table>
);

return (
<Popover
Expand Down

0 comments on commit 8cf2f5e

Please sign in to comment.