From f8f0bb09b39e7865f41036e181986db167266dd8 Mon Sep 17 00:00:00 2001 From: raja <1647193241@qq.com> Date: Mon, 13 Jan 2025 13:48:22 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A7=84=E5=88=99=E5=AE=A1=E8=AE=A1-?= =?UTF-8?q?=E7=AD=96=E7=95=A5=E6=96=B0=E5=A2=9E/=E7=BC=96=E8=BE=91-?= =?UTF-8?q?=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20--story=3D121513458?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【优化】 1. 优化联表列表接口 2. 优化异常信息 --- src/backend/locale/en/LC_MESSAGES/django.po | 7 ++++--- src/backend/locale/zh_CN/LC_MESSAGES/django.po | 7 ++++--- src/backend/services/web/analyze/controls/rule_audit.py | 2 +- src/backend/services/web/analyze/exceptions.py | 6 +++++- src/backend/services/web/strategy_v2/resources.py | 2 +- 5 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/backend/locale/en/LC_MESSAGES/django.po b/src/backend/locale/en/LC_MESSAGES/django.po index 320f9afb..3a139638 100644 --- a/src/backend/locale/en/LC_MESSAGES/django.po +++ b/src/backend/locale/en/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-09 20:42+0800\n" +"POT-Creation-Date: 2025-01-13 13:47+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2248,8 +2248,9 @@ msgstr "Cluster Not Exists" msgid "Control Not Exists" msgstr "Cluster Not Exists" -msgid "Not Support DataSource" -msgstr "Not Support DataSource" +#, python-format +msgid "Not Support DataSource; source_type: %s; result_table: %s" +msgstr "Not Support DataSource; source_type: %s; result_table: %s" msgid "操作行为审计" msgstr "Operation Audit" diff --git a/src/backend/locale/zh_CN/LC_MESSAGES/django.po b/src/backend/locale/zh_CN/LC_MESSAGES/django.po index 5f4427de..09e127cf 100644 --- a/src/backend/locale/zh_CN/LC_MESSAGES/django.po +++ b/src/backend/locale/zh_CN/LC_MESSAGES/django.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2025-01-09 20:42+0800\n" +"POT-Creation-Date: 2025-01-13 13:47+0800\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -2248,8 +2248,9 @@ msgstr "集群不存在" msgid "Control Not Exists" msgstr "控件不存在" -msgid "Not Support DataSource" -msgstr "不支持的数据源" +#, python-format +msgid "Not Support DataSource; source_type: %s; result_table: %s" +msgstr "不支持的数据源;来源类型: %s;结果表: %s" msgid "操作行为审计" msgstr "操作行为审计" diff --git a/src/backend/services/web/analyze/controls/rule_audit.py b/src/backend/services/web/analyze/controls/rule_audit.py index 995e7f87..131a0599 100644 --- a/src/backend/services/web/analyze/controls/rule_audit.py +++ b/src/backend/services/web/analyze/controls/rule_audit.py @@ -165,7 +165,7 @@ def check_source_type(self, result_table_id: str) -> str: return FlowDataSourceNodeType.BATCH_REAL # 4. 未支持:异常 else: - raise NotSupportDataSource() + raise NotSupportDataSource(source_type, result_table_id) @cached_property def rt_ids(self) -> List[str]: diff --git a/src/backend/services/web/analyze/exceptions.py b/src/backend/services/web/analyze/exceptions.py index 69bb62b7..e40ff407 100644 --- a/src/backend/services/web/analyze/exceptions.py +++ b/src/backend/services/web/analyze/exceptions.py @@ -42,4 +42,8 @@ class ControlNotExist(AnalyzeException): class NotSupportDataSource(AnalyzeException): STATUS_CODE = 400 ERROR_CODE = "003" - MESSAGE = gettext_lazy("Not Support DataSource") + MESSAGE = gettext_lazy("Not Support DataSource; source_type: %s; result_table: %s") + + def __init__(self, source_type, result_table, *args, **kwargs): + self.MESSAGE = self.MESSAGE % (source_type, result_table) + super().__init__(*args, **kwargs) diff --git a/src/backend/services/web/strategy_v2/resources.py b/src/backend/services/web/strategy_v2/resources.py index 1c3bd1bd..a94bc144 100644 --- a/src/backend/services/web/strategy_v2/resources.py +++ b/src/backend/services/web/strategy_v2/resources.py @@ -926,7 +926,7 @@ def perform_request(self, validated_request_data): # 获取最新版本的联表 link_tables = LinkTable.list_max_version_link_table().filter(**validated_request_data) # 过滤标签 - if no_tag: + if no_tag or int(NO_TAG_ID) in tags: link_table_uids = LinkTableTag.objects.values_list("link_table_uid").distinct() link_tables = link_tables.exclude(uid__in=link_table_uids) elif tags: