Merge pull request #11134 from nixocio/ui_issue_11127

Do not display EE if a job was canceled
This commit is contained in:
Sarah Akus 2021-09-27 11:10:36 -04:00 committed by GitHub
commit 7b6befa3d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 8 deletions

View File

@ -222,13 +222,15 @@ function JobListItem({
dataCy={`job-${job.id}-project`}
/>
)}
{job.type !== 'workflow_job' && !isJobRunning(job.status) && (
<ExecutionEnvironmentDetail
executionEnvironment={execution_environment}
verifyMissingVirtualEnv={false}
dataCy={`execution-environment-detail-${job.id}`}
/>
)}
{job.type !== 'workflow_job' &&
!isJobRunning(job.status) &&
job.status !== 'canceled' && (
<ExecutionEnvironmentDetail
executionEnvironment={execution_environment}
verifyMissingVirtualEnv={false}
dataCy={`execution-environment-detail-${job.id}`}
/>
)}
{credentials && credentials.length > 0 && (
<Detail
fullWidth

View File

@ -24,6 +24,7 @@ const mockJob = {
status: 'successful',
job_slice_number: 1,
job_slice_count: 3,
execution_environment: 1,
};
describe('<JobListItem />', () => {
@ -61,7 +62,7 @@ describe('<JobListItem />', () => {
expect(wrapper.find('LaunchButton').length).toBe(1);
});
test('should render souce data in expanded view', () => {
test('should render source data in expanded view', () => {
wrapper = mountWithContexts(
<table>
<tbody>
@ -127,6 +128,49 @@ describe('<JobListItem />', () => {
);
expect(wrapper.find('Td[dataLabel="Type"]').length).toBe(1);
});
test('should not display EE for canceled jobs', () => {
wrapper = mountWithContexts(
<table>
<tbody>
<JobListItem
job={{
...mockJob,
status: 'canceled',
execution_environment: null,
}}
showTypeColumn
isSelected
onSelect={() => {}}
/>
</tbody>
</table>
);
expect(wrapper.find('Detail[label="Execution Environment"]').length).toBe(
0
);
});
test('should display missing resource for completed jobs and missing EE', () => {
wrapper = mountWithContexts(
<table>
<tbody>
<JobListItem
job={mockJob}
showTypeColumn
isSelected
onSelect={() => {}}
/>
</tbody>
</table>
);
expect(wrapper.find('Detail[label="Execution Environment"]').length).toBe(
1
);
expect(
wrapper.find('Detail[label="Execution Environment"] dd').text()
).toBe('Missing resource');
});
});
describe('<JobListItem with failed job />', () => {