From e97fc54deb8760ad4d6fffe211db89a29a15e786 Mon Sep 17 00:00:00 2001 From: Marliana Lara Date: Thu, 26 Sep 2019 09:20:33 -0400 Subject: [PATCH] Add class to StatusIcon wrapper and fix merge conflicts --- .../src/components/Sparkline/StatusIcon.jsx | 9 +++--- .../src/screens/Job/JobDetail/JobDetail.jsx | 14 ++++---- .../screens/Job/JobDetail/JobDetail.test.jsx | 32 +++++-------------- .../screens/Job/JobOutput/HostEventModal.jsx | 2 +- 4 files changed, 20 insertions(+), 37 deletions(-) diff --git a/awx/ui_next/src/components/Sparkline/StatusIcon.jsx b/awx/ui_next/src/components/Sparkline/StatusIcon.jsx index 5f048f5cb5..2c9b7ae16b 100644 --- a/awx/ui_next/src/components/Sparkline/StatusIcon.jsx +++ b/awx/ui_next/src/components/Sparkline/StatusIcon.jsx @@ -75,11 +75,12 @@ const SkippedBottom = styled.div` const StatusIcon = ({ status, ...props }) => { return ( -
+
{status === 'running' && } - {(status === 'new' || status === 'pending' || status === 'waiting') && ( - - )} + {(status === 'new' || + status === 'pending' || + status === 'waiting' || + status === 'never updated') && } {(status === 'failed' || status === 'error' || status === 'canceled') && ( diff --git a/awx/ui_next/src/screens/Job/JobDetail/JobDetail.jsx b/awx/ui_next/src/screens/Job/JobDetail/JobDetail.jsx index 5c217b8bc8..2fe5fdb50a 100644 --- a/awx/ui_next/src/screens/Job/JobDetail/JobDetail.jsx +++ b/awx/ui_next/src/screens/Job/JobDetail/JobDetail.jsx @@ -41,7 +41,7 @@ const VariablesInput = styled(_VariablesInput)` const StatusDetailValue = styled.div` align-items: center; display: inline-flex; - > div { + .at-c-statusIcon { margin-right: 10px; } `; @@ -155,13 +155,11 @@ function JobDetail({ job, i18n, history }) { - {launchedByLink ? ( - {launchedByValue} - ) : ( - launchedByValue - )} - + launchedByLink ? ( + {launchedByValue} + ) : ( + launchedByValue + ) } /> {inventory && ( diff --git a/awx/ui_next/src/screens/Job/JobDetail/JobDetail.test.jsx b/awx/ui_next/src/screens/Job/JobDetail/JobDetail.test.jsx index 879722bde9..0c592cc90f 100644 --- a/awx/ui_next/src/screens/Job/JobDetail/JobDetail.test.jsx +++ b/awx/ui_next/src/screens/Job/JobDetail/JobDetail.test.jsx @@ -73,19 +73,8 @@ describe('', () => { }); test('should properly delete job', async () => { - job = { - name: 'Rage', - id: 1, - type: 'job', - summary_fields: { - job_template: { name: 'Spud' }, - }, - }; - const wrapper = mountWithContexts(); - wrapper - .find('button') - .at(0) - .simulate('click'); + const wrapper = mountWithContexts(); + wrapper.find('button[aria-label="Delete"]').simulate('click'); await sleep(1); wrapper.update(); const modal = wrapper.find('Modal'); @@ -93,17 +82,12 @@ describe('', () => { modal.find('button[aria-label="Delete"]').simulate('click'); expect(JobsAPI.destroy).toHaveBeenCalledTimes(1); }); - // The test below is skipped until react can be upgraded to at least 16.9.0. An upgrade to - // react - router will likely be necessary also. + /* + The test below is skipped until react can be upgraded to at least 16.9.0. An upgrade to + react - router will likely be necessary also. + See: https://github.com/ansible/awx/issues/4817 + */ test.skip('should display error modal when a job does not delete properly', async () => { - job = { - name: 'Angry', - id: 'a', - type: 'project_update', - summary_fields: { - job_template: { name: 'Peanut' }, - }, - }; ProjectUpdatesAPI.destroy.mockRejectedValue( new Error({ response: { @@ -116,7 +100,7 @@ describe('', () => { }, }) ); - const wrapper = mountWithContexts(); + const wrapper = mountWithContexts(); wrapper .find('button') diff --git a/awx/ui_next/src/screens/Job/JobOutput/HostEventModal.jsx b/awx/ui_next/src/screens/Job/JobOutput/HostEventModal.jsx index 08e3866983..45f6074d7d 100644 --- a/awx/ui_next/src/screens/Job/JobOutput/HostEventModal.jsx +++ b/awx/ui_next/src/screens/Job/JobOutput/HostEventModal.jsx @@ -32,7 +32,7 @@ const Modal = styled(PFModal)` const HostNameDetailValue = styled.div` align-items: center; display: inline-flex; - > div { + .at-c-statusIcon { margin-right: 10px; } `;