mirror of
https://github.com/ansible/awx.git
synced 2026-01-23 07:28:02 -03:30
Merge pull request #1532 from jaredevantabor/adhoc-host-events
Adhoc host events
This commit is contained in:
commit
43aab10d18
@ -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 {
|
||||
|
||||
@ -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]);
|
||||
}
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user