Show deleted detail for deleted schedules

This commit is contained in:
Marliana Lara 2022-02-28 15:51:36 -05:00
parent 8c21a2aa9e
commit 1aefd39782
No known key found for this signature in database
GPG Key ID: 38C73B40DFA809EE
2 changed files with 38 additions and 12 deletions

View File

@ -12,7 +12,12 @@ import getScheduleUrl from 'util/getScheduleUrl';
import { ActionsTd, ActionItem, TdBreakWord } from '../PaginatedTable';
import { LaunchButton, ReLaunchDropDown } from '../LaunchButton';
import StatusLabel from '../StatusLabel';
import { DetailList, Detail, LaunchedByDetail } from '../DetailList';
import {
DetailList,
Detail,
DeletedDetail,
LaunchedByDetail,
} from '../DetailList';
import ChipGroup from '../ChipGroup';
import CredentialChip from '../CredentialChip';
import ExecutionEnvironmentDetail from '../ExecutionEnvironmentDetail';
@ -49,6 +54,7 @@ function JobListItem({
job_template,
labels,
project,
schedule,
source_workflow_job,
workflow_job_template,
} = job.summary_fields;
@ -168,17 +174,18 @@ function JobListItem({
/>
)}
<LaunchedByDetail job={job} />
{job.launch_type === 'scheduled' && (
<Detail
dataCy="job-schedule"
label={t`Schedule`}
value={
<Link to={getScheduleUrl(job)}>
{job.summary_fields.schedule.name}
</Link>
}
/>
)}
{job.launch_type === 'scheduled' &&
(schedule ? (
<Detail
dataCy="job-schedule"
label={t`Schedule`}
value={
<Link to={getScheduleUrl(job)}>{schedule.name}</Link>
}
/>
) : (
<DeletedDetail label={t`Schedule`} />
))}
{job_template && (
<Detail
label={t`Job Template`}

View File

@ -142,6 +142,25 @@ describe('<JobListItem />', () => {
expect(wrapper.find('Td[dataLabel="Type"]').length).toBe(1);
});
test('should not show schedule detail in expanded view', () => {
wrapper = mountWithContexts(
<table>
<tbody>
<JobListItem
job={{
...mockJob,
summary_fields: {},
}}
showTypeColumn
isSelected
onSelect={() => {}}
/>
</tbody>
</table>
);
expect(wrapper.find('Detail[label="Schedule"] dt').length).toBe(1);
});
test('should not display EE for canceled jobs', () => {
wrapper = mountWithContexts(
<table>