From a0efe5cde75681cd00f4d917a0596d4822cd5c6e Mon Sep 17 00:00:00 2001 From: MaysWind Date: Thu, 9 Jun 2016 17:31:36 +0800 Subject: [PATCH] add share ratio in task detail page --- app/langs/zh_CN.json | 1 + app/scripts/config/language-default.js | 3 ++- app/scripts/services/aria2TaskService.js | 6 ++++-- app/views/task-detail.html | 8 ++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/langs/zh_CN.json b/app/langs/zh_CN.json index 938ea17..b016c9f 100644 --- a/app/langs/zh_CN.json +++ b/app/langs/zh_CN.json @@ -44,6 +44,7 @@ "File Name": "文件名", "File Size": "大小", "Completed Percent": "进度", + "Share Ratio": "分享率", "Remain Time": "剩余时间", "Download Speed": "下载速度", "Upload Speed": "上传速度", diff --git a/app/scripts/config/language-default.js b/app/scripts/config/language-default.js index da5251c..d811b13 100644 --- a/app/scripts/config/language-default.js +++ b/app/scripts/config/language-default.js @@ -48,7 +48,8 @@ 'File Name': 'File Name', 'File Size': 'File Size', 'Completed Percent': 'Percent', - 'Remain Time': 'Remain', + 'Share Ratio': 'Share Ratio', + 'Remain Time': 'Remain Time', 'Download Speed': 'Download Speed', 'Upload Speed': 'Upload Speed', 'Overview': 'Overview', diff --git a/app/scripts/services/aria2TaskService.js b/app/scripts/services/aria2TaskService.js index c2d98f8..35c8f02 100644 --- a/app/scripts/services/aria2TaskService.js +++ b/app/scripts/services/aria2TaskService.js @@ -56,6 +56,8 @@ task.completePercent = (task.totalLength > 0 ? task.completedLength / task.totalLength * 100 : 0); task.remainLength = task.totalLength - task.completedLength; task.remainPercent = 100 - task.completePercent; + task.uploadLength = (task.uploadLength ? parseInt(task.uploadLength) : 0); + task.shareRatio = (task.uploadLength / task.completedLength); task.uploadSpeed = parseInt(task.uploadSpeed); task.downloadSpeed = parseInt(task.downloadSpeed); @@ -153,7 +155,7 @@ }, selectTaskFile: function (gid, selectedFileIndexArr, callback) { var selectedFileIndex = ''; - + for (var i = 0; i < selectedFileIndexArr.length; i++) { if (selectedFileIndex.length > 0) { selectedFileIndex += ','; @@ -161,7 +163,7 @@ selectedFileIndex += selectedFileIndexArr[i]; } - + return this.setTaskOption(gid, 'select-file', selectedFileIndex, callback); }, getBtTaskPeers: function (gid, callback, silent) { diff --git a/app/views/task-detail.html b/app/views/task-detail.html index e86212f..234d95c 100644 --- a/app/views/task-detail.html +++ b/app/views/task-detail.html @@ -80,6 +80,14 @@ +
+
+ Share Ratio +
+
+ +
+
Remain Time