-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First, added trackers tab to the WebUI. Second, now we can view all the trackers and view each: * status * peers count * additional message Third, moved the private torrent info to the details tab. closes: https://dev.deluge-torrent.org/ticket/1015
Showing
11 changed files
with
509 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- Generated with glade 3.22.1 --> | ||
<interface> | ||
<requires lib="gtk+" version="3.0"/> | ||
<object class="GtkImage" id="image1"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="icon_name">list-add-symbolic</property> | ||
<property name="icon_size">1</property> | ||
</object> | ||
<object class="GtkMenu" id="menu_trackers_tab"> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<child> | ||
<object class="GtkImageMenuItem" id="edit_trackers_menuitem"> | ||
<property name="label" translatable="yes">_Edit Trackers</property> | ||
<property name="visible">True</property> | ||
<property name="can_focus">False</property> | ||
<property name="tooltip_text" translatable="yes">Edit all trackers</property> | ||
<property name="use_underline">True</property> | ||
<property name="image">image1</property> | ||
<property name="use_stock">False</property> | ||
<signal name="activate" handler="on_menuitem_edit_trackers_activate" swapped="no"/> | ||
</object> | ||
</child> | ||
</object> | ||
</interface> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Deluge.data.TrackerRecord.js | ||
* | ||
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> | ||
* | ||
* This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with | ||
* the additional special exception to link portions of this program with the OpenSSL library. | ||
* See LICENSE for more details. | ||
*/ | ||
Ext.namespace('Deluge.data'); | ||
|
||
/** | ||
* Deluge.data.Tracker record | ||
* | ||
* @author Damien Churchill <damoxc@gmail.com> | ||
* @version 1.3 | ||
* | ||
* @class Deluge.data.Tracker | ||
* @extends Ext.data.Record | ||
* @constructor | ||
* @param {Object} data The tracker data | ||
*/ | ||
Deluge.data.Tracker = Ext.data.Record.create([ | ||
{ | ||
name: 'tracker', | ||
type: 'string', | ||
}, | ||
{ | ||
name: 'status', | ||
type: 'string', | ||
}, | ||
{ | ||
name: 'peers', | ||
type: 'int', | ||
}, | ||
{ | ||
name: 'message', | ||
type: 'string', | ||
}, | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
/** | ||
* Deluge.details.TrackersTab.js | ||
* | ||
* Copyright (c) Damien Churchill 2009-2010 <damoxc@gmail.com> | ||
* | ||
* This file is part of Deluge and is licensed under GNU General Public License 3.0, or later, with | ||
* the additional special exception to link portions of this program with the OpenSSL library. | ||
* See LICENSE for more details. | ||
*/ | ||
|
||
(function () { | ||
Deluge.details.TrackersTab = Ext.extend(Ext.grid.GridPanel, { | ||
// fast way to figure out if we have a tracker already. | ||
trackers: {}, | ||
can_get_trackers_info: false, | ||
|
||
constructor: function (config) { | ||
config = Ext.apply( | ||
{ | ||
title: _('Trackers'), | ||
cls: 'x-deluge-trackers', | ||
store: new Ext.data.Store({ | ||
reader: new Ext.data.JsonReader( | ||
{ | ||
idProperty: 'ip', | ||
root: 'peers', | ||
}, | ||
Deluge.data.Tracker | ||
), | ||
}), | ||
columns: [ | ||
{ | ||
header: _('Tracker'), | ||
width: 300, | ||
sortable: true, | ||
renderer: 'htmlEncode', | ||
dataIndex: 'tracker', | ||
}, | ||
{ | ||
header: _('Status'), | ||
width: 150, | ||
sortable: true, | ||
renderer: 'htmlEncode', | ||
dataIndex: 'status', | ||
}, | ||
{ | ||
header: _('Peers'), | ||
width: 100, | ||
sortable: true, | ||
renderer: 'htmlEncode', | ||
dataIndex: 'peers', | ||
}, | ||
{ | ||
header: _('Message'), | ||
width: 100, | ||
renderer: 'htmlEncode', | ||
dataIndex: 'message', | ||
}, | ||
], | ||
stripeRows: true, | ||
deferredRender: false, | ||
autoScroll: true, | ||
}, | ||
config | ||
); | ||
Deluge.details.TrackersTab.superclass.constructor.call( | ||
this, | ||
config | ||
); | ||
}, | ||
|
||
clear: function () { | ||
this.getStore().removeAll(); | ||
this.trackers = {}; | ||
}, | ||
|
||
update: function (torrentId) { | ||
this.can_get_trackers_info = deluge.server_version > '2.0.5'; | ||
|
||
var trackers_keys = this.can_get_trackers_info | ||
? Deluge.Keys.Trackers | ||
: Deluge.Keys.TrackersRedundant; | ||
|
||
deluge.client.web.get_torrent_status(torrentId, trackers_keys, { | ||
success: this.onTrackersRequestComplete, | ||
scope: this, | ||
}); | ||
}, | ||
|
||
onTrackersRequestComplete: function (status, options) { | ||
if (!status) return; | ||
|
||
var store = this.getStore(); | ||
var newTrackers = []; | ||
var addresses = {}; | ||
|
||
if (!this.can_get_trackers_info) { | ||
status['trackers'] = [ | ||
{ | ||
url: status['tracker_host'], | ||
message: '', | ||
}, | ||
]; | ||
var tracker_host = status['tracker_host']; | ||
status['trackers_status'] = { | ||
tracker_host: { | ||
status: status['tracker_status'], | ||
message: '', | ||
}, | ||
}; | ||
status['trackers_peers'] = {}; | ||
} | ||
|
||
// Go through the trackers updating and creating tracker records | ||
Ext.each( | ||
status.trackers, | ||
function (tracker) { | ||
var url = tracker.url; | ||
var tracker_status = | ||
url in status.trackers_status | ||
? status.trackers_status[url] | ||
: {}; | ||
var message = tracker.message ? tracker.message : ''; | ||
if (!message && 'message' in tracker_status) { | ||
message = tracker_status['message']; | ||
} | ||
var tracker_data = { | ||
tracker: url, | ||
status: | ||
'status' in tracker_status | ||
? tracker_status['status'] | ||
: '', | ||
peers: | ||
url in status.trackers_peers | ||
? status.trackers_peers[url] | ||
: 0, | ||
message: message, | ||
}; | ||
if (this.trackers[tracker.url]) { | ||
var record = store.getById(tracker.url); | ||
record.beginEdit(); | ||
for (var k in tracker_data) { | ||
if (record.get(k) != tracker_data[k]) { | ||
record.set(k, tracker_data[k]); | ||
} | ||
} | ||
record.endEdit(); | ||
} else { | ||
this.trackers[tracker.url] = 1; | ||
newTrackers.push( | ||
new Deluge.data.Tracker(tracker_data, tracker.url) | ||
); | ||
} | ||
addresses[tracker.url] = 1; | ||
}, | ||
this | ||
); | ||
store.add(newTrackers); | ||
|
||
// Remove any trackers that should not be left in the store. | ||
store.each(function (record) { | ||
if (!addresses[record.id] && !this.constantRows[record.id]) { | ||
store.remove(record); | ||
delete this.trackers[record.id]; | ||
} | ||
}, this); | ||
store.commitChanges(); | ||
|
||
var sortState = store.getSortState(); | ||
if (!sortState) return; | ||
store.sort(sortState.field, sortState.direction); | ||
}, | ||
}); | ||
})(); |