mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-17 21:18:16 -06:00
14729 rq table
This commit is contained in:
parent
8254e707b6
commit
39c7b1ed5d
@ -1,3 +1,4 @@
|
||||
from .config import *
|
||||
from .data import *
|
||||
from .jobs import *
|
||||
from .tasks import *
|
||||
|
@ -25,6 +25,9 @@ urlpatterns = (
|
||||
path('jobs/<int:pk>/', views.JobView.as_view(), name='job'),
|
||||
path('jobs/<int:pk>/delete/', views.JobDeleteView.as_view(), name='job_delete'),
|
||||
|
||||
# Background Tasks
|
||||
path('tasks/', views.BackgroundTasksView.as_view(), name='background_tasks'),
|
||||
|
||||
# Config revisions
|
||||
path('config-revisions/', views.ConfigRevisionListView.as_view(), name='configrevision_list'),
|
||||
path('config-revisions/add/', views.ConfigRevisionEditView.as_view(), name='configrevision_add'),
|
||||
|
@ -1,6 +1,9 @@
|
||||
from django.contrib import messages
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from django.core.cache import cache
|
||||
from django.http import HttpResponseForbidden
|
||||
from django_rq.utils import get_scheduler_statistics, get_statistics
|
||||
|
||||
from django.shortcuts import get_object_or_404, redirect, render
|
||||
from django.views.generic import View
|
||||
|
||||
@ -232,3 +235,17 @@ class ConfigRevisionRestoreView(ContentTypePermissionRequiredMixin, View):
|
||||
messages.success(request, f"Restored configuration revision #{pk}")
|
||||
|
||||
return redirect(candidate_config.get_absolute_url())
|
||||
|
||||
#
|
||||
# Background Tasks (RQ)
|
||||
#
|
||||
|
||||
|
||||
class BackgroundTasksView(LoginRequiredMixin, View):
|
||||
|
||||
def get(self, request):
|
||||
table = tables.BackgroundTasksTable(get_statistics(run_maintenance_tasks=True)["queues"])
|
||||
return render(request, 'core/background_tasks.html', {
|
||||
'active_tab': 'api-tokens',
|
||||
'table': table,
|
||||
})
|
||||
|
@ -356,6 +356,11 @@ OPERATIONS_MENU = Menu(
|
||||
link_text=_('Jobs'),
|
||||
permissions=['core.view_job'],
|
||||
),
|
||||
MenuItem(
|
||||
link='core:background_tasks',
|
||||
link_text=_('Background Tasks'),
|
||||
permissions=['core.view_job'],
|
||||
),
|
||||
),
|
||||
),
|
||||
MenuGroup(
|
||||
|
Loading…
Reference in New Issue
Block a user