mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-02 22:48:40 +00:00
improve behaviour when webserver goes away
This commit is contained in:
parent
619092aee0
commit
5b0f93ba72
1 changed files with 24 additions and 0 deletions
|
@ -98,10 +98,19 @@ deluge.ui = {
|
||||||
}, this, {single: true});
|
}, this, {single: true});
|
||||||
|
|
||||||
this.update = this.update.createDelegate(this);
|
this.update = this.update.createDelegate(this);
|
||||||
|
this.checkConnection = this.checkConnection.createDelegate(this);
|
||||||
|
|
||||||
this.originalTitle = document.title;
|
this.originalTitle = document.title;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
checkConnection: function() {
|
||||||
|
deluge.client.web.connected({
|
||||||
|
success: this.onConnectionSuccess,
|
||||||
|
failure: this.onConnectionError,
|
||||||
|
scope: this
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
update: function() {
|
update: function() {
|
||||||
var filters = deluge.sidebar.getFilterStates();
|
var filters = deluge.sidebar.getFilterStates();
|
||||||
deluge.client.web.update_ui(Deluge.Keys.Grid, filters, {
|
deluge.client.web.update_ui(Deluge.Keys.Grid, filters, {
|
||||||
|
@ -112,6 +121,18 @@ deluge.ui = {
|
||||||
deluge.details.update();
|
deluge.details.update();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onConnectionError: function(error) {
|
||||||
|
|
||||||
|
},
|
||||||
|
|
||||||
|
onConnectionSuccess: function(result) {
|
||||||
|
deluge.statusbar.setStatus('Connection restored');
|
||||||
|
clearInterval(this.checking);
|
||||||
|
if (!result) {
|
||||||
|
deluge.connectionManager.show();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
onUpdateError: function(error) {
|
onUpdateError: function(error) {
|
||||||
if (this.errorCount == 2) {
|
if (this.errorCount == 2) {
|
||||||
Ext.MessageBox.show({
|
Ext.MessageBox.show({
|
||||||
|
@ -120,6 +141,9 @@ deluge.ui = {
|
||||||
buttons: Ext.MessageBox.OK,
|
buttons: Ext.MessageBox.OK,
|
||||||
icon: Ext.MessageBox.ERROR
|
icon: Ext.MessageBox.ERROR
|
||||||
});
|
});
|
||||||
|
deluge.events.fire('disconnect');
|
||||||
|
deluge.statusbar.setStatus('Lost connection to webserver');
|
||||||
|
this.checking = setInterval(this.checkConnection, 2000);
|
||||||
}
|
}
|
||||||
this.errorCount++;
|
this.errorCount++;
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue