task files supports ordering by index

This commit is contained in:
MaysWind 2017-07-08 00:32:22 +08:00
parent a37c662364
commit d7a9b38397
2 changed files with 5 additions and 2 deletions

View file

@ -13,7 +13,9 @@
return array; return array;
} }
if (orderType.type === 'name') { if (orderType.type === 'index') {
return $filter('orderBy')(array, ['index'], orderType.reverse);
} else if (orderType.type === 'name') {
return $filter('orderBy')(array, ['fileName'], orderType.reverse); return $filter('orderBy')(array, ['fileName'], orderType.reverse);
} else if (orderType.type === 'size') { } else if (orderType.type === 'size') {
return $filter('orderBy')(array, ['length'], orderType.reverse); return $filter('orderBy')(array, ['length'], orderType.reverse);

View file

@ -159,6 +159,7 @@
for (var i = 0; i < task.files.length; i++) { for (var i = 0; i < task.files.length; i++) {
var file = task.files[i]; var file = task.files[i];
file.index = parseInt(file.index);
file.fileName = getFileName(file); file.fileName = getFileName(file);
file.length = parseInt(file.length); file.length = parseInt(file.length);
file.selected = (file.selected === true || file.selected === 'true'); file.selected = (file.selected === true || file.selected === 'true');
@ -477,7 +478,7 @@
ariaNgLogService.warn('[aria2TaskService.restartTask] task file is null'); ariaNgLogService.warn('[aria2TaskService.restartTask] task file is null');
} }
if (task.files.length != 1) { if (task.files.length !== 1) {
ariaNgLogService.warn('[aria2TaskService.restartTask] task file length is not equal 1'); ariaNgLogService.warn('[aria2TaskService.restartTask] task file length is not equal 1');
} }