add job type to Host summary_fields.recent_jobs

see: https://github.com/ansible/awx/issues/5236
This commit is contained in:
Ryan Petrello 2020-07-13 09:02:04 -04:00
parent 83458711cd
commit f51774c06e
No known key found for this signature in database
GPG Key ID: F2AA5F2122351777

View File

@ -1697,6 +1697,7 @@ class HostSerializer(BaseSerializerWithVariables):
d.setdefault('recent_jobs', [{
'id': j.job.id,
'name': j.job.job_template.name if j.job.job_template is not None else "",
'type': j.job.get_real_instance_class()._meta.verbose_name.replace(' ', '_'),
'status': j.job.status,
'finished': j.job.finished,
} for j in obj.job_host_summaries.select_related('job__job_template').order_by('-created')[:5]])