mirror of
https://github.com/ansible/awx.git
synced 2024-10-31 23:51:09 +03:00
use host_status_counts field for adhoc command jobs ui
This commit is contained in:
parent
1b1df63415
commit
bf55c7e7e2
@ -42,18 +42,17 @@ function JobStatusService (moment, message) {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
if (model.get('type') === 'job' || model.get('type') === 'project_update') {
|
|
||||||
if (model.has('playbook_counts')) {
|
|
||||||
this.setPlaybookCounts(model.get('playbook_counts'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (model.has('host_status_counts')) {
|
if (model.has('host_status_counts')) {
|
||||||
this.setHostStatusCounts(model.get('host_status_counts'));
|
this.setHostStatusCounts(model.get('host_status_counts'));
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
const hostStatusCounts = this.createHostStatusCounts(this.state.status);
|
const hostStatusCounts = this.createHostStatusCounts(this.state.status);
|
||||||
|
|
||||||
this.setHostStatusCounts(hostStatusCounts);
|
this.setHostStatusCounts(hostStatusCounts);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (model.has('playbook_counts')) {
|
||||||
|
this.setPlaybookCounts(model.get('playbook_counts'));
|
||||||
|
} else {
|
||||||
this.setPlaybookCounts({ task_count: 1, play_count: 1 });
|
this.setPlaybookCounts({ task_count: 1, play_count: 1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,14 +130,25 @@ function JobStatusService (moment, message) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.isExpectingStatsEvent = () => (this.jobType === 'job') ||
|
this.isExpectingStatsEvent = () => (this.jobType === 'job') ||
|
||||||
(this.jobType === 'project_update');
|
(this.jobType === 'project_update') ||
|
||||||
|
(this.jobType === 'ad_hoc_command');
|
||||||
|
|
||||||
this.updateStats = () => {
|
this.updateStats = () => {
|
||||||
this.updateHostCounts();
|
this.updateHostCounts();
|
||||||
|
|
||||||
if (this.statsEvent) {
|
if (this.statsEvent) {
|
||||||
this.setFinished(this.statsEvent.created);
|
this.setFinished(this.statsEvent.created);
|
||||||
this.setJobStatus(this.statsEvent.failed ? 'failed' : 'successful');
|
|
||||||
|
const failures = _.get(this.statsEvent, ['event_data', 'failures'], {});
|
||||||
|
const dark = _.get(this.statsEvent, ['event_data', 'dark'], {});
|
||||||
|
|
||||||
|
if (this.statsEvent.failed ||
|
||||||
|
Object.keys(failures).length > 0 ||
|
||||||
|
Object.keys(dark).length > 0) {
|
||||||
|
this.setJobStatus('failed');
|
||||||
|
} else {
|
||||||
|
this.setJobStatus('successful');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -174,9 +184,9 @@ function JobStatusService (moment, message) {
|
|||||||
|
|
||||||
this.setJobStatus = status => {
|
this.setJobStatus = status => {
|
||||||
const isExpectingStats = this.isExpectingStatsEvent();
|
const isExpectingStats = this.isExpectingStatsEvent();
|
||||||
const isIncomplete = _.includes(INCOMPLETE, status);
|
const isIncomplete = INCOMPLETE.includes(status);
|
||||||
const isFinished = _.includes(FINISHED, status);
|
const isFinished = FINISHED.includes(status);
|
||||||
const isAlreadyFinished = _.includes(FINISHED, this.state.status);
|
const isAlreadyFinished = FINISHED.includes(this.state.status);
|
||||||
|
|
||||||
if (isAlreadyFinished) {
|
if (isAlreadyFinished) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user