support select task
This commit is contained in:
parent
54f02804d6
commit
423d25b84e
|
@ -44,23 +44,28 @@
|
|||
</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li class="disabled">
|
||||
<li ng-class="{'disabled': !isTaskSelected()}">
|
||||
<a class="toolbar" title="{{'Start' | translate}}">
|
||||
<i class="fa fa-play"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li class="disabled">
|
||||
<li ng-class="{'disabled': !isTaskSelected()}">
|
||||
<a class="toolbar" title="{{'Pause' | translate}}">
|
||||
<i class="fa fa-pause"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li class="disabled">
|
||||
<li ng-class="{'disabled': !taskContext.list || taskContext.list.length < 1}">
|
||||
<a class="toolbar" title="{{'Delete' | translate}}">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
<i class="fa fa-caret-right fa-right-bottom fa-rotate-45 fa-half" aria-hidden="true"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li class="divider"></li>
|
||||
<li ng-class="{'disabled': !taskContext.list || taskContext.list.length < 1}">
|
||||
<a class="toolbar" title="{{'Select All' | translate}}" ng-click="selectAllTasks()">
|
||||
<i class="fa fa-th-large"></i>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="toolbar dropdown-toggle" data-toggle="dropdown" title="{{'Display Order' | translate}}">
|
||||
<i class="fa fa-sort-alpha-asc"></i>
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"Start": "开始下载任务",
|
||||
"Pause": "暂停下载任务",
|
||||
"Delete": "删除下载任务",
|
||||
"Select All": "全选",
|
||||
"Display Order": "显示顺序",
|
||||
"Search": "搜索",
|
||||
"Default": "默认",
|
||||
|
|
|
@ -40,9 +40,9 @@
|
|||
return invokeMethod({
|
||||
params: params,
|
||||
callback: function (result) {
|
||||
if (!utils.extendArray(result, $scope.downloadTasks, 'gid')) {
|
||||
if (!utils.extendArray(result, $scope.taskContext.list, 'gid')) {
|
||||
if (needRequestWholeInfo) {
|
||||
$scope.downloadTasks = result;
|
||||
$scope.taskContext.list = result;
|
||||
needRequestWholeInfo = false;
|
||||
} else {
|
||||
needRequestWholeInfo = true;
|
||||
|
@ -51,9 +51,9 @@
|
|||
needRequestWholeInfo = false;
|
||||
}
|
||||
|
||||
if ($scope.downloadTasks && $scope.downloadTasks.length > 0) {
|
||||
for (var i = 0; i < $scope.downloadTasks.length; i++) {
|
||||
utils.processDownloadTask($scope.downloadTasks[i]);
|
||||
if ($scope.taskContext.list && $scope.taskContext.list.length > 0) {
|
||||
for (var i = 0; i < $scope.taskContext.list.length; i++) {
|
||||
utils.processDownloadTask($scope.taskContext.list[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,6 +30,55 @@
|
|||
text: ''
|
||||
};
|
||||
|
||||
$scope.taskContext = {
|
||||
list: [],
|
||||
selected: {}
|
||||
};
|
||||
|
||||
$scope.isTaskSelected = function () {
|
||||
var allTasks = $scope.taskContext.list;
|
||||
|
||||
if (!allTasks || allTasks.length < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var selectedTasks = $scope.taskContext.selected;
|
||||
|
||||
for (var i = 0; i < allTasks.length; i++) {
|
||||
var task = allTasks[i];
|
||||
if (selectedTasks[task.gid]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
$scope.selectAllTasks = function () {
|
||||
var allTasks = $scope.taskContext.list;
|
||||
|
||||
if (!allTasks || allTasks.length < 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
var selectedTasks = $scope.taskContext.selected;
|
||||
var isAllSelected = true;
|
||||
|
||||
for (var i = 0; i < allTasks.length; i++) {
|
||||
var task = allTasks[i];
|
||||
|
||||
if (!selectedTasks[task.gid]) {
|
||||
isAllSelected = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (var i = 0; i < allTasks.length; i++) {
|
||||
var task = allTasks[i];
|
||||
selectedTasks[task.gid] = !isAllSelected;
|
||||
}
|
||||
};
|
||||
|
||||
$scope.changeDisplayOrder = function (type, autoSetReverse) {
|
||||
var oldType = utils.parseOrderType(ariaNgSettingService.getDisplayOrder());
|
||||
var newType = utils.parseOrderType(type);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
'Start': 'Start',
|
||||
'Pause': 'Pause',
|
||||
'Delete': 'Delete',
|
||||
'Select All': 'Select All',
|
||||
'Display Order': 'Display Order',
|
||||
'Search': 'Search',
|
||||
'Default': 'Default',
|
||||
|
|
|
@ -390,6 +390,24 @@ td {
|
|||
bottom: 2px;
|
||||
}
|
||||
|
||||
/* awesome-bootstrap-checkbox extend */
|
||||
.checkbox.checkbox-hide {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.checkbox.checkbox-hide > input, .checkbox.checkbox-hide > input + label::before, .checkbox.checkbox-hide > input + label::after {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.checkbox.checkbox-hide > label {
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.skin-aria-ng .checkbox-primary input[type="checkbox"]:checked + label::before, .checkbox-primary input[type="radio"]:checked + label::before {
|
||||
background-color: #208fe5;
|
||||
border-color: #208fe5;
|
||||
}
|
||||
|
||||
/* task-table */
|
||||
.task-table {
|
||||
margin-left: 15px;
|
||||
|
|
|
@ -33,9 +33,14 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="task-table-body">
|
||||
<div class="row" ng-repeat="task in downloadTasks | filter: filterByTaskName | taskOrderBy: getOrderType()" data-gid="{{task.gid}}">
|
||||
<div class="row" ng-repeat="task in taskContext.list | filter: filterByTaskName | taskOrderBy: getOrderType()" data-gid="{{task.gid}}">
|
||||
<div class="col-sm-8">
|
||||
<div class="checkbox checkbox-primary" ng-class="{'checkbox-hide': !taskContext.selected[task.gid]}">
|
||||
<input id="{{'task_' + task.gid}}" type="checkbox" ng-model="taskContext.selected[task.gid]"/>
|
||||
<label for="{{'task_' + task.gid}}">
|
||||
<span class="task-name" ng-bind="task.taskName" title="{{task.taskName}}"></span>
|
||||
</label>
|
||||
</div>
|
||||
<div class="task-files">
|
||||
<span ng-bind="task.totalLength | readableVolumn"></span>
|
||||
<a ng-href="#/task/detail/{{task.gid}}">
|
||||
|
|
|
@ -138,11 +138,10 @@
|
|||
<div class="task-table-body">
|
||||
<div class="row" ng-repeat="file in task.files | fileOrderBy: getFileListOrderType()">
|
||||
<div class="col-sm-8">
|
||||
<div class="checkbox checkbox-info">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="col-sm-2">
|
||||
<div class="progress">
|
||||
|
|
Reference in a new issue