mirror of https://github.com/jumpserver/jumpserver
[Update] 优化节点
parent
dc4ee2f0fa
commit
bab4326aeb
|
@ -402,7 +402,7 @@ class Node(OrgModelMixin, FamilyMixin, FullValueMixin, AssetsAmountMixin):
|
||||||
def get_queryset(cls):
|
def get_queryset(cls):
|
||||||
from ..utils import NodeUtil
|
from ..utils import NodeUtil
|
||||||
util = NodeUtil()
|
util = NodeUtil()
|
||||||
return util.nodes
|
return sorted(util.nodes)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def generate_fake(cls, count=100):
|
def generate_fake(cls, count=100):
|
||||||
|
|
|
@ -78,13 +78,10 @@ class AdminUserDetailView(PermissionsMixin, DetailView):
|
||||||
permission_classes = [IsOrgAdmin]
|
permission_classes = [IsOrgAdmin]
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
from ..utils import NodeUtil
|
|
||||||
nodes = Node.objects.all()
|
|
||||||
util = NodeUtil()
|
|
||||||
context = {
|
context = {
|
||||||
'app': _('Assets'),
|
'app': _('Assets'),
|
||||||
'action': _('Admin user detail'),
|
'action': _('Admin user detail'),
|
||||||
'nodes': util.get_nodes_by_queryset(queryset=nodes),
|
'nodes': Node.get_queryset(),
|
||||||
}
|
}
|
||||||
kwargs.update(context)
|
kwargs.update(context)
|
||||||
return super().get_context_data(**kwargs)
|
return super().get_context_data(**kwargs)
|
||||||
|
|
|
@ -74,10 +74,11 @@ class SystemUserDetailView(PermissionsMixin, DetailView):
|
||||||
permission_classes = [IsOrgAdmin]
|
permission_classes = [IsOrgAdmin]
|
||||||
|
|
||||||
def get_context_data(self, **kwargs):
|
def get_context_data(self, **kwargs):
|
||||||
|
cmd_filters_remain = CommandFilter.objects.exclude(system_users=self.object)
|
||||||
context = {
|
context = {
|
||||||
'app': _('Assets'),
|
'app': _('Assets'),
|
||||||
'action': _('System user detail'),
|
'action': _('System user detail'),
|
||||||
'cmd_filters_remain': CommandFilter.objects.exclude(system_users=self.object)
|
'cmd_filters_remain': cmd_filters_remain,
|
||||||
}
|
}
|
||||||
kwargs.update(context)
|
kwargs.update(context)
|
||||||
return super().get_context_data(**kwargs)
|
return super().get_context_data(**kwargs)
|
||||||
|
|
Loading…
Reference in New Issue