cancelDownloads
This commit is contained in:
parent
e4ca454c41
commit
30357763e8
3 changed files with 20 additions and 15 deletions
|
@ -169,11 +169,12 @@ def download(request):
|
|||
actions.register(download, cache=False)
|
||||
|
||||
@returns_json
|
||||
def cancelDownload(request):
|
||||
def cancelDownloads(request):
|
||||
response = {}
|
||||
data = json.loads(request.form['data']) if 'data' in request.form else {}
|
||||
item = models.Item.get(data['id'])
|
||||
if item:
|
||||
ids = data['ids']
|
||||
if ids:
|
||||
for item in models.Item.query.filter(models.Item.id.in_(ids)):
|
||||
item.transferprogress = None
|
||||
item.transferadded = None
|
||||
p = state.user()
|
||||
|
@ -184,7 +185,7 @@ def cancelDownload(request):
|
|||
item.update()
|
||||
response = {'status': 'cancelled'}
|
||||
return response
|
||||
actions.register(cancelDownload, cache=False)
|
||||
actions.register(cancelDownloads, cache=False)
|
||||
|
||||
@returns_json
|
||||
def scan(request):
|
||||
|
|
|
@ -99,6 +99,5 @@ def api_cancelPeering(app, user_id, message):
|
|||
user.info['message'] = message
|
||||
user.update_peering(False)
|
||||
trigger_event('peering', user.json())
|
||||
user.peered = False
|
||||
return True
|
||||
return False
|
||||
|
|
|
@ -65,7 +65,12 @@ oml.ui.transfersDialog = function() {
|
|||
})
|
||||
.bindEvent({
|
||||
click: function() {
|
||||
// ...
|
||||
var ids = $list.options('selected');
|
||||
ids && ids.length && oml.api.cancelDownloads({
|
||||
ids: ids
|
||||
}, function() {
|
||||
$list.reloadList(true);
|
||||
});
|
||||
}
|
||||
})
|
||||
.appendTo($item),
|
||||
|
|
Loading…
Reference in a new issue