add share ratio in task detail page

This commit is contained in:
MaysWind 2016-06-09 17:31:36 +08:00
parent ce853c3ec6
commit a0efe5cde7
4 changed files with 15 additions and 3 deletions

View file

@ -44,6 +44,7 @@
"File Name": "文件名", "File Name": "文件名",
"File Size": "大小", "File Size": "大小",
"Completed Percent": "进度", "Completed Percent": "进度",
"Share Ratio": "分享率",
"Remain Time": "剩余时间", "Remain Time": "剩余时间",
"Download Speed": "下载速度", "Download Speed": "下载速度",
"Upload Speed": "上传速度", "Upload Speed": "上传速度",

View file

@ -48,7 +48,8 @@
'File Name': 'File Name', 'File Name': 'File Name',
'File Size': 'File Size', 'File Size': 'File Size',
'Completed Percent': 'Percent', 'Completed Percent': 'Percent',
'Remain Time': 'Remain', 'Share Ratio': 'Share Ratio',
'Remain Time': 'Remain Time',
'Download Speed': 'Download Speed', 'Download Speed': 'Download Speed',
'Upload Speed': 'Upload Speed', 'Upload Speed': 'Upload Speed',
'Overview': 'Overview', 'Overview': 'Overview',

View file

@ -56,6 +56,8 @@
task.completePercent = (task.totalLength > 0 ? task.completedLength / task.totalLength * 100 : 0); task.completePercent = (task.totalLength > 0 ? task.completedLength / task.totalLength * 100 : 0);
task.remainLength = task.totalLength - task.completedLength; task.remainLength = task.totalLength - task.completedLength;
task.remainPercent = 100 - task.completePercent; 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.uploadSpeed = parseInt(task.uploadSpeed);
task.downloadSpeed = parseInt(task.downloadSpeed); task.downloadSpeed = parseInt(task.downloadSpeed);
@ -153,7 +155,7 @@
}, },
selectTaskFile: function (gid, selectedFileIndexArr, callback) { selectTaskFile: function (gid, selectedFileIndexArr, callback) {
var selectedFileIndex = ''; var selectedFileIndex = '';
for (var i = 0; i < selectedFileIndexArr.length; i++) { for (var i = 0; i < selectedFileIndexArr.length; i++) {
if (selectedFileIndex.length > 0) { if (selectedFileIndex.length > 0) {
selectedFileIndex += ','; selectedFileIndex += ',';
@ -161,7 +163,7 @@
selectedFileIndex += selectedFileIndexArr[i]; selectedFileIndex += selectedFileIndexArr[i];
} }
return this.setTaskOption(gid, 'select-file', selectedFileIndex, callback); return this.setTaskOption(gid, 'select-file', selectedFileIndex, callback);
}, },
getBtTaskPeers: function (gid, callback, silent) { getBtTaskPeers: function (gid, callback, silent) {

View file

@ -80,6 +80,14 @@
<span ng-bind="(task.uploadLength | readableVolumn) + (task.status == 'active' ? ' @ ' + (task.uploadSpeed | readableVolumn) + '/s' : '')"></span> <span ng-bind="(task.uploadLength | readableVolumn) + (task.status == 'active' ? ' @ ' + (task.uploadSpeed | readableVolumn) + '/s' : '')"></span>
</div> </div>
</div> </div>
<div class="row" ng-if="task && task.bittorrent">
<div class="setting-key col-sm-4">
<span translate>Share Ratio</span>
</div>
<div class="setting-value col-sm-8">
<span ng-bind="(task.shareRatio | number: 2)"></span>
</div>
</div>
<div class="row" ng-if="task && task.status == 'active' && task.completedLength < task.totalLength"> <div class="row" ng-if="task && task.status == 'active' && task.completedLength < task.totalLength">
<div class="setting-key col-sm-4"> <div class="setting-key col-sm-4">
<span translate>Remain Time</span> <span translate>Remain Time</span>