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
4fa72400
Commit
4fa72400
authored
Apr 06, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'github/dev' into dev
parents
37c0062f
8504c3d2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
asset_list.html
apps/assets/templates/assets/asset_list.html
+6
-3
asset.py
apps/assets/views/asset.py
+8
-0
No files found.
apps/assets/templates/assets/asset_list.html
View file @
4fa72400
...
@@ -182,7 +182,6 @@ function initTable() {
...
@@ -182,7 +182,6 @@ function initTable() {
return
asset_table
return
asset_table
}
}
function
addTreeNode
()
{
function
addTreeNode
()
{
hideRMenu
();
hideRMenu
();
var
parentNode
=
zTree
.
getSelectedNodes
()[
0
];
var
parentNode
=
zTree
.
getSelectedNodes
()[
0
];
...
@@ -238,7 +237,6 @@ function editTreeNode() {
...
@@ -238,7 +237,6 @@ function editTreeNode() {
zTree
.
editName
(
current_node
);
zTree
.
editName
(
current_node
);
}
}
function
OnRightClick
(
event
,
treeId
,
treeNode
)
{
function
OnRightClick
(
event
,
treeId
,
treeNode
)
{
if
(
!
treeNode
&&
event
.
target
.
tagName
.
toLowerCase
()
!==
"button"
&&
$
(
event
.
target
).
parents
(
"a"
).
length
===
0
)
{
if
(
!
treeNode
&&
event
.
target
.
tagName
.
toLowerCase
()
!==
"button"
&&
$
(
event
.
target
).
parents
(
"a"
).
length
===
0
)
{
zTree
.
cancelSelectedNode
();
zTree
.
cancelSelectedNode
();
...
@@ -432,6 +430,11 @@ $(document).ready(function(){
...
@@ -432,6 +430,11 @@ $(document).ready(function(){
.
on
(
'click'
,
'.btn_export'
,
function
()
{
.
on
(
'click'
,
'.btn_export'
,
function
()
{
var
$data_table
=
$
(
'#asset_list_table'
).
DataTable
();
var
$data_table
=
$
(
'#asset_list_table'
).
DataTable
();
var
rows
=
$data_table
.
rows
(
'.selected'
).
data
();
var
rows
=
$data_table
.
rows
(
'.selected'
).
data
();
var
nodes
=
zTree
.
getSelectedNodes
();
var
current_node
;
if
(
nodes
&&
nodes
.
length
===
1
)
{
current_node
=
nodes
[
0
];
}
var
assets
=
[];
var
assets
=
[];
$
.
each
(
rows
,
function
(
index
,
obj
)
{
$
.
each
(
rows
,
function
(
index
,
obj
)
{
assets
.
push
(
obj
.
id
)
assets
.
push
(
obj
.
id
)
...
@@ -439,7 +442,7 @@ $(document).ready(function(){
...
@@ -439,7 +442,7 @@ $(document).ready(function(){
$
.
ajax
({
$
.
ajax
({
url
:
"{% url "
assets
:
asset
-
export
" %}"
,
url
:
"{% url "
assets
:
asset
-
export
" %}"
,
method
:
'POST'
,
method
:
'POST'
,
data
:
JSON
.
stringify
({
assets_id
:
assets
}),
data
:
JSON
.
stringify
({
assets_id
:
assets
,
node_id
:
current_node
.
id
}),
dataType
:
"json"
,
dataType
:
"json"
,
success
:
function
(
data
,
textStatus
)
{
success
:
function
(
data
,
textStatus
)
{
window
.
open
(
data
.
redirect
)
window
.
open
(
data
.
redirect
)
...
...
apps/assets/views/asset.py
View file @
4fa72400
...
@@ -233,8 +233,16 @@ class AssetExportView(View):
...
@@ -233,8 +233,16 @@ class AssetExportView(View):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
try
:
try
:
assets_id
=
json
.
loads
(
request
.
body
)
.
get
(
'assets_id'
,
[])
assets_id
=
json
.
loads
(
request
.
body
)
.
get
(
'assets_id'
,
[])
assets_node_id
=
json
.
loads
(
request
.
body
)
.
get
(
'node_id'
,
None
)
except
ValueError
:
except
ValueError
:
return
HttpResponse
(
'Json object not valid'
,
status
=
400
)
return
HttpResponse
(
'Json object not valid'
,
status
=
400
)
if
not
assets_id
and
assets_node_id
:
assets_node
=
get_object_or_none
(
Node
,
id
=
assets_node_id
)
assets
=
assets_node
.
get_all_assets
()
for
asset
in
assets
:
assets_id
.
append
(
asset
.
id
)
spm
=
uuid
.
uuid4
()
.
hex
spm
=
uuid
.
uuid4
()
.
hex
cache
.
set
(
spm
,
assets_id
,
300
)
cache
.
set
(
spm
,
assets_id
,
300
)
url
=
reverse_lazy
(
'assets:asset-export'
)
+
'?spm=
%
s'
%
spm
url
=
reverse_lazy
(
'assets:asset-export'
)
+
'?spm=
%
s'
%
spm
...
...
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