diff --git a/awx/ui/src/screens/Job/JobOutput/HostEventModal.js b/awx/ui/src/screens/Job/JobOutput/HostEventModal.js index 57fe7ce05f..a7295c1692 100644 --- a/awx/ui/src/screens/Job/JobOutput/HostEventModal.js +++ b/awx/ui/src/screens/Job/JobOutput/HostEventModal.js @@ -70,7 +70,6 @@ const getStdOutValue = (hostEvent) => { function HostEventModal({ onClose, hostEvent = {}, isOpen = false }) { const [hostStatus, setHostStatus] = useState(null); const [activeTabKey, setActiveTabKey] = useState(0); - useEffect(() => { setHostStatus(processEventStatus(hostEvent)); }, [setHostStatus, hostEvent]); @@ -108,11 +107,11 @@ function HostEventModal({ onClose, hostEvent = {}, isOpen = false }) { style={{ alignItems: 'center', marginTop: '20px' }} gutter="sm" > - - {hostEvent.summary_fields.host?.description ? ( + + {hostEvent.summary_fields?.host?.description ? ( ) : null} {hostStatus ? ( @@ -125,12 +124,9 @@ function HostEventModal({ onClose, hostEvent = {}, isOpen = false }) { - + {"changed": true, "cmd": ["free", "-m"], "delta": "0:00:01.479609", "end": "2019-09-10 14:21:45.469533", "rc": 0, "start": "2019-09-10 14:21:43.989924", "stderr": "", "stderr_lines": [], "stdout": " total used free shared buff/cache available\nMem: 7973 3005 960 30 4007 4582\nSwap: 1023 0 1023", "stdout_lines": [" total used free shared buff/cache available", "Mem: 7973 3005 960 30 4007 4582", "Swap: 1023 0 1023"]}" + `, + task: 'command', + type: 'job_event', + url: '/api/v2/job_events/123/', +}; + /* Some libraries return a list of string in stdout Example: https://github.com/ansible-collections/cisco.ios/blob/main/plugins/modules/ios_command.py#L124-L128 @@ -134,6 +175,13 @@ describe('HostEventModal', () => { expect(wrapper).toHaveLength(1); }); + test('renders successfully with partial data', () => { + const wrapper = shallow( + {}} /> + ); + expect(wrapper).toHaveLength(1); + }); + test('should render all tabs', () => { const wrapper = shallow( {}} isOpen />