mirror of
https://github.com/transmission/transmission.git
synced 2026-05-03 23:25:14 +01:00
(web) #3285:Add peer list to inspector
This commit is contained in:
@@ -77,6 +77,7 @@ Transmission.prototype =
|
||||
|
||||
this._torrent_list = $('#torrent_list')[0];
|
||||
this._inspector_file_list = $('#inspector_file_list')[0];
|
||||
this._inspector_peers_list = $('#inspector_peers_list')[0];
|
||||
this._inspector_trackers_list = $('#inspector_trackers_list')[0];
|
||||
this._inspector_tab_files = $('#inspector_tab_files')[0];
|
||||
this._toolbar_buttons = $('#torrent_global_menu ul li');
|
||||
@@ -701,6 +702,7 @@ Transmission.prototype =
|
||||
this.hideiPhoneAddressbar();
|
||||
|
||||
this.updateVisibleFileLists();
|
||||
this.updatePeersLists();
|
||||
this.updateTrackersLists();
|
||||
},
|
||||
|
||||
@@ -1191,6 +1193,7 @@ Transmission.prototype =
|
||||
setInnerHTML( tab.download_dir, na );
|
||||
setInnerHTML( tab.error, na );
|
||||
this.updateVisibleFileLists();
|
||||
this.updatePeersLists();
|
||||
this.updateTrackersLists();
|
||||
$("#torrent_inspector_size, .inspector_row > div:contains('N/A')").css('color', '#666');
|
||||
return;
|
||||
@@ -1267,7 +1270,8 @@ Transmission.prototype =
|
||||
setInnerHTML( tab.creator, creator );
|
||||
setInnerHTML( tab.download_dir, download_dir == na ? download_dir : download_dir.replace(/([\/_\.])/g, "$1​") );
|
||||
setInnerHTML( tab.error, error );
|
||||
|
||||
|
||||
this.updatePeersLists();
|
||||
this.updateTrackersLists();
|
||||
$(".inspector_row > div:contains('N/A')").css('color', '#666');
|
||||
this.updateVisibleFileLists();
|
||||
@@ -1293,6 +1297,38 @@ Transmission.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
updatePeersLists: function() {
|
||||
var tr = this;
|
||||
var html = '';
|
||||
var torrents = this.getSelectedTorrents( );
|
||||
if( $(this._inspector_peers_list).is(':visible') && torrents.length == 1 ) {
|
||||
html += '<div class="inspector_group"><table class="peer_list">';
|
||||
html += '<tr class="inspector_peer_entry even">';
|
||||
html += '<th class="encryptedCol"></th>';
|
||||
html += '<th class="upCol">Up</th>';
|
||||
html += '<th class="downCol">Down</th>';
|
||||
html += '<th class="percentCol">%</th>';
|
||||
html += '<th class="statusCol">Status</th>';
|
||||
html += '<th class="addressCol">Address</th>';
|
||||
html += '<th class="clientCol">Client</th>';
|
||||
html += '</tr>';
|
||||
for( var i=0, peer; peer=torrents[0]._peers[i]; ++i ) {
|
||||
var parity = ((i+1) % 2 == 0 ? 'even' : 'odd');
|
||||
html += '<tr class="inspector_peer_entry ' + parity + '">';
|
||||
html += '<td>' + (peer.isEncrypted ? '<img src="images/graphics/lock_icon.png" alt="Encrypted"/>' : '') + '</td>';
|
||||
html += '<td>' + (peer.rateToPeer ? Math.formatBytes(peer.rateToPeer) + '/s' : '') + '</td>';
|
||||
html += '<td>' + (peer.rateToClient ? Math.formatBytes(peer.rateToClient) + '/s' : '') + '</td>';
|
||||
html += '<td class="percentCol">' + Math.floor(peer.progress*100) + '%' + '</td>';
|
||||
html += '<td>' + peer.flagStr + '</td>';
|
||||
html += '<td>' + peer.address + '</td>';
|
||||
html += '<td>' + peer.clientName + '</td>';
|
||||
html += '</tr>';
|
||||
}
|
||||
html += '</table></div>';
|
||||
}
|
||||
setInnerHTML(this._inspector_peers_list, html);
|
||||
},
|
||||
|
||||
updateTrackersLists: function() {
|
||||
// By building up the HTML as as string, then have the browser
|
||||
// turn this into a DOM tree, this is a fast operation.
|
||||
|
||||
Reference in New Issue
Block a user