mirror of
https://github.com/ansible/awx.git
synced 2026-03-03 09:48:51 -03:30
Build correct job_event url for different job types
This commit is contained in:
@@ -20,12 +20,12 @@ class Jobs extends RelaunchMixin(Base) {
|
|||||||
return this.http.get(`/api/v2${BASE_URLS[type]}${id}/`);
|
return this.http.get(`/api/v2${BASE_URLS[type]}${id}/`);
|
||||||
}
|
}
|
||||||
|
|
||||||
readEvents(id, jobType = 'job', params = {}) {
|
readEvents(id, type = 'playbook', params = {}) {
|
||||||
let endpoint;
|
let endpoint;
|
||||||
if (jobType === 'job') {
|
if (type === 'playbook') {
|
||||||
endpoint = `${this.baseUrl}${id}/job_events/`;
|
endpoint = `/api/v2${BASE_URLS[type]}${id}/job_events/`;
|
||||||
} else {
|
} else {
|
||||||
endpoint = `${this.baseUrl}${id}/events/`;
|
endpoint = `/api/v2${BASE_URLS[type]}${id}/events/`;
|
||||||
}
|
}
|
||||||
return this.http.get(endpoint, { params });
|
return this.http.get(endpoint, { params });
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class JobOutput extends Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async loadJobEvents() {
|
async loadJobEvents() {
|
||||||
const { job } = this.props;
|
const { job, type } = this.props;
|
||||||
|
|
||||||
const loadRange = range(1, 50);
|
const loadRange = range(1, 50);
|
||||||
this._isMounted &&
|
this._isMounted &&
|
||||||
@@ -123,7 +123,7 @@ class JobOutput extends Component {
|
|||||||
try {
|
try {
|
||||||
const {
|
const {
|
||||||
data: { results: newResults = [], count },
|
data: { results: newResults = [], count },
|
||||||
} = await JobsAPI.readEvents(job.id, job.type, {
|
} = await JobsAPI.readEvents(job.id, type, {
|
||||||
page_size: 50,
|
page_size: 50,
|
||||||
order_by: 'start_line',
|
order_by: 'start_line',
|
||||||
});
|
});
|
||||||
@@ -220,7 +220,7 @@ class JobOutput extends Component {
|
|||||||
if (startIndex === 0 && stopIndex === 0) {
|
if (startIndex === 0 && stopIndex === 0) {
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
const { job } = this.props;
|
const { job, type } = this.props;
|
||||||
|
|
||||||
const loadRange = range(startIndex, stopIndex);
|
const loadRange = range(startIndex, stopIndex);
|
||||||
this._isMounted &&
|
this._isMounted &&
|
||||||
@@ -233,7 +233,7 @@ class JobOutput extends Component {
|
|||||||
order_by: 'start_line',
|
order_by: 'start_line',
|
||||||
};
|
};
|
||||||
|
|
||||||
return JobsAPI.readEvents(job.id, job.type, params).then(response => {
|
return JobsAPI.readEvents(job.id, type, params).then(response => {
|
||||||
this._isMounted &&
|
this._isMounted &&
|
||||||
this.setState(({ results, currentlyLoading }) => {
|
this.setState(({ results, currentlyLoading }) => {
|
||||||
response.data.results.forEach(jobEvent => {
|
response.data.results.forEach(jobEvent => {
|
||||||
|
|||||||
Reference in New Issue
Block a user