From 420f3c0c4c8aa73f3bdf6cdb2aa54d6f794617a4 Mon Sep 17 00:00:00 2001 From: Bai Date: Thu, 4 Jun 2020 14:30:44 +0800 Subject: [PATCH] =?UTF-8?q?[Update]=20=E6=B7=BB=E5=8A=A0celery=20task=20lo?= =?UTF-8?q?g=20view?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jumpserver/urls.py | 1 + apps/ops/templates/ops/celery_task_log.html | 91 +++++++++++++++++++++ apps/ops/urls/view_urls.py | 7 +- apps/ops/views.py | 22 +++++ 4 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 apps/ops/templates/ops/celery_task_log.html create mode 100644 apps/ops/views.py diff --git a/apps/jumpserver/urls.py b/apps/jumpserver/urls.py index 331930c3a..b8d434dc6 100644 --- a/apps/jumpserver/urls.py +++ b/apps/jumpserver/urls.py @@ -31,6 +31,7 @@ api_v2 = [ app_view_patterns = [ path('auth/', include('authentication.urls.view_urls'), name='auth'), + path('ops/', include('ops.urls.view_urls'), name='ops') ] diff --git a/apps/ops/templates/ops/celery_task_log.html b/apps/ops/templates/ops/celery_task_log.html new file mode 100644 index 000000000..c79ff42b2 --- /dev/null +++ b/apps/ops/templates/ops/celery_task_log.html @@ -0,0 +1,91 @@ +{% load static %} +{% load i18n %} + + {% trans 'Task log' %} + + + + + + + +
+
+ + \ No newline at end of file diff --git a/apps/ops/urls/view_urls.py b/apps/ops/urls/view_urls.py index fb52a3e07..21bc4cc41 100644 --- a/apps/ops/urls/view_urls.py +++ b/apps/ops/urls/view_urls.py @@ -1,9 +1,14 @@ # ~*~ coding: utf-8 ~*~ from __future__ import unicode_literals +from django.urls import path + +from .. import views __all__ = ["urlpatterns"] app_name = "ops" urlpatterns = [ -] + # Resource Task url + path('celery/task//log/', views.CeleryTaskLogView.as_view(), name='celery-task-log'), +] \ No newline at end of file diff --git a/apps/ops/views.py b/apps/ops/views.py new file mode 100644 index 000000000..9ae2d9755 --- /dev/null +++ b/apps/ops/views.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# +from django.views.generic import TemplateView +from django.conf import settings + +from common.permissions import PermissionsMixin, IsOrgAdmin, IsOrgAuditor + + +__all__ = ['CeleryTaskLogView'] + + +class CeleryTaskLogView(PermissionsMixin, TemplateView): + template_name = 'ops/celery_task_log.html' + permission_classes = [IsOrgAdmin | IsOrgAuditor] + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + context.update({ + 'task_id': self.kwargs.get('pk'), + 'ws_port': settings.WS_LISTEN_PORT + }) + return context -- GitLab