mirror of https://github.com/jumpserver/jumpserver
perf: update some i18n
parent
b2f8f9d248
commit
58177fdfb0
|
@ -5,6 +5,7 @@ from rest_framework import generics
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from rest_framework.decorators import action
|
from rest_framework.decorators import action
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
|
|
||||||
from assets.const import AllTypes
|
from assets.const import AllTypes
|
||||||
from assets.models import Platform, Node, Asset, PlatformProtocol
|
from assets.models import Platform, Node, Asset, PlatformProtocol
|
||||||
from assets.serializers import PlatformSerializer, PlatformProtocolSerializer, PlatformListSerializer
|
from assets.serializers import PlatformSerializer, PlatformProtocolSerializer, PlatformListSerializer
|
||||||
|
@ -42,11 +43,16 @@ class AssetPlatformViewSet(JMSModelViewSet):
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
# 因为没有走分页逻辑,所以需要这里 prefetch
|
# 因为没有走分页逻辑,所以需要这里 prefetch
|
||||||
asset_count_subquery = Asset.objects.filter(platform=OuterRef('pk')).values('platform').annotate(
|
asset_count_subquery = (
|
||||||
count=Count('id')).values('count')
|
Asset.objects.filter(platform=OuterRef('pk'))
|
||||||
queryset = super().get_queryset().annotate(
|
.values('platform')
|
||||||
assets_amount=Coalesce(Subquery(asset_count_subquery), Value(0))).prefetch_related(
|
.annotate(count=Count('id'))
|
||||||
'protocols', 'automation', 'labels', 'labels__label'
|
.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())
|
queryset = queryset.filter(type__in=AllTypes.get_types_values())
|
||||||
return queryset
|
return queryset
|
||||||
|
|
|
@ -315,6 +315,7 @@
|
||||||
"Command": "Command",
|
"Command": "Command",
|
||||||
"CommandConfirm": "Command review",
|
"CommandConfirm": "Command review",
|
||||||
"CommandFilterACL": "Command filter ACL",
|
"CommandFilterACL": "Command filter ACL",
|
||||||
|
"CommandFilterACLs": "Command filter ACLs",
|
||||||
"CommandFilter": "Command filter",
|
"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.",
|
"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.",
|
"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.",
|
||||||
|
|
Loading…
Reference in New Issue