support selecting all completed tasks
This commit is contained in:
parent
b066fc267e
commit
e117d83e93
|
@ -24,6 +24,7 @@ Select All=全部选中
|
||||||
Select None=全部不选
|
Select None=全部不选
|
||||||
Select Invert=反向选择
|
Select Invert=反向选择
|
||||||
Select All Failed Task=全选失败任务
|
Select All Failed Task=全选失败任务
|
||||||
|
Select All Completed Tasks=全选已完成任务
|
||||||
Display Order=显示顺序
|
Display Order=显示顺序
|
||||||
Copy Download Url=复制下载链接
|
Copy Download Url=复制下载链接
|
||||||
Copy Magnet Link=复制磁力链接
|
Copy Magnet Link=复制磁力链接
|
||||||
|
|
|
@ -24,6 +24,7 @@ Select All=全部選中
|
||||||
Select None=全部不選
|
Select None=全部不選
|
||||||
Select Invert=反向選擇
|
Select Invert=反向選擇
|
||||||
Select All Failed Task=全選失敗工作
|
Select All Failed Task=全選失敗工作
|
||||||
|
Select All Completed Tasks=全選已完成工作
|
||||||
Display Order=顯示順序
|
Display Order=顯示順序
|
||||||
Copy Download Url=複製下載連結
|
Copy Download Url=複製下載連結
|
||||||
Copy Magnet Link=複製磁力連結
|
Copy Magnet Link=複製磁力連結
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
'Select None': 'Select None',
|
'Select None': 'Select None',
|
||||||
'Select Invert': 'Select Invert',
|
'Select Invert': 'Select Invert',
|
||||||
'Select All Failed Task': 'Select All Failed Task',
|
'Select All Failed Task': 'Select All Failed Task',
|
||||||
|
'Select All Completed Tasks': 'Select All Completed Tasks',
|
||||||
'Display Order': 'Display Order',
|
'Display Order': 'Display Order',
|
||||||
'Copy Download Url': 'Copy Download Url',
|
'Copy Download Url': 'Copy Download Url',
|
||||||
'Copy Magnet Link': 'Copy Magnet Link',
|
'Copy Magnet Link': 'Copy Magnet Link',
|
||||||
|
|
|
@ -202,6 +202,10 @@
|
||||||
return $rootScope.taskContext.hasRetryableTask();
|
return $rootScope.taskContext.hasRetryableTask();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.hasCompletedTask = function () {
|
||||||
|
return $rootScope.taskContext.hasCompletedTask();
|
||||||
|
};
|
||||||
|
|
||||||
$scope.isSelectedTaskRetryable = function () {
|
$scope.isSelectedTaskRetryable = function () {
|
||||||
var selectedTasks = $rootScope.taskContext.getSelectedTasks();
|
var selectedTasks = $rootScope.taskContext.getSelectedTasks();
|
||||||
|
|
||||||
|
@ -327,6 +331,10 @@
|
||||||
$rootScope.taskContext.selectAllFailed();
|
$rootScope.taskContext.selectAllFailed();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.selectAllCompletedTasks = function () {
|
||||||
|
$rootScope.taskContext.selectAllCompleted();
|
||||||
|
};
|
||||||
|
|
||||||
$scope.copySelectedOneTaskDownloadLink = function () {
|
$scope.copySelectedOneTaskDownloadLink = function () {
|
||||||
var selectedTasks = $rootScope.taskContext.getSelectedTasks();
|
var selectedTasks = $rootScope.taskContext.getSelectedTasks();
|
||||||
|
|
||||||
|
|
|
@ -166,6 +166,21 @@
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
hasCompletedTask: function () {
|
||||||
|
for (var i = 0; i < this.list.length; i++) {
|
||||||
|
var task = this.list[i];
|
||||||
|
|
||||||
|
if (!$rootScope.filterTask(task)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (task.status === 'complete') {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
},
|
||||||
selectAll: function () {
|
selectAll: function () {
|
||||||
if (!this.list || !this.selected || this.list.length < 1) {
|
if (!this.list || !this.selected || this.list.length < 1) {
|
||||||
return;
|
return;
|
||||||
|
@ -226,6 +241,48 @@
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.selected[task.gid] = !isAllFailedSelected;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
selectAllCompleted: function () {
|
||||||
|
if (!this.list || !this.selected || this.list.length < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.enableSelectAll) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var isAllFailedSelected = true;
|
||||||
|
|
||||||
|
for (var i = 0; i < this.list.length; i++) {
|
||||||
|
var task = this.list[i];
|
||||||
|
|
||||||
|
if (!$rootScope.filterTask(task)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (task.status !== 'complete') {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.selected[task.gid]) {
|
||||||
|
isAllFailedSelected = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var i = 0; i < this.list.length; i++) {
|
||||||
|
var task = this.list[i];
|
||||||
|
|
||||||
|
if (!$rootScope.filterTask(task)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (task.status !== 'complete') {
|
||||||
|
this.selected[task.gid] = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
this.selected[task.gid] = !isAllFailedSelected;
|
this.selected[task.gid] = !isAllFailedSelected;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,6 +164,12 @@
|
||||||
<span translate>Select All Failed Task</span>
|
<span translate>Select All Failed Task</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li ng-if="hasCompletedTask()">
|
||||||
|
<a tabindex="-1" class="pointer-cursor" title="{{'Select All Completed Tasks' | translate}}" ng-click="selectAllCompletedTasks()">
|
||||||
|
<i class="fa fa-fw"></i>
|
||||||
|
<span translate>Select All Completed Tasks</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a tabindex="-1" class="pointer-cursor" title="{{'Select All' | translate}}" ng-click="selectAllTasks()">
|
<a tabindex="-1" class="pointer-cursor" title="{{'Select All' | translate}}" ng-click="selectAllTasks()">
|
||||||
<i class="fa fa-th-large fa-fw"></i>
|
<i class="fa fa-th-large fa-fw"></i>
|
||||||
|
|
Reference in a new issue