From 8c839784fb10f203a69479e23c78462579994fcc Mon Sep 17 00:00:00 2001 From: ibuler Date: Wed, 15 Jun 2022 15:13:51 +0800 Subject: [PATCH] =?UTF-8?q?pref:=20=E4=BC=98=E5=8C=96=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=88=B0=E8=8A=82=E7=82=B9=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/perms/tree/app.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/apps/perms/tree/app.py b/apps/perms/tree/app.py index 0b74c1e9b..6a6d6c74f 100644 --- a/apps/perms/tree/app.py +++ b/apps/perms/tree/app.py @@ -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)