Closes #12068: Establish a direct relationship from jobs to objects (#12075)

* Reference database object by GFK when running scripts & reports via UI

* Reference database object by GFK when running scripts & reports via API

* Remove old enqueue_job() method

* Enable filtering jobs by object

* Introduce ObjectJobsView

* Add tabbed views for report & script jobs

* Add object_id to JobSerializer

* Move generic relation to JobsMixin

* Clean up old naming
This commit is contained in:
Jeremy Stretch
2023-03-28 15:47:09 -04:00
committed by GitHub
parent 15590f1f48
commit d2a694a878
33 changed files with 583 additions and 353 deletions

View File

@@ -3,19 +3,19 @@
{% load log_levels %}
<p>
{% if result.started %}
Started: <strong>{{ result.started|annotated_date }}</strong>
{% elif result.scheduled %}
Scheduled for: <strong>{{ result.scheduled|annotated_date }}</strong> ({{ result.scheduled|naturaltime }})
{% if job.started %}
Started: <strong>{{ job.started|annotated_date }}</strong>
{% elif job.scheduled %}
Scheduled for: <strong>{{ job.scheduled|annotated_date }}</strong> ({{ job.scheduled|naturaltime }})
{% else %}
Created: <strong>{{ result.created|annotated_date }}</strong>
Created: <strong>{{ job.created|annotated_date }}</strong>
{% endif %}
{% if result.completed %}
Duration: <strong>{{ result.duration }}</strong>
{% if job.completed %}
Duration: <strong>{{ job.duration }}</strong>
{% endif %}
<span id="pending-result-label">{% badge result.get_status_display result.get_status_color %}</span>
<span id="pending-result-label">{% badge job.get_status_display job.get_status_color %}</span>
</p>
{% if result.completed %}
{% if job.completed %}
<div class="card mb-3">
<h5 class="card-header">Script Log</h5>
<div class="card-body">
@@ -25,7 +25,7 @@
<th>Level</th>
<th>Message</th>
</tr>
{% for log in result.data.log %}
{% for log in job.data.log %}
<tr>
<td>{{ forloop.counter }}</td>
<td>{% log_level log.status %}</td>
@@ -47,11 +47,11 @@
{% endif %}
</div>
<h4>Output</h4>
{% if result.data.output %}
<pre class="block">{{ result.data.output }}</pre>
{% if job.data.output %}
<pre class="block">{{ job.data.output }}</pre>
{% else %}
<p class="text-muted">None</p>
{% endif %}
{% elif result.started %}
{% elif job.started %}
{% include 'extras/inc/result_pending.html' %}
{% endif %}