diff options
author | Damien Churchill <damoxc@gmail.com> | 2010-05-03 02:14:51 +0100 |
---|---|---|
committer | Damien Churchill <damoxc@gmail.com> | 2010-05-03 02:14:51 +0100 |
commit | 5b0f93ba7217981c3e01886128a595c3ded339b7 (patch) | |
tree | d03c170a6405977a79ba49ad77f3f7e903c61dad | |
parent | 619092aee0eda4cc3c2b8ca002948f3ff0046b04 (diff) | |
download | deluge-5b0f93ba7217981c3e01886128a595c3ded339b7.tar.gz deluge-5b0f93ba7217981c3e01886128a595c3ded339b7.tar.bz2 deluge-5b0f93ba7217981c3e01886128a595c3ded339b7.zip |
improve behaviour when webserver goes away
-rw-r--r-- | deluge/ui/web/js/deluge-all/UI.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/deluge/ui/web/js/deluge-all/UI.js b/deluge/ui/web/js/deluge-all/UI.js index 15f788123..4f8efd823 100644 --- a/deluge/ui/web/js/deluge-all/UI.js +++ b/deluge/ui/web/js/deluge-all/UI.js @@ -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++; }, |