Fixes for problems when executing batch actions#574
Fixes for problems when executing batch actions#574Gongui wants to merge 2 commits intomayswind:masterfrom
Conversation
…he task is current state
| var gids = []; | ||
|
|
||
| var task = null; | ||
| for (let index = 0; index < tasks.length; index++) { |
There was a problem hiding this comment.
use var index to replace let index. AriaNg also supports old browser that may not support let.
| task = tasks[index]; | ||
| if (state == 'start' && task.status != 'active' && task.status != 'waiting') { | ||
| gids.push(task.gid) | ||
| }else if (state == 'pause' && task.status != 'paused'){ |
There was a problem hiding this comment.
format your code, missing two space
} else if (...
... !='paused') {
| var task = null; | ||
| for (let index = 0; index < tasks.length; index++) { | ||
| task = tasks[index]; | ||
| if (state == 'start' && task.status != 'active' && task.status != 'waiting') { |
There was a problem hiding this comment.
use === instead of ==, !== instead of !=
| contexts.push({ | ||
| silent: !!context.silent, | ||
| gid: context.gids[i] | ||
| 'methodName': 'aria2.forceRemove', 'params': [context.gids[i]] |
There was a problem hiding this comment.
you can modify the variable name of contexts to methods, and it is more readable methods.push(this.forceRemove({ gid: context.gids[i] }, true))
the same below
| } | ||
|
|
||
| return invokeMulti(this.forceRemove, contexts, context.callback); | ||
| return this.multicall({'methods': contexts}); |
There was a problem hiding this comment.
return this.multicall({
methods: methods,
silent: !!context.silent
});
There was a problem hiding this comment.
the data structure in callback result may be different, you may need to modify the code in ariaTaskService.js(Line 831-833)
| } | ||
|
|
||
| return invokeMulti(this.forcePause, contexts, context.callback); | ||
| return this.multicall({'methods': contexts}); |
There was a problem hiding this comment.
you may need to modify the code in main.js(Line 158-174)
| } | ||
|
|
||
| return invokeMulti(this.unpause, contexts, context.callback); | ||
| return this.multicall({'methods': contexts}); |
There was a problem hiding this comment.
you may need to modify the code in main.js(Line 158-174)
| } | ||
|
|
||
| return invokeMulti(this.removeDownloadResult, contexts, context.callback); | ||
| return this.multicall({'methods': contexts}); |
There was a problem hiding this comment.
you may need to modify the code in ariaTaskService.js(Line 843-845)
Fixes for problems 1 and 2 reported on issue #573