From d7a9b38397dd01f049d2a8516d84b6aa10ebc19b Mon Sep 17 00:00:00 2001 From: MaysWind Date: Sat, 8 Jul 2017 00:32:22 +0800 Subject: [PATCH] task files supports ordering by index --- src/scripts/filters/fileOrderBy.js | 4 +++- src/scripts/services/aria2TaskService.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/scripts/filters/fileOrderBy.js b/src/scripts/filters/fileOrderBy.js index 7296fe7..56038c4 100644 --- a/src/scripts/filters/fileOrderBy.js +++ b/src/scripts/filters/fileOrderBy.js @@ -13,7 +13,9 @@ 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); } else if (orderType.type === 'size') { return $filter('orderBy')(array, ['length'], orderType.reverse); diff --git a/src/scripts/services/aria2TaskService.js b/src/scripts/services/aria2TaskService.js index 36513db..bb50f2e 100644 --- a/src/scripts/services/aria2TaskService.js +++ b/src/scripts/services/aria2TaskService.js @@ -159,6 +159,7 @@ for (var i = 0; i < task.files.length; i++) { var file = task.files[i]; + file.index = parseInt(file.index); file.fileName = getFileName(file); file.length = parseInt(file.length); file.selected = (file.selected === true || file.selected === 'true'); @@ -477,7 +478,7 @@ 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'); }