1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

Updates URL for host events for adhoc commands

This commit is contained in:
Jared Tabor 2018-04-23 19:15:12 -07:00
parent 298af25bab
commit 99fb8e6d83
No known key found for this signature in database
GPG Key ID: 1B343EC4C3CF7E5C
2 changed files with 13 additions and 4 deletions

View File

@ -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]);
}

View File

@ -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)