pref: app tree 添加 icon

pull/8340/head
ibuler 3 years ago committed by 老广
parent 3bc307d666
commit e096244e75

@ -128,6 +128,7 @@ class GrantedNodeChildrenWithAssetsAsTreeApiMixin(SerializeToTreeNodeMixin,
nodes = PermNode.objects.none()
assets = Asset.objects.none()
all_tree_nodes = []
if not key:
nodes = nodes_query_utils.get_top_level_nodes()
@ -142,7 +143,9 @@ class GrantedNodeChildrenWithAssetsAsTreeApiMixin(SerializeToTreeNodeMixin,
tree_nodes = self.serialize_nodes(nodes, with_asset_amount=True)
tree_assets = self.serialize_assets(assets, key)
return Response(data=[*tree_nodes, *tree_assets])
all_tree_nodes.extend(tree_nodes)
all_tree_nodes.extend(tree_assets)
return Response(data=all_tree_nodes)
class UserGrantedNodeChildrenWithAssetsAsTreeApi(AssetRoleAdminMixin, GrantedNodeChildrenWithAssetsAsTreeApiMixin):

@ -28,6 +28,7 @@ class GrantedAppTreeUtil:
'title': name,
'pId': '',
'open': True,
'iconSkin': 'applications',
'isParent': True,
'meta': {
'type': 'root'

@ -5,6 +5,7 @@ import time
from django.core.cache import cache
from django.conf import settings
from django.db.models import Q, QuerySet
from django.utils.translation import gettext as _
from common.db.models import output_as_string, UnionQuerySet
from common.utils.common import lazyproperty, timeit
@ -614,6 +615,22 @@ class UserGrantedNodesQueryUtils(UserGrantedUtilsBase):
assets_amount = assets_query_utils.get_favorite_assets().values_list('id').count()
return PermNode.get_favorite_node(assets_amount)
@staticmethod
def get_root_node():
name = _('My assets')
node = {
'id': '',
'name': name,
'title': name,
'pId': '',
'open': True,
'isParent': True,
'meta': {
'type': 'root'
}
}
return node
def get_special_nodes(self):
nodes = []
if settings.PERM_SINGLE_ASSET_TO_UNGROUP_NODE:

Loading…
Cancel
Save