mirror of https://github.com/jumpserver/jumpserver
feat: Support asset tree node drag to another one
parent
9b20b67039
commit
42054c7989
|
@ -22,6 +22,7 @@ from orgs.utils import current_org
|
|||
from rbac.permissions import RBACPermission
|
||||
from .. import serializers
|
||||
from ..models import Node
|
||||
from ..signal_handlers import update_nodes_assets_amount
|
||||
from ..tasks import (
|
||||
update_node_assets_hardware_info_manual,
|
||||
test_node_assets_connectivity_manual,
|
||||
|
@ -94,6 +95,7 @@ class NodeAddChildrenApi(generics.UpdateAPIView):
|
|||
children = Node.objects.filter(id__in=node_ids)
|
||||
for node in children:
|
||||
node.parent = instance
|
||||
update_nodes_assets_amount.delay(ttl=5, node_ids=(instance.id,))
|
||||
return Response("OK")
|
||||
|
||||
|
||||
|
|
|
@ -204,6 +204,8 @@ def merge_delay_run(ttl=5, key=None):
|
|||
|
||||
def delay(func, *args, **kwargs):
|
||||
from orgs.utils import get_current_org
|
||||
# 每次调用 delay 时可以指定本次调用的 ttl
|
||||
current_ttl = kwargs.pop('ttl', ttl)
|
||||
suffix_key_func = key if key else default_suffix_key
|
||||
org = get_current_org()
|
||||
func_name = f'{func.__module__}_{func.__name__}'
|
||||
|
@ -220,7 +222,7 @@ def merge_delay_run(ttl=5, key=None):
|
|||
else:
|
||||
cache_kwargs[k] = cache_kwargs[k].union(v)
|
||||
_loop_debouncer_func_args_cache[cache_key] = cache_kwargs
|
||||
run_debouncer_func(cache_key, org, ttl, func, *args, **cache_kwargs)
|
||||
run_debouncer_func(cache_key, org, current_ttl, func, *args, **cache_kwargs)
|
||||
|
||||
def apply(func, sync=False, *args, **kwargs):
|
||||
if sync:
|
||||
|
|
Loading…
Reference in New Issue