parent
3365201011
commit
24b094a04a
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
## 2.0.4 (WIP)
|
## 2.0.4 (WIP)
|
||||||
|
|
||||||
|
### WebUI
|
||||||
|
|
||||||
|
- Handle torrent add failures
|
||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
|
|
||||||
- Add How-to guides about services.
|
- Add How-to guides about services.
|
||||||
|
|
|
@ -235,6 +235,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
||||||
this.url = new Deluge.add.UrlWindow();
|
this.url = new Deluge.add.UrlWindow();
|
||||||
this.url.on('beforeadd', this.onTorrentBeforeAdd, this);
|
this.url.on('beforeadd', this.onTorrentBeforeAdd, this);
|
||||||
this.url.on('add', this.onTorrentAdd, this);
|
this.url.on('add', this.onTorrentAdd, this);
|
||||||
|
this.url.on('addfailed', this.onTorrentAddFailed, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.optionsPanel.form.getDefaults();
|
this.optionsPanel.form.getDefaults();
|
||||||
|
@ -258,6 +259,7 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
||||||
url: deluge.config.base + 'upload',
|
url: deluge.config.base + 'upload',
|
||||||
waitMsg: _('Uploading your torrent...'),
|
waitMsg: _('Uploading your torrent...'),
|
||||||
success: this.onUploadSuccess,
|
success: this.onUploadSuccess,
|
||||||
|
failure: this.onUploadFailure,
|
||||||
scope: this,
|
scope: this,
|
||||||
torrentIds: torrentIds,
|
torrentIds: torrentIds,
|
||||||
});
|
});
|
||||||
|
@ -283,6 +285,19 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
||||||
this.fileUploadForm.reset();
|
this.fileUploadForm.reset();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onUploadFailure: function(form, action) {
|
||||||
|
this.hide();
|
||||||
|
Ext.MessageBox.show({
|
||||||
|
title: _('Error'),
|
||||||
|
msg: _('Failed to upload torrent'),
|
||||||
|
buttons: Ext.MessageBox.OK,
|
||||||
|
modal: false,
|
||||||
|
icon: Ext.MessageBox.ERROR,
|
||||||
|
iconCls: 'x-deluge-icon-error',
|
||||||
|
});
|
||||||
|
this.fireEvent('addfailed', this.torrentId);
|
||||||
|
},
|
||||||
|
|
||||||
onGotInfo: function(info, obj, response, request) {
|
onGotInfo: function(info, obj, response, request) {
|
||||||
info.filename = request.options.filename;
|
info.filename = request.options.filename;
|
||||||
torrentId = request.options.torrentId;
|
torrentId = request.options.torrentId;
|
||||||
|
@ -315,6 +330,14 @@ Deluge.add.AddWindow = Ext.extend(Deluge.add.Window, {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onTorrentAddFailed: function(torrentId) {
|
||||||
|
var store = this.list.getStore();
|
||||||
|
var torrentRecord = store.getById(torrentId);
|
||||||
|
if (torrentRecord) {
|
||||||
|
store.remove(torrentRecord);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onUrl: function(button, event) {
|
onUrl: function(button, event) {
|
||||||
this.url.show();
|
this.url.show();
|
||||||
},
|
},
|
||||||
|
|
|
@ -72,6 +72,7 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, {
|
||||||
} else {
|
} else {
|
||||||
deluge.client.web.download_torrent_from_url(url, cookies, {
|
deluge.client.web.download_torrent_from_url(url, cookies, {
|
||||||
success: this.onDownload,
|
success: this.onDownload,
|
||||||
|
failure: this.onDownloadFailed,
|
||||||
scope: this,
|
scope: this,
|
||||||
torrentId: torrentId,
|
torrentId: torrentId,
|
||||||
});
|
});
|
||||||
|
@ -85,12 +86,25 @@ Deluge.add.UrlWindow = Ext.extend(Deluge.add.Window, {
|
||||||
onDownload: function(filename, obj, resp, req) {
|
onDownload: function(filename, obj, resp, req) {
|
||||||
deluge.client.web.get_torrent_info(filename, {
|
deluge.client.web.get_torrent_info(filename, {
|
||||||
success: this.onGotInfo,
|
success: this.onGotInfo,
|
||||||
|
failure: this.onDownloadFailed,
|
||||||
scope: this,
|
scope: this,
|
||||||
filename: filename,
|
filename: filename,
|
||||||
torrentId: req.options.torrentId,
|
torrentId: req.options.torrentId,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onDownloadFailed: function(obj, resp, req) {
|
||||||
|
Ext.MessageBox.show({
|
||||||
|
title: _('Error'),
|
||||||
|
msg: _('Failed to download torrent'),
|
||||||
|
buttons: Ext.MessageBox.OK,
|
||||||
|
modal: false,
|
||||||
|
icon: Ext.MessageBox.ERROR,
|
||||||
|
iconCls: 'x-deluge-icon-error',
|
||||||
|
});
|
||||||
|
this.fireEvent('addfailed', req.options.torrentId);
|
||||||
|
},
|
||||||
|
|
||||||
onGotInfo: function(info, obj, response, request) {
|
onGotInfo: function(info, obj, response, request) {
|
||||||
info['filename'] = request.options.filename;
|
info['filename'] = request.options.filename;
|
||||||
this.fireEvent('add', request.options.torrentId, info);
|
this.fireEvent('add', request.options.torrentId, info);
|
||||||
|
|
|
@ -17,7 +17,7 @@ Ext.ns('Deluge.add');
|
||||||
Deluge.add.Window = Ext.extend(Ext.Window, {
|
Deluge.add.Window = Ext.extend(Ext.Window, {
|
||||||
initComponent: function() {
|
initComponent: function() {
|
||||||
Deluge.add.Window.superclass.initComponent.call(this);
|
Deluge.add.Window.superclass.initComponent.call(this);
|
||||||
this.addEvents('beforeadd', 'add');
|
this.addEvents('beforeadd', 'add', 'addfailed');
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
../../CHANGELOG.md
|
../../CHANGELOG.md
|
||||||
|
|
Loading…
Reference in New Issue