diff --git a/netbox/core/tables/tasks.py b/netbox/core/tables/tasks.py index 90f04a926..e88f5c299 100644 --- a/netbox/core/tables/tasks.py +++ b/netbox/core/tables/tasks.py @@ -9,14 +9,14 @@ from utilities.templatetags.helpers import annotated_date class BackgroundQueueTable(BaseTable): - name = tables.LinkColumn("core:background_task_list", args=[A("index")], verbose_name=_("Name")) - jobs = tables.LinkColumn("core:background_task_list", args=[A("index")], verbose_name=_("Queued")) + name = tables.LinkColumn("core:background_task_list", args=[A("index"), "queued"], verbose_name=_("Name")) + jobs = tables.LinkColumn("core:background_task_list", args=[A("index"), "queued"], verbose_name=_("Queued")) oldest_job_timestamp = tables.Column(verbose_name=_("Oldest Queued")) - started_jobs = tables.Column(verbose_name=_("Active")) - deferred_jobs = tables.Column(verbose_name=_("Deferred")) - finished_jobs = tables.Column(verbose_name=_("Finished")) - failed_jobs = tables.Column(verbose_name=_("Failed")) - scheduled_jobs = tables.Column(verbose_name=_("Scheduled")) + started_jobs = tables.LinkColumn("core:background_task_list", args=[A("index"), "started"], verbose_name=_("Active")) + deferred_jobs = tables.LinkColumn("core:background_task_list", args=[A("index"), "deferred"], verbose_name=_("Deferred")) + finished_jobs = tables.LinkColumn("core:background_task_list", args=[A("index"), "finished"], verbose_name=_("Finished")) + failed_jobs = tables.LinkColumn("core:background_task_list", args=[A("index"), "failed"], verbose_name=_("Failed")) + scheduled_jobs = tables.LinkColumn("core:background_task_list", args=[A("index"), "scheduled"], verbose_name=_("Scheduled")) workers = tables.Column(verbose_name=_("Workers")) host = tables.Column(accessor="connection_kwargs__host", verbose_name=_("Host")) port = tables.Column(accessor="connection_kwargs__port", verbose_name=_("Port")) @@ -34,7 +34,7 @@ class BackgroundQueueTable(BaseTable): class BackgroundTaskTable(BaseTable): - id = tables.Column(empty_values=(), verbose_name=_("ID")) + id = tables.LinkColumn("core:background_task", args=[A("id")], verbose_name=_("ID")) created_at = tables.DateTimeColumn(verbose_name=_("Created")) enqueued_at = tables.DateTimeColumn(verbose_name=_("Enqueued")) ended_at = tables.DateTimeColumn(verbose_name=_("Ended")) @@ -50,12 +50,6 @@ class BackgroundTaskTable(BaseTable): 'id', 'created_at', 'enqueued_at', 'ended_at', 'status', 'callable', ) - def render_id(self, value, record): - return mark_safe('' + value + '' - ) - def render_status(self, value, record): return record.get_status diff --git a/netbox/core/urls.py b/netbox/core/urls.py index 0c74e1f46..cae88ce66 100644 --- a/netbox/core/urls.py +++ b/netbox/core/urls.py @@ -27,7 +27,7 @@ urlpatterns = ( # Background Tasks path('background-queues/', views.BackgroundQueueListView.as_view(), name='background_queue_list'), - path('background-queues//', views.BackgroundTaskListView.as_view(), name='background_task_list'), + path('background-queues///', views.BackgroundTaskListView.as_view(), name='background_task_list'), path('background-tasks//', views.BackgroundTaskDetailView.as_view(), name='background_task'), # Config revisions diff --git a/netbox/core/views.py b/netbox/core/views.py index 5a5344f67..1bbe6674b 100644 --- a/netbox/core/views.py +++ b/netbox/core/views.py @@ -265,7 +265,7 @@ class BackgroundTaskListView(UserPassesTestMixin, View): def test_func(self): return self.request.user.is_staff - def get(self, request, queue_index): + def get(self, request, queue_index, status): queue = get_queue_by_index(queue_index) if queue.count > 0: @@ -278,6 +278,7 @@ class BackgroundTaskListView(UserPassesTestMixin, View): return render(request, 'core/background_task_list.html', { 'table': table, 'queue': queue, + 'status': status, }) diff --git a/netbox/templates/core/background_task_list.html b/netbox/templates/core/background_task_list.html index cb7aeefe2..8ec18126f 100644 --- a/netbox/templates/core/background_task_list.html +++ b/netbox/templates/core/background_task_list.html @@ -15,7 +15,7 @@ {{ block.super }} {% endblock page-header %} -{% block title %}{% trans "Queued Jobs in " %}{{ queue.name }}{% endblock %} +{% block title %}{{ status|capfirst }} {% trans "Jobs in " %}{{ queue.name }}{% endblock %} {% block tabs %}