perf: report to iframe

pull/14936/head
feng 2025-02-25 19:12:18 +08:00 committed by feng626
parent 456b96a369
commit 919cdeae20
4 changed files with 6 additions and 4 deletions

View File

@ -1,6 +1,7 @@
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.utils.translation import gettext_lazy as _ from django.utils.translation import gettext_lazy as _
from django.views.decorators.clickjacking import xframe_options_sameorigin
from rest_framework import status, mixins, viewsets from rest_framework import status, mixins, viewsets
from rest_framework.decorators import action from rest_framework.decorators import action
from rest_framework.response import Response from rest_framework.response import Response
@ -115,9 +116,9 @@ class AutomationExecutionViewSet(
) )
return Response({'task': task.id}, status=status.HTTP_201_CREATED) return Response({'task': task.id}, status=status.HTTP_201_CREATED)
@xframe_options_sameorigin
@action(methods=['get'], detail=True, url_path='report') @action(methods=['get'], detail=True, url_path='report')
def report(self, request, *args, **kwargs): def report(self, request, *args, **kwargs):
execution = self.get_object() execution = self.get_object()
report = execution.manager.gen_report() report = execution.manager.gen_report()
return HttpResponse(report) return HttpResponse(report)

View File

@ -2,6 +2,7 @@
# #
from django.http import HttpResponse from django.http import HttpResponse
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.views.decorators.clickjacking import xframe_options_sameorigin
from rest_framework import status from rest_framework import status
from rest_framework.decorators import action from rest_framework.decorators import action
from rest_framework.response import Response from rest_framework.response import Response
@ -48,6 +49,7 @@ class DiscoverAccountsExecutionViewSet(AutomationExecutionViewSet):
queryset = queryset.filter(automation__type=self.tp) queryset = queryset.filter(automation__type=self.tp)
return queryset return queryset
@xframe_options_sameorigin
@action(methods=["get"], detail=False, url_path="adhoc") @action(methods=["get"], detail=False, url_path="adhoc")
def adhoc(self, request, *args, **kwargs): def adhoc(self, request, *args, **kwargs):
asset_id = request.query_params.get("asset_id") asset_id = request.query_params.get("asset_id")

View File

@ -20,8 +20,7 @@
"AccountDeleteConfirmMsg": "Delete account, continue?", "AccountDeleteConfirmMsg": "Delete account, continue?",
"AccountDeleted": "Account deleted", "AccountDeleted": "Account deleted",
"AccountDiscoverDetail": "Gather account details", "AccountDiscoverDetail": "Gather account details",
"AccountDiscoverList": "Discover accounts", "AccountDiscover": "Discover accounts",
"AccountDiscoverTask": "Discover accounts tasks",
"AccountDiscoverTaskCreate": "Create discover accounts task", "AccountDiscoverTaskCreate": "Create discover accounts task",
"AccountDiscoverTaskUpdate": "Update the discover accounts task", "AccountDiscoverTaskUpdate": "Update the discover accounts task",
"AccountExportTips": "The exported information contains sensitive information such as encrypted account numbers. the exported format is an encrypted zip file (if you have not set the encryption password, please go to personal info to set the file encryption password).", "AccountExportTips": "The exported information contains sensitive information such as encrypted account numbers. the exported format is an encrypted zip file (if you have not set the encryption password, please go to personal info to set the file encryption password).",

View File

@ -18,7 +18,7 @@
"AccountData": "账号数据", "AccountData": "账号数据",
"AccountDeleteConfirmMsg": "删除账号,是否继续?", "AccountDeleteConfirmMsg": "删除账号,是否继续?",
"AccountDeleted": "账号删除", "AccountDeleted": "账号删除",
"AccountDiscoverTask": "账号发现", "AccountDiscover": "账号发现",
"AccountExportTips": "导出信息中包含账号密文涉及敏感信息导出的格式为一个加密的zip文件若没有设置加密密码请前往个人信息中设置文件加密密码。", "AccountExportTips": "导出信息中包含账号密文涉及敏感信息导出的格式为一个加密的zip文件若没有设置加密密码请前往个人信息中设置文件加密密码。",
"AccountList": "账号", "AccountList": "账号",
"AccountPolicy": "账号策略", "AccountPolicy": "账号策略",