mirror of https://github.com/jumpserver/jumpserver
[Update] 修改一些bug
parent
034fee0f75
commit
4d3856975b
|
@ -130,7 +130,9 @@ class NodeChildrenAsTreeApi(generics.ListAPIView):
|
||||||
include_assets = self.request.query_params.get('assets', '0') == '1'
|
include_assets = self.request.query_params.get('assets', '0') == '1'
|
||||||
if not include_assets:
|
if not include_assets:
|
||||||
return queryset
|
return queryset
|
||||||
assets = self.node.get_assets()
|
assets = self.node.get_assets().prefetch_related("protocols").only(
|
||||||
|
"id", "hostname", "ip", 'platform', "os", "org_id",
|
||||||
|
)
|
||||||
for asset in assets:
|
for asset in assets:
|
||||||
queryset.append(asset.as_tree_node(self.node))
|
queryset.append(asset.as_tree_node(self.node))
|
||||||
return queryset
|
return queryset
|
||||||
|
|
|
@ -138,30 +138,6 @@ class AssetSerializer(BulkOrgResourceModelSerializer):
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
|
||||||
# class AssetAsNodeSerializer(serializers.ModelSerializer):
|
|
||||||
# protocols = ProtocolSerializer(many=True)
|
|
||||||
#
|
|
||||||
# class Meta:
|
|
||||||
# model = Asset
|
|
||||||
# fields = ['id', 'hostname', 'ip', 'platform', 'protocols']
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# class MyAssetGrantedSerializer(AssetGrantedSerializer):
|
|
||||||
# """
|
|
||||||
# 普通用户获取授权的资产定义的数据结构
|
|
||||||
# """
|
|
||||||
# protocols = ProtocolSerializer(many=True)
|
|
||||||
#
|
|
||||||
# class Meta:
|
|
||||||
# model = Asset
|
|
||||||
# fields = (
|
|
||||||
# "id", "hostname", "system_users_granted",
|
|
||||||
# "is_active", "system_users_join", "org_name",
|
|
||||||
# "os", "platform", "comment", "org_id", "protocols"
|
|
||||||
# )
|
|
||||||
|
|
||||||
|
|
||||||
class AssetSimpleSerializer(serializers.ModelSerializer):
|
class AssetSimpleSerializer(serializers.ModelSerializer):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -155,7 +155,9 @@ class AssetPermissionViewSet(viewsets.ModelViewSet):
|
||||||
return queryset
|
return queryset
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return self.queryset.all()
|
return self.queryset.all().prefetch_related(
|
||||||
|
"nodes", "assets", "users", "user_groups", "system_users"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class AssetPermissionRemoveUserApi(RetrieveUpdateAPIView):
|
class AssetPermissionRemoveUserApi(RetrieveUpdateAPIView):
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
# ~*~ coding: utf-8 ~*~
|
# ~*~ coding: utf-8 ~*~
|
||||||
|
|
||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
from functools import reduce
|
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
{% bootstrap_field form.system_users layout="horizontal" %}
|
{% bootstrap_field form.system_users layout="horizontal" %}
|
||||||
<div class="hr-line-dashed"></div>
|
<div class="hr-line-dashed"></div>
|
||||||
<h3>{% trans 'Action' %}</h3>
|
<h3>{% trans 'Action' %}</h3>
|
||||||
{% bootstrap_field form.action layout="horizontal" %}
|
{% bootstrap_field form.actions layout="horizontal" %}
|
||||||
<div class="hr-line-dashed"></div>
|
<div class="hr-line-dashed"></div>
|
||||||
<h3>{% trans 'Other' %}</h3>
|
<h3>{% trans 'Other' %}</h3>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
Loading…
Reference in New Issue