add select all failed tasks
This commit is contained in:
parent
a6bbc37c5e
commit
74812e9ba6
|
@ -23,6 +23,7 @@ Delete=删除任务
|
||||||
Select All=全部选中
|
Select All=全部选中
|
||||||
Select None=全部不选
|
Select None=全部不选
|
||||||
Select Invert=反向选择
|
Select Invert=反向选择
|
||||||
|
Select All Failed Task=全选失败任务
|
||||||
Display Order=显示顺序
|
Display Order=显示顺序
|
||||||
Copy Download Url=复制下载链接
|
Copy Download Url=复制下载链接
|
||||||
Copy Magnet Link=复制磁力链接
|
Copy Magnet Link=复制磁力链接
|
||||||
|
|
|
@ -23,6 +23,7 @@ Delete=刪除工作
|
||||||
Select All=全部選中
|
Select All=全部選中
|
||||||
Select None=全部不選
|
Select None=全部不選
|
||||||
Select Invert=反向選擇
|
Select Invert=反向選擇
|
||||||
|
Select All Failed Task=全選失敗工作
|
||||||
Display Order=顯示順序
|
Display Order=顯示順序
|
||||||
Copy Download Url=複製下載連結
|
Copy Download Url=複製下載連結
|
||||||
Copy Magnet Link=複製磁力連結
|
Copy Magnet Link=複製磁力連結
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
'Select All': 'Select All',
|
'Select All': 'Select All',
|
||||||
'Select None': 'Select None',
|
'Select None': 'Select None',
|
||||||
'Select Invert': 'Select Invert',
|
'Select Invert': 'Select Invert',
|
||||||
|
'Select All Failed Task': 'Select All Failed Task',
|
||||||
'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',
|
||||||
|
|
|
@ -197,8 +197,8 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.isTaskRetryable = function (task) {
|
$scope.hasRetryableTask = function () {
|
||||||
return task && task.status === 'error' && task.errorDescription && !task.bittorrent;
|
return $rootScope.taskContext.hasRetryableTask();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.isSelectedTaskRetryable = function () {
|
$scope.isSelectedTaskRetryable = function () {
|
||||||
|
@ -209,7 +209,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0; i < selectedTasks.length; i++) {
|
for (var i = 0; i < selectedTasks.length; i++) {
|
||||||
if (!$scope.isTaskRetryable(selectedTasks[i])) {
|
if (!$rootScope.isTaskRetryable(selectedTasks[i])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@
|
||||||
var skipCount = 0;
|
var skipCount = 0;
|
||||||
|
|
||||||
for (var i = 0; i < tasks.length; i++) {
|
for (var i = 0; i < tasks.length; i++) {
|
||||||
if ($scope.isTaskRetryable(tasks[i])) {
|
if ($rootScope.isTaskRetryable(tasks[i])) {
|
||||||
retryableTasks.push(tasks[i]);
|
retryableTasks.push(tasks[i]);
|
||||||
} else {
|
} else {
|
||||||
skipCount++;
|
skipCount++;
|
||||||
|
@ -322,6 +322,10 @@
|
||||||
$rootScope.taskContext.selectAll();
|
$rootScope.taskContext.selectAll();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.selectAllFailedTasks = function () {
|
||||||
|
$rootScope.taskContext.selectAllFailed();
|
||||||
|
};
|
||||||
|
|
||||||
$scope.copySelectedOneTaskDownloadLink = function () {
|
$scope.copySelectedOneTaskDownloadLink = function () {
|
||||||
var selectedTasks = $rootScope.taskContext.getSelectedTasks();
|
var selectedTasks = $rootScope.taskContext.getSelectedTasks();
|
||||||
|
|
||||||
|
|
|
@ -151,6 +151,21 @@
|
||||||
|
|
||||||
return isAllSelected;
|
return isAllSelected;
|
||||||
},
|
},
|
||||||
|
hasRetryableTask: function () {
|
||||||
|
for (var i = 0; i < this.list.length; i++) {
|
||||||
|
var task = this.list[i];
|
||||||
|
|
||||||
|
if (!$rootScope.filterTask(task)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($rootScope.isTaskRetryable(task)) {
|
||||||
|
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;
|
||||||
|
@ -171,6 +186,48 @@
|
||||||
|
|
||||||
this.selected[task.gid] = !isAllSelected;
|
this.selected[task.gid] = !isAllSelected;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
selectAllFailed: 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 (!$rootScope.isTaskRetryable(task)) {
|
||||||
|
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 (!$rootScope.isTaskRetryable(task)) {
|
||||||
|
this.selected[task.gid] = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selected[task.gid] = !isAllFailedSelected;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -186,6 +243,10 @@
|
||||||
return (task.taskName.toLowerCase().indexOf($rootScope.searchContext.text.toLowerCase()) >= 0);
|
return (task.taskName.toLowerCase().indexOf($rootScope.searchContext.text.toLowerCase()) >= 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$rootScope.isTaskRetryable = function (task) {
|
||||||
|
return task && task.status === 'error' && task.errorDescription && !task.bittorrent;
|
||||||
|
};
|
||||||
|
|
||||||
$rootScope.swipeActions = {
|
$rootScope.swipeActions = {
|
||||||
leftSwipe: function () {
|
leftSwipe: function () {
|
||||||
if (isSidebarShowInSmallScreen()) {
|
if (isSidebarShowInSmallScreen()) {
|
||||||
|
|
|
@ -164,6 +164,12 @@
|
||||||
<span translate>Select All</span>
|
<span translate>Select All</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li ng-if="hasRetryableTask()">
|
||||||
|
<a tabindex="-1" class="pointer-cursor" title="{{'Select All Failed Task' | translate}}" ng-click="selectAllFailedTasks()">
|
||||||
|
<i class="fa fa-fw"></i>
|
||||||
|
<span translate>Select All Failed Task</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li class="divider" ng-if="isSingleUrlTaskSelected() || isSingleBittorrentHasInfoHashTaskSelected()"></li>
|
<li class="divider" ng-if="isSingleUrlTaskSelected() || isSingleBittorrentHasInfoHashTaskSelected()"></li>
|
||||||
<li ng-if="isSingleUrlTaskSelected()">
|
<li ng-if="isSingleUrlTaskSelected()">
|
||||||
<a tabindex="-1" class="pointer-cursor" title="{{'Copy Download Url' | translate}}" ng-click="copySelectedOneTaskDownloadLink()">
|
<a tabindex="-1" class="pointer-cursor" title="{{'Copy Download Url' | translate}}" ng-click="copySelectedOneTaskDownloadLink()">
|
||||||
|
|
Reference in a new issue