mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-07-06 11:36:32 +00:00
[Update] 不选择节点默认导出所有
This commit is contained in:
parent
7ddf7f2a79
commit
00928dd46d
@ -451,10 +451,11 @@ $(document).ready(function(){
|
|||||||
$.each(rows, function (index, obj) {
|
$.each(rows, function (index, obj) {
|
||||||
assets.push(obj.id)
|
assets.push(obj.id)
|
||||||
});
|
});
|
||||||
|
var _node_id = current_node ? current_node : null;
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "{% url "assets:asset-export" %}",
|
url: "{% url "assets:asset-export" %}",
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
data: JSON.stringify({assets_id: assets, node_id: current_node.node_id}),
|
data: JSON.stringify({assets_id: assets, node_id: _node_id}),
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data, textStatus) {
|
success: function (data, textStatus) {
|
||||||
window.open(data.redirect)
|
window.open(data.redirect)
|
||||||
|
@ -214,13 +214,13 @@ class AssetExportView(LoginRequiredMixin, 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)
|
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:
|
if not assets_id:
|
||||||
assets_node = get_object_or_none(Node, id=assets_node_id)
|
node = get_object_or_none(Node, id=node_id) if node_id else Node.root()
|
||||||
assets = assets_node.get_all_assets()
|
assets = node.get_all_assets()
|
||||||
for asset in assets:
|
for asset in assets:
|
||||||
assets_id.append(asset.id)
|
assets_id.append(asset.id)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user