-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes for problems when executing batch actions #574
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -138,7 +138,18 @@ | |
}; | ||
|
||
$scope.changeTasksState = function (state) { | ||
var gids = $rootScope.taskContext.getSelectedTaskIds(); | ||
var tasks = $rootScope.taskContext.getSelectedTasks(); | ||
var gids = []; | ||
|
||
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. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. use |
||
gids.push(task.gid) | ||
}else if (state == 'pause' && task.status != 'paused'){ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. format your code, missing two space |
||
gids.push(task.gid); | ||
} | ||
} | ||
|
||
if (!gids || gids.length < 1) { | ||
return; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -338,12 +338,11 @@ | |
|
||
for (var i = 0; i < context.gids.length; i++) { | ||
contexts.push({ | ||
silent: !!context.silent, | ||
gid: context.gids[i] | ||
'methodName': 'aria2.forceRemove', 'params': [context.gids[i]] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you can modify the variable name of the same below |
||
}); | ||
} | ||
|
||
return invokeMulti(this.forceRemove, contexts, context.callback); | ||
return this.multicall({'methods': contexts}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the data structure in callback result may be different, you may need to modify the code in |
||
}, | ||
pause: function (context, returnContextOnly) { | ||
return invoke(buildRequestContext('pause', context, context.gid), !!returnContextOnly); | ||
|
@@ -359,12 +358,11 @@ | |
|
||
for (var i = 0; i < context.gids.length; i++) { | ||
contexts.push({ | ||
silent: !!context.silent, | ||
gid: context.gids[i] | ||
'methodName': 'aria2.forcePause', 'params': [context.gids[i]] | ||
}); | ||
} | ||
|
||
return invokeMulti(this.forcePause, contexts, context.callback); | ||
return this.multicall({'methods': contexts}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you may need to modify the code in |
||
}, | ||
forcePauseAll: function (context, returnContextOnly) { | ||
return invoke(buildRequestContext('forcePauseAll', context), !!returnContextOnly); | ||
|
@@ -377,12 +375,11 @@ | |
|
||
for (var i = 0; i < context.gids.length; i++) { | ||
contexts.push({ | ||
silent: !!context.silent, | ||
gid: context.gids[i] | ||
'methodName': 'aria2.unpause', 'params': [context.gids[i]] | ||
}); | ||
} | ||
|
||
return invokeMulti(this.unpause, contexts, context.callback); | ||
return this.multicall({'methods': contexts}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you may need to modify the code in main.js(Line 158-174) |
||
}, | ||
unpauseAll: function (context, returnContextOnly) { | ||
return invoke(buildRequestContext('unpauseAll', context), !!returnContextOnly); | ||
|
@@ -455,12 +452,11 @@ | |
|
||
for (var i = 0; i < context.gids.length; i++) { | ||
contexts.push({ | ||
silent: !!context.silent, | ||
gid: context.gids[i] | ||
'methodName': 'aria2.removeDownloadResult', 'params': [context.gids[i]] | ||
}); | ||
} | ||
|
||
return invokeMulti(this.removeDownloadResult, contexts, context.callback); | ||
return this.multicall({'methods': contexts}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you may need to modify the code in ariaTaskService.js(Line 843-845) |
||
}, | ||
getVersion: function (context, returnContextOnly) { | ||
return invoke(buildRequestContext('getVersion', context), !!returnContextOnly); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use
var index
to replacelet index
. AriaNg also supports old browser that may not supportlet
.