Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mapped Tasks not showing cache status correctly. #712

Merged
merged 3 commits into from
Mar 7, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,19 @@ import { noLogsFoundString } from 'components/Executions/constants';
import { CacheStatus } from 'components/Executions/CacheStatus';
import { useCommonStyles } from '../styles';

interface StyleProps {
isLink: boolean;
}

const useStyles = makeStyles((_theme: Theme) => ({
taskTitle: ({ isLink }: StyleProps) => ({
cursor: isLink ? 'pointer' : 'default',
taskTitle: {
cursor: 'default',
'&:hover': {
textDecoration: isLink ? 'underline' : 'none',
textDecoration: 'none',
},
}),
},
taskTitleLink: {
cursor: 'pointer',
'&:hover': {
textDecoration: 'underline',
},
},
}));

interface TaskNameListProps {
Expand All @@ -33,6 +35,7 @@ export const TaskNameList = ({
onTaskSelected,
}: TaskNameListProps) => {
const commonStyles = useCommonStyles();
const styles = useStyles();

if (logs.length === 0) {
return <span className={commonStyles.hintText}>{noLogsFoundString}</span>;
Expand All @@ -41,16 +44,17 @@ export const TaskNameList = ({
return (
<>
{logs.map((log, taskIndex) => {
const styles = useStyles({ isLink: !!log.uri });
const taskLogName = getTaskLogName(
taskExecution.id.taskId.name,
log.name ?? '',
);

const cacheStatus =
taskIndex != null
? taskExecution.closure?.metadata?.externalResources?.[taskIndex]
?.cacheStatus
: null;
taskExecution.closure?.metadata?.externalResources?.find(
item =>
item.externalId === log.name ||
!!item.logs?.find(l => l.name === log.name),
)?.cacheStatus;

const handleClick = () => {
onTaskSelected({ ...taskExecution, taskIndex });
Expand All @@ -62,13 +66,13 @@ export const TaskNameList = ({
display: 'flex',
alignItems: 'center',
}}
key={taskLogName}
>
<Typography
variant="body1"
color={log.uri ? 'primary' : 'textPrimary'}
onClick={log.uri ? handleClick : undefined}
key={taskLogName}
className={styles.taskTitle}
className={log.uri ? styles.taskTitleLink : styles.taskTitle}
data-testid="map-task-log"
>
{taskLogName}
Expand Down