From dcbb1396214416f4d5c4dddcafab0501e6bb1d22 Mon Sep 17 00:00:00 2001 From: guohelu <19503896967@163.com> Date: Thu, 28 Nov 2024 16:18:58 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E6=95=B0=E6=8D=AE=E9=97=B4=E9=9A=94=E6=97=B6=E9=97=B4?= =?UTF-8?q?=20--story=3D120737215?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gcloud/core/apis/drf/viewsets/periodic_task.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcloud/core/apis/drf/viewsets/periodic_task.py b/gcloud/core/apis/drf/viewsets/periodic_task.py index 650ef834c..253ba49c3 100644 --- a/gcloud/core/apis/drf/viewsets/periodic_task.py +++ b/gcloud/core/apis/drf/viewsets/periodic_task.py @@ -23,6 +23,7 @@ from rest_framework.response import Response from gcloud import err_code +from gcloud.conf import settings from gcloud.common_template.models import CommonTemplate from gcloud.constants import COMMON, PERIOD_TASK_NAME_MAX_LENGTH, PROJECT from gcloud.contrib.audit.utils import bk_audit_add_event @@ -228,7 +229,9 @@ def list(self, request, *args, **kwargs): inst["auth_actions"].append(view_action) inst["is_collected"] = 1 if inst["id"] in collection_task_ids else 0 inst["collection_id"] = collection_task_map.get(inst["id"], -1) - return self.get_paginated_response(instances) if page is not None else Response(instances) + result = self.get_paginated_response(instances) if page is not None else Response(instances) + result.data["interval_time"] = settings.PERIODIC_TASK_SHORTEST_TIME + return result def retrieve(self, request, *args, **kwargs): instance = self.get_object() From 041c2ebc374e782932b69dc8f310e92810196b82 Mon Sep 17 00:00:00 2001 From: guohelu <19503896967@163.com> Date: Thu, 28 Nov 2024 17:05:50 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E7=9B=B8=E5=BA=94?= =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E6=96=87=E9=97=AE=E9=A2=98=20--story=3D12073?= =?UTF-8?q?7215?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gcloud/core/apis/drf/viewsets/periodic_task.py | 5 +---- gcloud/core/context_processors.py | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/gcloud/core/apis/drf/viewsets/periodic_task.py b/gcloud/core/apis/drf/viewsets/periodic_task.py index 253ba49c3..650ef834c 100644 --- a/gcloud/core/apis/drf/viewsets/periodic_task.py +++ b/gcloud/core/apis/drf/viewsets/periodic_task.py @@ -23,7 +23,6 @@ from rest_framework.response import Response from gcloud import err_code -from gcloud.conf import settings from gcloud.common_template.models import CommonTemplate from gcloud.constants import COMMON, PERIOD_TASK_NAME_MAX_LENGTH, PROJECT from gcloud.contrib.audit.utils import bk_audit_add_event @@ -229,9 +228,7 @@ def list(self, request, *args, **kwargs): inst["auth_actions"].append(view_action) inst["is_collected"] = 1 if inst["id"] in collection_task_ids else 0 inst["collection_id"] = collection_task_map.get(inst["id"], -1) - result = self.get_paginated_response(instances) if page is not None else Response(instances) - result.data["interval_time"] = settings.PERIODIC_TASK_SHORTEST_TIME - return result + return self.get_paginated_response(instances) if page is not None else Response(instances) def retrieve(self, request, *args, **kwargs): instance = self.get_object() diff --git a/gcloud/core/context_processors.py b/gcloud/core/context_processors.py index 150348155..89c1f9191 100644 --- a/gcloud/core/context_processors.py +++ b/gcloud/core/context_processors.py @@ -91,6 +91,7 @@ def mysetting(request): "_": _, # 国际化 "LANGUAGES": settings.LANGUAGES, # 国际化 # 自定义变量 + "PERIODIC_TASK_SHORTEST_TIME": settings.PERIODIC_TASK_SHORTEST_TIME, "OPEN_VER": settings.OPEN_VER, "RUN_VER": settings.RUN_VER, "RUN_VER_NAME": EnvironmentVariables.objects.get_var(run_ver_key, settings.RUN_VER_NAME),