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
ef02b1f8
Commit
ef02b1f8
authored
Dec 25, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改bug
parent
a9900987
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
6 deletions
+9
-6
signals_handler.py
apps/assets/signals_handler.py
+5
-2
asset_list.html
apps/assets/templates/assets/asset_list.html
+4
-4
No files found.
apps/assets/signals_handler.py
View file @
ef02b1f8
...
...
@@ -74,8 +74,11 @@ def on_system_user_assets_change(sender, instance=None, **kwargs):
@receiver
(
m2m_changed
,
sender
=
Asset
.
nodes
.
through
)
def
on_asset_node_changed
(
sender
,
instance
=
None
,
**
kwargs
):
logger
.
debug
(
"Asset node change signal received"
)
logger
.
debug
(
"Asset node
s
change signal received"
)
if
isinstance
(
instance
,
Asset
):
if
kwargs
[
'action'
]
==
'pre_remove'
:
nodes
=
kwargs
[
'model'
]
.
objects
.
filter
(
pk__in
=
kwargs
[
'pk_set'
])
Node
.
expire_nodes_assets_amount
(
nodes
)
if
kwargs
[
'action'
]
==
'post_add'
:
nodes
=
kwargs
[
'model'
]
.
objects
.
filter
(
pk__in
=
kwargs
[
'pk_set'
])
Node
.
expire_nodes_assets_amount
(
nodes
)
...
...
@@ -91,7 +94,7 @@ def on_asset_node_changed(sender, instance=None, **kwargs):
@receiver
(
m2m_changed
,
sender
=
Asset
.
nodes
.
through
)
def
on_node_assets_changed
(
sender
,
instance
=
None
,
**
kwargs
):
if
isinstance
(
instance
,
Node
):
logger
.
debug
(
"Node assets change signal
received"
)
logger
.
debug
(
"Node assets change signal
{} received"
.
format
(
instance
)
)
# 当节点和资产关系发生改变时,过期资产数量缓存
instance
.
expire_assets_amount
()
assets
=
kwargs
[
'model'
]
.
objects
.
filter
(
pk__in
=
kwargs
[
'pk_set'
])
...
...
apps/assets/templates/assets/asset_list.html
View file @
ef02b1f8
...
...
@@ -345,10 +345,10 @@ function beforeDrag() {
function
beforeDrop
(
treeId
,
treeNodes
,
targetNode
,
moveType
)
{
var
treeNodesNames
=
[];
$
.
each
(
treeNodes
,
function
(
index
,
value
)
{
treeNodesNames
.
push
(
value
.
valu
e
);
treeNodesNames
.
push
(
value
.
nam
e
);
});
var
msg
=
"你想移动节点: `"
+
treeNodesNames
.
join
(
","
)
+
"` 到 `"
+
targetNode
.
valu
e
+
"` 下吗?"
;
var
msg
=
"你想移动节点: `"
+
treeNodesNames
.
join
(
","
)
+
"` 到 `"
+
targetNode
.
nam
e
+
"` 下吗?"
;
return
confirm
(
msg
);
}
...
...
@@ -358,10 +358,10 @@ function onDrag(event, treeId, treeNodes) {
function
onDrop
(
event
,
treeId
,
treeNodes
,
targetNode
,
moveType
)
{
var
treeNodesIds
=
[];
$
.
each
(
treeNodes
,
function
(
index
,
value
)
{
treeNodesIds
.
push
(
value
.
node_
id
);
treeNodesIds
.
push
(
value
.
meta
.
node
.
id
);
});
var
the_url
=
"{% url 'api-assets:node-add-children' pk=DEFAULT_PK %}"
.
replace
(
"{{ DEFAULT_PK }}"
,
targetNode
.
node_
id
);
var
the_url
=
"{% url 'api-assets:node-add-children' pk=DEFAULT_PK %}"
.
replace
(
"{{ DEFAULT_PK }}"
,
targetNode
.
meta
.
node
.
id
);
var
body
=
{
nodes
:
treeNodesIds
};
APIUpdateAttr
({
url
:
the_url
,
...
...
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