pref: 优化没有获取到节点的问题

pull/8410/head
ibuler 2022-06-15 15:13:51 +08:00 committed by Jiangjie.Bai
parent 10adb4e6b7
commit 8c839784fb
1 changed files with 17 additions and 1 deletions

View File

@ -36,6 +36,22 @@ class GrantedAppTreeUtil:
})
return node
@staticmethod
def create_empty_node():
name = _("Empty")
node = TreeNode(**{
'id': 'empty',
'name': name,
'title': name,
'pId': '',
'isParent': True,
'children': [],
'meta': {
'type': 'application'
}
})
return node
@staticmethod
def get_children_nodes(tree_id, parent_info, user):
tree_nodes = []
@ -61,7 +77,7 @@ class GrantedAppTreeUtil:
def create_tree_nodes(self, applications):
tree_nodes = []
if not applications:
return tree_nodes
return [self.create_empty_node()]
root_node = self.create_root_node()
organizations = self.filter_organizations(applications)