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
2 changed files with 54 additions and 8 deletions

View File

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

View File

@@ -24,6 +24,7 @@ const mockJob = {
status: 'successful', status: 'successful',
job_slice_number: 1, job_slice_number: 1,
job_slice_count: 3, job_slice_count: 3,
execution_environment: 1,
}; };
describe('<JobListItem />', () => { describe('<JobListItem />', () => {
@@ -61,7 +62,7 @@ describe('<JobListItem />', () => {
expect(wrapper.find('LaunchButton').length).toBe(1); 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( wrapper = mountWithContexts(
<table> <table>
<tbody> <tbody>
@@ -127,6 +128,49 @@ describe('<JobListItem />', () => {
); );
expect(wrapper.find('Td[dataLabel="Type"]').length).toBe(1); 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 />', () => { describe('<JobListItem with failed job />', () => {