mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-18 05:28:16 -06:00
14729 review changes
This commit is contained in:
parent
679faaca39
commit
0ac2c6e364
@ -4,7 +4,7 @@ from django.urls import reverse
|
|||||||
from django.utils.html import mark_safe
|
from django.utils.html import mark_safe
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
from netbox.tables import BaseTable
|
from netbox.tables import BaseTable, columns
|
||||||
from utilities.templatetags.helpers import annotated_date
|
from utilities.templatetags.helpers import annotated_date
|
||||||
|
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ class BackgroundTaskTable(BaseTable):
|
|||||||
created_at = tables.DateTimeColumn(verbose_name=_("Created"))
|
created_at = tables.DateTimeColumn(verbose_name=_("Created"))
|
||||||
enqueued_at = tables.DateTimeColumn(verbose_name=_("Enqueued"))
|
enqueued_at = tables.DateTimeColumn(verbose_name=_("Enqueued"))
|
||||||
ended_at = tables.DateTimeColumn(verbose_name=_("Ended"))
|
ended_at = tables.DateTimeColumn(verbose_name=_("Ended"))
|
||||||
status = tables.Column(empty_values=(), verbose_name=_("Status"))
|
status = columns.ChoiceFieldColumn(verbose_name=_("Status"), accessor='get_status')
|
||||||
callable = tables.Column(empty_values=(), verbose_name=_("Callable"))
|
callable = tables.Column(empty_values=(), verbose_name=_("Callable"))
|
||||||
|
|
||||||
class Meta(BaseTable.Meta):
|
class Meta(BaseTable.Meta):
|
||||||
@ -50,9 +50,6 @@ class BackgroundTaskTable(BaseTable):
|
|||||||
'id', 'created_at', 'enqueued_at', 'ended_at', 'status', 'callable',
|
'id', 'created_at', 'enqueued_at', 'ended_at', 'status', 'callable',
|
||||||
)
|
)
|
||||||
|
|
||||||
def render_status(self, value, record):
|
|
||||||
return record.get_status
|
|
||||||
|
|
||||||
def render_callable(self, value, record):
|
def render_callable(self, value, record):
|
||||||
try:
|
try:
|
||||||
return record.func_name
|
return record.func_name
|
||||||
|
@ -399,12 +399,6 @@ class BackgroundTaskDetailView(UserPassesTestMixin, View):
|
|||||||
queue_index = QUEUES_MAP[job.origin]
|
queue_index = QUEUES_MAP[job.origin]
|
||||||
queue = get_queue_by_index(queue_index)
|
queue = get_queue_by_index(queue_index)
|
||||||
|
|
||||||
try:
|
|
||||||
job.func_name
|
|
||||||
data_is_valid = True
|
|
||||||
except Exception:
|
|
||||||
data_is_valid = False
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
exc_info = job._exc_info
|
exc_info = job._exc_info
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
@ -414,7 +408,6 @@ class BackgroundTaskDetailView(UserPassesTestMixin, View):
|
|||||||
'queue': queue,
|
'queue': queue,
|
||||||
'job': job,
|
'job': job,
|
||||||
'queue_index': queue_index,
|
'queue_index': queue_index,
|
||||||
'data_is_valid': data_is_valid,
|
|
||||||
'dependency_id': job._dependency_id,
|
'dependency_id': job._dependency_id,
|
||||||
'exc_info': exc_info,
|
'exc_info': exc_info,
|
||||||
})
|
})
|
||||||
|
@ -92,9 +92,15 @@
|
|||||||
<th scope="row">{% trans "Kwargs" %}</th>
|
<th scope="row">{% trans "Kwargs" %}</th>
|
||||||
<td>{{ job.kwargs|placeholder }}</td>
|
<td>{{ job.kwargs|placeholder }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% if dependency_id %}
|
||||||
|
<tr>
|
||||||
|
<th scope="row">{% trans "Depends on" %}</th>
|
||||||
|
<td><a href="{% url 'core:background_task' job.id %}">{{ dependency_id }}</a></td>
|
||||||
|
</tr>
|
||||||
|
{% endif %}
|
||||||
{% if exc_info %}
|
{% if exc_info %}
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">{% trans "Exception:" %}</th>
|
<th scope="row">{% trans "Exception" %}</th>
|
||||||
<td><pre>{% if job.exc_info %}{{ job.exc_info|linebreaks }}{% endif %}</pre></td>
|
<td><pre>{% if job.exc_info %}{{ job.exc_info|linebreaks }}{% endif %}</pre></td>
|
||||||
</tr>
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
Reference in New Issue
Block a user