mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-06-27 15:27:11 +00:00
perf: Asset filter
This commit is contained in:
parent
9b1bff0847
commit
631570b819
@ -173,7 +173,8 @@ class AssetViewSet(SuggestionMixin, BaseAssetViewSet):
|
||||
|
||||
@action(methods=["GET"], detail=True, url_path="accounts")
|
||||
def accounts(self, *args, **kwargs):
|
||||
asset = super().get_object()
|
||||
pk = self.kwargs.get("pk")
|
||||
asset = get_object_or_404(self.model, pk=pk)
|
||||
queryset = asset.all_accounts.all()
|
||||
return self.get_paginated_response_from_queryset(queryset)
|
||||
|
||||
|
@ -261,7 +261,7 @@ class Asset(NodesRelationMixin, LabeledMixin, AbsConnectivity, JSONFilterMixin,
|
||||
|
||||
@lazyproperty
|
||||
def accounts_amount(self):
|
||||
return self.accounts.count()
|
||||
return self.all_accounts.count()
|
||||
|
||||
def get_target_ip(self):
|
||||
return self.address
|
||||
|
Loading…
Reference in New Issue
Block a user