add time_added and tracker_host to the torrent grid

This commit is contained in:
Damien Churchill 2009-03-21 15:25:09 +00:00
parent b2f01c177f
commit c5cc5c283b
3 changed files with 23 additions and 4 deletions

View File

@ -80,9 +80,11 @@ Deluge.Torrents = {
{name: 'upspeed', type: 'int'},
{name: 'eta', type: 'int'},
{name: 'ratio', type: 'float'},
{name: 'avail', type: 'float'}
{name: 'avail', type: 'float'},
{name: 'added', type: 'int'},
{name: 'tracker'}
],
id: 14
id: 16
}),
getTorrent: function(rowIndex) {
@ -114,7 +116,9 @@ Deluge.Torrents.Grid = new Ext.grid.GridPanel({
{header: "Up Speed", width: 80, sortable: true, renderer: torrent_speed, dataIndex: 'upspeed'},
{header: "ETA", width: 60, sortable: true, renderer: ftime, dataIndex: 'eta'},
{header: "Ratio", width: 60, sortable: true, renderer: avail, dataIndex: 'ratio'},
{header: "Avail.", width: 60, sortable: true, renderer: avail, dataIndex: 'avail'}
{header: "Avail.", width: 60, sortable: true, renderer: avail, dataIndex: 'avail'},
{header: "Added", width: 80, sortable: true, renderer: fdate, dataIndex: 'added'},
{header: "Tracker", width: 120, sortable: true, renderer: Deluge.Formatters.plain, dataIndex: 'tracker'}
],
stripeRows: true,
autoExpandColumn: 'name',

View File

@ -100,6 +100,8 @@ Deluge.Ui = {
torrent.eta,
torrent.ratio,
torrent.distributed_copies,
torrent.time_added,
torrent.tracker_host,
id
]);
});

View File

@ -52,6 +52,18 @@ Deluge.Events = {
};
Deluge.Formatters = {
date: function(timestamp) {
function zeroPad(num, count) {
var numZeropad = num + '';
while (numZeropad.length < count) {
numZeropad = '0' + numZeropad;
}
return numZeropad;
}
timestamp = timestamp * 1000;
var date = new Date(timestamp);
return String.format('{0}/{1}/{2}', zeroPad(date.getDate(), 2), zeroPad(date.getMonth() + 1, 2), date.getFullYear());
},
size: function(bytes) {
bytes = bytes / 1024.0;
@ -111,13 +123,14 @@ Deluge.Formatters = {
var fsize = Deluge.Formatters.size;
var fspeed = Deluge.Formatters.speed;
var ftime = Deluge.Formatters.timeRemaining;
var fdate = Deluge.Formatters.date;
Deluge.Keys = {
Grid: [
'queue', 'name', 'total_size', 'state', 'progress', 'num_seeds',
'total_seeds', 'num_peers', 'total_peers', 'download_payload_rate',
'upload_payload_rate', 'eta', 'ratio', 'distributed_copies',
'is_auto_managed'
'is_auto_managed', 'time_added', 'tracker_host'
],
Status: [
'total_done', 'total_payload_download', 'total_uploaded',