mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 02:50:02 -03:30
Fix host event type and reference errors
This commit is contained in:
parent
4529429e99
commit
fe2ebeb872
@ -97,7 +97,9 @@ const processCodeMirrorValue = value => {
|
||||
};
|
||||
|
||||
const processStdOutValue = hostEvent => {
|
||||
const { taskAction, res } = hostEvent.event_data;
|
||||
const taskAction = hostEvent?.event_data?.taskAction;
|
||||
const res = hostEvent?.event_data?.res;
|
||||
|
||||
let stdOut;
|
||||
if (taskAction === 'debug' && res.result && res.result.stdout) {
|
||||
stdOut = res.result.stdout;
|
||||
@ -107,7 +109,7 @@ const processStdOutValue = hostEvent => {
|
||||
Array.isArray(res.results)
|
||||
) {
|
||||
[stdOut] = res.results;
|
||||
} else {
|
||||
} else if (res) {
|
||||
stdOut = res.stdout;
|
||||
}
|
||||
return stdOut;
|
||||
@ -125,8 +127,8 @@ function HostEventModal({ onClose, hostEvent = {}, isOpen = false, i18n }) {
|
||||
setActiveTabKey(tabIndex);
|
||||
};
|
||||
|
||||
const jsonObj = processCodeMirrorValue(hostEvent.event_data.res);
|
||||
const stdErr = processCodeMirrorValue(hostEvent.event_data.res.stderr);
|
||||
const jsonObj = processCodeMirrorValue(hostEvent?.event_data?.res);
|
||||
const stdErr = processCodeMirrorValue(hostEvent?.event_data?.res?.stderr);
|
||||
const stdOut = processCodeMirrorValue(processStdOutValue(hostEvent));
|
||||
|
||||
return (
|
||||
@ -167,7 +169,7 @@ function HostEventModal({ onClose, hostEvent = {}, isOpen = false, i18n }) {
|
||||
/>
|
||||
<Detail
|
||||
label={i18n._(t`Command`)}
|
||||
value={hostEvent.event_data.res.cmd}
|
||||
value={hostEvent?.event_data?.res?.cmd}
|
||||
/>
|
||||
</DetailList>
|
||||
</Tab>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user