Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
9f56ac8a
Unverified
Commit
9f56ac8a
authored
Sep 25, 2019
by
老广
Committed by
GitHub
Sep 25, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改可能导致的树创建问题 (#3280)
parent
a8c2a348
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
utils.py
apps/assets/utils.py
+7
-7
No files found.
apps/assets/utils.py
View file @
9f56ac8a
...
...
@@ -26,10 +26,6 @@ def get_system_user_by_id(id):
class
TreeService
(
Tree
):
tag_sep
=
' / '
cache_key
=
'_NODE_FULL_TREE'
cache_time
=
3600
has_empty_node
=
False
has_ungrouped_node
=
False
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
...
...
@@ -43,13 +39,17 @@ class TreeService(Tree):
from
orgs.utils
import
tmp_to_root_org
with
tmp_to_root_org
():
all_nodes
=
Node
.
objects
.
all
()
all_nodes
=
list
(
Node
.
objects
.
all
()
.
values
(
"key"
,
"value"
))
all_nodes
.
sort
(
key
=
lambda
x
:
len
(
x
[
"key"
]
.
split
(
":"
)))
tree
=
cls
()
tree
.
create_node
(
tag
=
''
,
identifier
=
''
)
for
node
in
all_nodes
:
key
=
node
[
"key"
]
value
=
node
[
"value"
]
parent_key
=
":"
.
join
(
key
.
split
(
":"
)[:
-
1
])
tree
.
create_node
(
tag
=
node
.
value
,
identifier
=
node
.
key
,
parent
=
node
.
parent_key
,
tag
=
value
,
identifier
=
key
,
parent
=
parent_key
,
)
tree
.
init_assets
()
return
tree
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment