mirror of https://github.com/jumpserver/jumpserver
[Update] 不选择节点默认导出所有
parent
7ddf7f2a79
commit
00928dd46d
|
@ -451,10 +451,11 @@ $(document).ready(function(){
|
|||
$.each(rows, function (index, obj) {
|
||||
assets.push(obj.id)
|
||||
});
|
||||
var _node_id = current_node ? current_node : null;
|
||||
$.ajax({
|
||||
url: "{% url "assets:asset-export" %}",
|
||||
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",
|
||||
success: function (data, textStatus) {
|
||||
window.open(data.redirect)
|
||||
|
|
|
@ -214,13 +214,13 @@ class AssetExportView(LoginRequiredMixin, View):
|
|||
def post(self, request, *args, **kwargs):
|
||||
try:
|
||||
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:
|
||||
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()
|
||||
if not assets_id:
|
||||
node = get_object_or_none(Node, id=node_id) if node_id else Node.root()
|
||||
assets = node.get_all_assets()
|
||||
for asset in assets:
|
||||
assets_id.append(asset.id)
|
||||
|
||||
|
|
Loading…
Reference in New Issue