perf: update some i18n

pull/14968/head
ibuler 2025-03-04 15:46:45 +08:00
parent b2f8f9d248
commit 58177fdfb0
2 changed files with 12 additions and 5 deletions

View File

@ -5,6 +5,7 @@ from rest_framework import generics
from rest_framework import serializers
from rest_framework.decorators import action
from rest_framework.response import Response
from assets.const import AllTypes
from assets.models import Platform, Node, Asset, PlatformProtocol
from assets.serializers import PlatformSerializer, PlatformProtocolSerializer, PlatformListSerializer
@ -42,11 +43,16 @@ class AssetPlatformViewSet(JMSModelViewSet):
def get_queryset(self):
# 因为没有走分页逻辑,所以需要这里 prefetch
asset_count_subquery = Asset.objects.filter(platform=OuterRef('pk')).values('platform').annotate(
count=Count('id')).values('count')
queryset = super().get_queryset().annotate(
assets_amount=Coalesce(Subquery(asset_count_subquery), Value(0))).prefetch_related(
'protocols', 'automation', 'labels', 'labels__label'
asset_count_subquery = (
Asset.objects.filter(platform=OuterRef('pk'))
.values('platform')
.annotate(count=Count('id'))
.values('count')
)
queryset = (
super().get_queryset()
.annotate(assets_amount=Coalesce(Subquery(asset_count_subquery), Value(0)))
.prefetch_related('protocols', 'automation', 'labels', 'labels__label')
)
queryset = queryset.filter(type__in=AllTypes.get_types_values())
return queryset

View File

@ -315,6 +315,7 @@
"Command": "Command",
"CommandConfirm": "Command review",
"CommandFilterACL": "Command filter ACL",
"CommandFilterACLs": "Command filter ACLs",
"CommandFilter": "Command filter",
"CommandFilterACLHelpMsg": "By filtering commands, you can control if commands can be sent to assets. based on your set rules, some commands can be allowed while others are prohibited.",
"CommandFilterACLHelpText": "By filtering commands, you can control if commands can be sent to assets. based on your set rules, some commands can be allowed while others are prohibited.",