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
1ac30ed0
Commit
1ac30ed0
authored
Jan 31, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Feature] 使用ztree
parent
3603b33a
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
11 deletions
+10
-11
api.py
apps/assets/api.py
+9
-10
tree.html
apps/assets/templates/assets/tree.html
+0
-0
tree.py
apps/assets/views/tree.py
+1
-1
No files found.
apps/assets/api.py
View file @
1ac30ed0
...
...
@@ -319,13 +319,13 @@ class TreeViewApi(APIView):
def
get
(
self
,
request
):
data
=
[]
for
node
in
self
.
get_queryset
():
if
node
.
id
==
"0"
:
parent
=
"#"
else
:
parent
=
":"
.
join
(
node
.
id
.
split
(
":"
)[:
-
1
])
data
.
append
({
parent
=
":"
.
join
(
node
.
id
.
split
(
":"
)[:
-
1
])
d
=
{
"id"
:
node
.
id
,
"parent"
:
parent
,
"text"
:
node
.
name
})
return
Response
(
data
)
\ No newline at end of file
"pId"
:
parent
,
"name"
:
node
.
name
}
if
node
.
id
==
"0"
:
d
[
"open"
]
=
True
data
.
append
(
d
)
return
Response
(
data
)
apps/assets/templates/assets/tree.html
View file @
1ac30ed0
This diff is collapsed.
Click to expand it.
apps/assets/views/tree.py
View file @
1ac30ed0
...
...
@@ -16,7 +16,7 @@ class TreeView(AdminUserRequiredMixin, TemplateView):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
'app'
:
_
(
'Assets'
),
'action'
:
_
(
'Tree
View
view'
),
'action'
:
_
(
'Tree view'
),
}
kwargs
.
update
(
context
)
return
super
()
.
get_context_data
(
**
kwargs
)
...
...
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