From 2dca92c7881839811876b82d5aeaf1cbd886f6b7 Mon Sep 17 00:00:00 2001 From: nixocio Date: Fri, 24 Sep 2021 17:31:30 -0400 Subject: [PATCH] Do not display EE if a job was canceled Do not display EE if a job was canceled. Since the API is returning null for the value of the EE for this particular scenario. See: https://github.com/ansible/awx/issues/11127 --- awx/ui/src/components/JobList/JobListItem.js | 16 ++++--- .../components/JobList/JobListItem.test.js | 46 ++++++++++++++++++- 2 files changed, 54 insertions(+), 8 deletions(-) diff --git a/awx/ui/src/components/JobList/JobListItem.js b/awx/ui/src/components/JobList/JobListItem.js index 10a9f2d5e2..9a804c12bd 100644 --- a/awx/ui/src/components/JobList/JobListItem.js +++ b/awx/ui/src/components/JobList/JobListItem.js @@ -222,13 +222,15 @@ function JobListItem({ dataCy={`job-${job.id}-project`} /> )} - {job.type !== 'workflow_job' && !isJobRunning(job.status) && ( - - )} + {job.type !== 'workflow_job' && + !isJobRunning(job.status) && + job.status !== 'canceled' && ( + + )} {credentials && credentials.length > 0 && ( ', () => { @@ -61,7 +62,7 @@ describe('', () => { 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( @@ -127,6 +128,49 @@ describe('', () => { ); expect(wrapper.find('Td[dataLabel="Type"]').length).toBe(1); }); + + test('should not display EE for canceled jobs', () => { + wrapper = mountWithContexts( +
+ + {}} + /> + +
+ ); + expect(wrapper.find('Detail[label="Execution Environment"]').length).toBe( + 0 + ); + }); + + test('should display missing resource for completed jobs and missing EE', () => { + wrapper = mountWithContexts( + + + {}} + /> + +
+ ); + expect(wrapper.find('Detail[label="Execution Environment"]').length).toBe( + 1 + ); + expect( + wrapper.find('Detail[label="Execution Environment"] dd').text() + ).toBe('Missing resource'); + }); }); describe('', () => {