Skip to content

Commit

Permalink
Merge pull request #548 from 0RAJA/feat_rule_audit_tag
Browse files Browse the repository at this point in the history
feat: 规则审计-策略联表标签列表合并-后端接口 --story=121768719
  • Loading branch information
0RAJA authored Jan 23, 2025
2 parents a742917 + 6fca2e7 commit 0ddb786
Show file tree
Hide file tree
Showing 8 changed files with 55 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/backend/apps/meta/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
GlobalMetaConfigInfoSerializer,
GlobalMetaConfigListSerializer,
GlobalMetaConfigPostSerializer,
ListAllTagsRespSerializer,
ListUsersRequestSerializer,
ListUsersResponseSerializer,
NamespaceSerializer,
Expand Down Expand Up @@ -635,3 +636,12 @@ def perform_request(self, validated_request_data):
settings.FETCH_INSTANCE_USERNAME, system.provider_config["token"]
),
}


class ListAllTags(Meta, Resource):
name = gettext_lazy("获取所有标签")
ResponseSerializer = ListAllTagsRespSerializer
many_response_data = True

def perform_request(self, validated_request_data):
return Tag.objects.all()
10 changes: 10 additions & 0 deletions src/backend/apps/meta/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,3 +371,13 @@ class GetAssetPullInfoRequestSerializer(serializers.Serializer):

system_id = serializers.CharField(label=gettext_lazy("系统ID"))
resource_type_id = serializers.CharField(label=gettext_lazy("资源类型ID"))


class ListAllTagsRespSerializer(serializers.ModelSerializer):
"""
List All Tags Response
"""

class Meta:
model = Tag
fields = ["tag_id", "tag_name"]
2 changes: 2 additions & 0 deletions src/backend/apps/meta/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
namespace_views,
paas_views,
system_views,
tag_views,
user_manage_views,
)

Expand All @@ -46,6 +47,7 @@
router.register_module(system_views)
router.register_module(paas_views)
router.register_module(user_manage_views)
router.register_module(tag_views)

urlpatterns = [
path("", include(base_router.urls)),
Expand Down
25 changes: 25 additions & 0 deletions src/backend/apps/meta/views/tag_views.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making
蓝鲸智云 - 审计中心 (BlueKing - Audit Center) available.
Copyright (C) 2023 THL A29 Limited,
a Tencent company. All rights reserved.
Licensed under the MIT License (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://opensource.org/licenses/MIT
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the License for the
specific language governing permissions and limitations under the License.
We undertake not to change the open source license (MIT license) applicable
to the current version of the project delivered to anyone in the future.
"""
from bk_resource import resource
from bk_resource.viewsets import ResourceRoute, ResourceViewSet


class TagViewSet(ResourceViewSet):
resource_routes = [
ResourceRoute("GET", resource.meta.list_all_tags),
]
Binary file modified src/backend/locale/en/LC_MESSAGES/django.mo
Binary file not shown.
5 changes: 4 additions & 1 deletion src/backend/locale/en/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-22 10:00+0800\n"
"POT-Creation-Date: 2025-01-23 14:36+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -1251,6 +1251,9 @@ msgstr "Save Tags"
msgid "获取资源拉取信息"
msgstr "Get Asset Pull Info"

msgid "获取所有标签"
msgstr "List All Tags"

msgid "搜索关键字"
msgstr "Search Keyword"

Expand Down
Binary file modified src/backend/locale/zh_CN/LC_MESSAGES/django.mo
Binary file not shown.
5 changes: 4 additions & 1 deletion src/backend/locale/zh_CN/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-01-22 10:00+0800\n"
"POT-Creation-Date: 2025-01-23 14:36+0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
Expand Down Expand Up @@ -1251,6 +1251,9 @@ msgstr "保存标签"
msgid "获取资源拉取信息"
msgstr "获取资源拉取信息"

msgid "获取所有标签"
msgstr "获取所有标签"

msgid "搜索关键字"
msgstr "搜索关键字"

Expand Down

0 comments on commit 0ddb786

Please sign in to comment.