support select task files
This commit is contained in:
parent
75e420622d
commit
320165515c
|
@ -102,6 +102,27 @@
|
|||
return ariaNgSettingService.getFileListDisplayOrder();
|
||||
};
|
||||
|
||||
$scope.setSelectedFile = function () {
|
||||
if (!$scope.task || !$scope.task.files) {
|
||||
return;
|
||||
}
|
||||
|
||||
var gid = $scope.task.gid;
|
||||
var selectedFileIndex = [];
|
||||
|
||||
for (var i = 0; i < $scope.task.files.length; i++) {
|
||||
var file = $scope.task.files[i];
|
||||
|
||||
if (file && file.selected) {
|
||||
selectedFileIndex.push(file.index);
|
||||
}
|
||||
}
|
||||
|
||||
return aria2TaskService.selectTaskFile(gid, selectedFileIndex, function () {
|
||||
refreshDownloadTask(false);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.loadTaskOption = function (task) {
|
||||
$rootScope.loadPromise = aria2TaskService.getTaskOptions(task.gid, function (result) {
|
||||
$scope.options = result;
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
var file = task.files[i];
|
||||
file.fileName = getFileNameFromPath(file.path);
|
||||
file.length = parseInt(file.length);
|
||||
file.selected = (file.selected == 'true');
|
||||
file.completedLength = parseInt(file.completedLength);
|
||||
file.completePercent = (file.length > 0 ? file.completedLength / file.length * 100 : 0);
|
||||
}
|
||||
|
@ -150,6 +151,19 @@
|
|||
callback: callback
|
||||
});
|
||||
},
|
||||
selectTaskFile: function (gid, selectedFileIndexArr, callback) {
|
||||
var selectedFileIndex = '';
|
||||
|
||||
for (var i = 0; i < selectedFileIndexArr.length; i++) {
|
||||
if (selectedFileIndex.length > 0) {
|
||||
selectedFileIndex += ',';
|
||||
}
|
||||
|
||||
selectedFileIndex += selectedFileIndexArr[i];
|
||||
}
|
||||
|
||||
return this.setTaskOption(gid, 'select-file', selectedFileIndex, callback);
|
||||
},
|
||||
getBtTaskPeers: function (gid, callback, silent) {
|
||||
return aria2RpcService.getPeers({
|
||||
gid: gid,
|
||||
|
|
|
@ -136,11 +136,12 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="task-table-body">
|
||||
<div class="row" ng-repeat="file in task.files | fileOrderBy: getFileListOrderType()">
|
||||
<div class="row" ng-repeat="file in task.files | fileOrderBy: getFileListOrderType()" data-file-index="{{file.index}}">
|
||||
<div class="col-sm-8">
|
||||
<div class="checkbox checkbox-primary">
|
||||
<input id="{{'file_' + $index}}" type="checkbox" ng-checked="file.selected == 'true'" disabled="disabled"/>
|
||||
<label for="{{'file_' + $index}}" ng-bind="file.fileName"></label>
|
||||
<input id="{{'file_' + file.index}}" type="checkbox" ng-disabled="!task || !task.files || task.files.length < 2 || (task.status != 'waiting' && task.status != 'paused')"
|
||||
ng-model="file.selected" ng-change="setSelectedFile()"/>
|
||||
<label for="{{'file_' + file.index}}" ng-bind="file.fileName"></label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
|
|
Reference in a new issue