support display local host in connection status tab
This commit is contained in:
parent
224367d1ba
commit
322b3c2fa0
|
@ -65,6 +65,7 @@
|
|||
"Status": "状态",
|
||||
"Percent": "完成度",
|
||||
"Speed": "速度",
|
||||
"(local)": "(本机)",
|
||||
"No Data": "无数据",
|
||||
"No connected peers": "没有连接到其他节点",
|
||||
"Failed to change some tasks state.": "修改一些任务状态时失败.",
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
'Status': 'Status',
|
||||
'Percent': 'Percent',
|
||||
'Speed': 'Speed',
|
||||
'(local)': '(local)',
|
||||
'No Data': 'No Data',
|
||||
'No connected peers': 'No connected peers',
|
||||
'Failed to change some tasks state.': 'Failed to change some tasks state.',
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
}
|
||||
|
||||
var peers = response.data;
|
||||
peers.push(aria2TaskService.createLocalPeerFromTask(task));
|
||||
|
||||
if (!ariaNgCommonService.extendArray(peers, $scope.peers, 'peerId')) {
|
||||
$scope.peers = peers;
|
||||
|
|
|
@ -185,7 +185,13 @@
|
|||
|
||||
for (var i = 0; i < peers.length; i++) {
|
||||
var peer = peers[i];
|
||||
var upstreamToSpeed = peer.uploadSpeed;
|
||||
var downstreamFromSpeed = peer.downloadSpeed;
|
||||
|
||||
peer.name = peer.ip + ':' + peer.port;
|
||||
peer.completePercent = estimateCompletedPercentFromBitField(peer.bitfield) * 100;
|
||||
peer.downloadSpeed = upstreamToSpeed;
|
||||
peer.uploadSpeed = downstreamFromSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -283,6 +289,17 @@
|
|||
processDownloadTask(tasks[i]);
|
||||
}
|
||||
},
|
||||
createLocalPeerFromTask: function (task) {
|
||||
return {
|
||||
local: true,
|
||||
bitfield: task.bitfield,
|
||||
completePercent: task.completePercent,
|
||||
downloadSpeed: task.downloadSpeed,
|
||||
name: '(local)',
|
||||
seeder: task.seeder,
|
||||
uploadSpeed: task.uploadSpeed
|
||||
};
|
||||
},
|
||||
getPieceStatus: function (bitField, pieceCount) {
|
||||
var pieces = [];
|
||||
|
||||
|
|
|
@ -214,7 +214,7 @@
|
|||
<div class="task-table-body">
|
||||
<div class="row" ng-repeat="peer in peers | peerOrderBy: getPeerListOrderType()">
|
||||
<div class="col-sm-3">
|
||||
<span ng-bind="peer.ip + ':' + peer.port"></span>
|
||||
<span ng-bind="peer.name | translate"></span>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<div class="piece-bar-wrapper">
|
||||
|
|
Reference in a new issue