mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-18 13:06:30 -06:00
17501 fix showing last run of script execution in list view (#17581)
* 17501 fix showing last run of script job execution in list view * 17501 fix showing last run of script job execution in list view
This commit is contained in:
parent
896b5b9b74
commit
9c9c4fbd6e
@ -408,14 +408,9 @@ class JobsMixin(models.Model):
|
|||||||
|
|
||||||
def get_latest_jobs(self):
|
def get_latest_jobs(self):
|
||||||
"""
|
"""
|
||||||
Return a dictionary mapping of the most recent jobs for this instance.
|
Return a list of the most recent jobs for this instance.
|
||||||
"""
|
"""
|
||||||
return {
|
return self.jobs.filter(status__in=JobStatusChoices.TERMINAL_STATE_CHOICES).order_by('-created').defer('data')
|
||||||
job.name: job
|
|
||||||
for job in self.jobs.filter(
|
|
||||||
status__in=JobStatusChoices.TERMINAL_STATE_CHOICES
|
|
||||||
).order_by('name', '-created').distinct('name').defer('data')
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class JournalingMixin(models.Model):
|
class JournalingMixin(models.Model):
|
||||||
|
@ -50,7 +50,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for script in module.scripts.all %}
|
{% for script in module.scripts.all %}
|
||||||
{% with last_job=script.get_latest_jobs|get_key:script.name %}
|
{% with last_job=script.get_latest_jobs|first %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{% if script.is_executable %}
|
{% if script.is_executable %}
|
||||||
|
Loading…
Reference in New Issue
Block a user