report in the peers table whether the peer is a peer or a seed

This commit is contained in:
Damien Churchill 2009-02-21 04:29:04 +00:00
commit 0f0c0cef9b
2 changed files with 25 additions and 10 deletions

View file

@ -7,12 +7,12 @@ html, body {
height:100%; height:100%;
} }
.deluge-torrents td { .deluge-torrents td, .x-deluge-peers td {
height: 16px; height: 16px;
line-height: 16px; line-height: 16px;
} }
.deluge-torrents .torrent-name { .deluge-torrents .torrent-name, .x-deluge-peer, .x-deluge-seed {
padding-left: 20px; padding-left: 20px;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
@ -23,8 +23,8 @@ html, body {
#labels .all { background-image: url('/icons/16/all.png'); } #labels .all { background-image: url('/icons/16/all.png'); }
#labels .active { background-image: url('/icons/16/active.png'); } #labels .active { background-image: url('/icons/16/active.png'); }
#labels .downloading, .deluge-torrents .downloading { background-image: url('/icons/16/downloading.png'); } #labels .downloading, .deluge-torrents .downloading, .x-deluge-peer { background-image: url('/icons/16/downloading.png'); }
#labels .seeding, .deluge-torrents .seeding { background-image: url('/icons/16/seeding.png'); } #labels .seeding, .deluge-torrents .seeding, .x-deluge-seed { background-image: url('/icons/16/seeding.png'); }
#labels .queued, .deluge-torrents .queued { background-image: url('/icons/16/queued.png'); } #labels .queued, .deluge-torrents .queued { background-image: url('/icons/16/queued.png'); }
#labels .paused, .deluge-torrents .paused { background-image: url('/icons/16/inactive.png'); } #labels .paused, .deluge-torrents .paused { background-image: url('/icons/16/inactive.png'); }
#labels .error, .deluge-torrents .error { background-image: url('/icons/16/alert.png'); } #labels .error, .deluge-torrents .error { background-image: url('/icons/16/alert.png'); }
@ -73,6 +73,14 @@ html, body {
width: 500px; width: 500px;
} }
/* Peers Grid */
.x-deluge-peer {
}
.x-deluge-seed {
}
/* Login */ /* Login */
.x-deluge-login-window-icon { .x-deluge-login-window-icon {

View file

@ -245,7 +245,7 @@ Deluge.Details.Peers = {
onRequestComplete: function(torrent) { onRequestComplete: function(torrent) {
var peers = new Array(); var peers = new Array();
torrent.peers.each(function(peer) { torrent.peers.each(function(peer) {
peers.include([peer.country, peer.ip, peer.client, peer.progress, peer.down_speed, peer.up_speed]); peers.include([peer.country, peer.ip, peer.client, peer.progress, peer.down_speed, peer.up_speed, peer.seed]);
}, this); }, this);
this.Store.loadData(peers); this.Store.loadData(peers);
}, },
@ -261,11 +261,16 @@ Deluge.Details.Peers = {
} }
} }
function flag(val) { function flag(value) {
return String.format('<img src="/flag/{0}" />', val); return String.format('<img src="/flag/{0}" />', value);
} }
function peer_progress(value, p, r) { function peer_address(value, p, record) {
var seed = (record.data['seed'] == 1024) ? 'x-deluge-seed' : 'x-deluge-peer'
return String.format('<div class="{0}">{1}</div>', seed, value);
}
function peer_progress(value) {
var progress = (value * 100).toInt(); var progress = (value * 100).toInt();
return String.format(tpl, progress, '', progress); return String.format(tpl, progress, '', progress);
} }
@ -277,7 +282,8 @@ Deluge.Details.Peers.Store = new Ext.data.SimpleStore({
{name: 'client'}, {name: 'client'},
{name: 'progress', type: 'float'}, {name: 'progress', type: 'float'},
{name: 'downspeed', type: 'int'}, {name: 'downspeed', type: 'int'},
{name: 'upspeed', type: 'int'} {name: 'upspeed', type: 'int'},
{name: 'seed', type: 'int'}
], ],
id: 0 id: 0
}); });
@ -335,10 +341,11 @@ Deluge.Details.Panel = new Ext.TabPanel({
}), new Ext.grid.GridPanel({ }), new Ext.grid.GridPanel({
id: 'peers', id: 'peers',
title: _('Peers'), title: _('Peers'),
cls: 'x-deluge-peers',
store: Deluge.Details.Peers.Store, store: Deluge.Details.Peers.Store,
columns: [ columns: [
{header: '&nbsp;', width: 30, sortable: true, renderer: flag, dataIndex: 'country'}, {header: '&nbsp;', width: 30, sortable: true, renderer: flag, dataIndex: 'country'},
{header: 'Address', width: 125, sortable: true, renderer: Deluge.Formatters.plain, dataIndex: 'address'}, {header: 'Address', width: 125, sortable: true, renderer: peer_address, dataIndex: 'address'},
{header: 'Client', width: 125, sortable: true, renderer: Deluge.Formatters.plain, dataIndex: 'client'}, {header: 'Client', width: 125, sortable: true, renderer: Deluge.Formatters.plain, dataIndex: 'client'},
{header: 'Progress', width: 150, sortable: true, renderer: peer_progress, dataIndex: 'progress'}, {header: 'Progress', width: 150, sortable: true, renderer: peer_progress, dataIndex: 'progress'},
{header: 'Down Speed', width: 100, sortable: true, renderer: fspeed, dataIndex: 'downspeed'}, {header: 'Down Speed', width: 100, sortable: true, renderer: fspeed, dataIndex: 'downspeed'},