mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-24 02:11:06 +00:00
improve behaviour when webserver goes away
This commit is contained in:
parent
619092aee0
commit
5b0f93ba72
@ -98,10 +98,19 @@ deluge.ui = {
|
||||
}, this, {single: true});
|
||||
|
||||
this.update = this.update.createDelegate(this);
|
||||
this.checkConnection = this.checkConnection.createDelegate(this);
|
||||
|
||||
this.originalTitle = document.title;
|
||||
},
|
||||
|
||||
checkConnection: function() {
|
||||
deluge.client.web.connected({
|
||||
success: this.onConnectionSuccess,
|
||||
failure: this.onConnectionError,
|
||||
scope: this
|
||||
});
|
||||
},
|
||||
|
||||
update: function() {
|
||||
var filters = deluge.sidebar.getFilterStates();
|
||||
deluge.client.web.update_ui(Deluge.Keys.Grid, filters, {
|
||||
@ -112,6 +121,18 @@ deluge.ui = {
|
||||
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) {
|
||||
if (this.errorCount == 2) {
|
||||
Ext.MessageBox.show({
|
||||
@ -120,6 +141,9 @@ deluge.ui = {
|
||||
buttons: Ext.MessageBox.OK,
|
||||
icon: Ext.MessageBox.ERROR
|
||||
});
|
||||
deluge.events.fire('disconnect');
|
||||
deluge.statusbar.setStatus('Lost connection to webserver');
|
||||
this.checking = setInterval(this.checkConnection, 2000);
|
||||
}
|
||||
this.errorCount++;
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user