From 298af25babeea0f73a544dc746624022fc2fc9db Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Mon, 23 Apr 2018 18:13:26 -0700 Subject: [PATCH 1/2] Points the host event modal's Standard Out tab at `event_data.res.stdout` instead of `event_data.res.results.stdout`. Same for stderr. This was some stale copy pasta from the host event modal rework --- .../features/output/host-event/host-event.controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/features/output/host-event/host-event.controller.js b/awx/ui/client/features/output/host-event/host-event.controller.js index 67105ba7a0..a688e59a64 100644 --- a/awx/ui/client/features/output/host-event/host-event.controller.js +++ b/awx/ui/client/features/output/host-event/host-event.controller.js @@ -26,7 +26,7 @@ function HostEventsController ( $scope.module_name = 'No result found'; } - if (_.has(hostEvent.event_data, 'res.result.stdout')) { + if (_.has(hostEvent.event_data, 'res.stdout')) { if (hostEvent.event_data.res.stdout === '') { $scope.stdout = ' '; } else { @@ -34,7 +34,7 @@ function HostEventsController ( } } - if (_.has(hostEvent.event_data, 'res.result.stderr')) { + if (_.has(hostEvent.event_data, 'res.stderr')) { if (hostEvent.event_data.res.stderr === '') { $scope.stderr = ' '; } else { From 99fb8e6d83b92a43bd446ca583d39a2d9854aa04 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Mon, 23 Apr 2018 19:15:12 -0700 Subject: [PATCH 2/2] Updates URL for host events for adhoc commands --- .../output/host-event/host-event.route.js | 2 +- .../output/host-event/host-event.service.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/awx/ui/client/features/output/host-event/host-event.route.js b/awx/ui/client/features/output/host-event/host-event.route.js index 06f3eeac51..105881c778 100644 --- a/awx/ui/client/features/output/host-event/host-event.route.js +++ b/awx/ui/client/features/output/host-event/host-event.route.js @@ -14,7 +14,7 @@ function exit () { } function HostEventResolve (HostEventService, $stateParams) { - return HostEventService.getRelatedJobEvents($stateParams.id, { + return HostEventService.getRelatedJobEvents($stateParams.id, $stateParams.type, { id: $stateParams.eventId }).then((response) => response.data.results[0]); } diff --git a/awx/ui/client/features/output/host-event/host-event.service.js b/awx/ui/client/features/output/host-event/host-event.service.js index a1e6952725..4454bde27b 100644 --- a/awx/ui/client/features/output/host-event/host-event.service.js +++ b/awx/ui/client/features/output/host-event/host-event.service.js @@ -4,13 +4,22 @@ function HostEventService ( GetBasePath, $rootScope ) { + this.getUrl = (id, type, params) => { + let url; + if (type === 'playbook') { + url = `${GetBasePath('jobs')}${id}/job_events/?${this.stringifyParams(params)}`; + } else if (type === 'command') { + url = `${GetBasePath('ad_hoc_commands')}${id}/events/?${this.stringifyParams(params)}`; + } + return url; + }; + // GET events related to a job run // e.g. // ?event=playbook_on_stats // ?parent=206&event__startswith=runner&page_size=200&order=host_name,counter - this.getRelatedJobEvents = (id, params) => { - let url = GetBasePath('jobs'); - url = `${url}${id}/job_events/?${this.stringifyParams(params)}`; + this.getRelatedJobEvents = (id, type, params) => { + const url = this.getUrl(id, type, params); Rest.setUrl(url); return Rest.get() .then(response => response)