mirror of
https://github.com/ansible/awx.git
synced 2026-01-16 12:20:45 -03:30
Merge pull request #4903 from jakemcdermott/add-output-for-all-job-types
Make job output panel work with all job types Reviewed-by: https://github.com/apps/softwarefactory-project-zuul
This commit is contained in:
commit
5a5b46aea0
@ -20,12 +20,12 @@ class Jobs extends RelaunchMixin(Base) {
|
||||
return this.http.get(`/api/v2${BASE_URLS[type]}${id}/`);
|
||||
}
|
||||
|
||||
readEvents(id, jobType = 'job', params = {}) {
|
||||
readEvents(id, type = 'playbook', params = {}) {
|
||||
let endpoint;
|
||||
if (jobType === 'job') {
|
||||
endpoint = `${this.baseUrl}${id}/job_events/`;
|
||||
if (type === 'playbook') {
|
||||
endpoint = `/api/v2${BASE_URLS[type]}${id}/job_events/`;
|
||||
} else {
|
||||
endpoint = `${this.baseUrl}${id}/events/`;
|
||||
endpoint = `/api/v2${BASE_URLS[type]}${id}/events/`;
|
||||
}
|
||||
return this.http.get(endpoint, { params });
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ class JobOutput extends Component {
|
||||
}
|
||||
|
||||
async loadJobEvents() {
|
||||
const { job } = this.props;
|
||||
const { job, type } = this.props;
|
||||
|
||||
const loadRange = range(1, 50);
|
||||
this._isMounted &&
|
||||
@ -123,7 +123,7 @@ class JobOutput extends Component {
|
||||
try {
|
||||
const {
|
||||
data: { results: newResults = [], count },
|
||||
} = await JobsAPI.readEvents(job.id, job.type, {
|
||||
} = await JobsAPI.readEvents(job.id, type, {
|
||||
page_size: 50,
|
||||
order_by: 'start_line',
|
||||
});
|
||||
@ -220,7 +220,7 @@ class JobOutput extends Component {
|
||||
if (startIndex === 0 && stopIndex === 0) {
|
||||
return Promise.resolve(null);
|
||||
}
|
||||
const { job } = this.props;
|
||||
const { job, type } = this.props;
|
||||
|
||||
const loadRange = range(startIndex, stopIndex);
|
||||
this._isMounted &&
|
||||
@ -233,7 +233,7 @@ class JobOutput extends Component {
|
||||
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.setState(({ results, currentlyLoading }) => {
|
||||
response.data.results.forEach(jobEvent => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user