From 112bcd7255e30867a9a96295a563759876e20390 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Thu, 25 Dec 2008 16:20:30 +0000 Subject: [PATCH] - Add notification in WebUI when qBittorrent is unreachable --- src/webui/css/style.css | 5 +++++ src/webui/index.html | 2 +- src/webui/scripts/client.js | 10 ++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/webui/css/style.css b/src/webui/css/style.css index a7c3f4499..f672936c3 100644 --- a/src/webui/css/style.css +++ b/src/webui/css/style.css @@ -44,6 +44,11 @@ h2 { border-bottom: 1px solid #bbb; } +#error_div { + color: #f00; + font-weight: bold; +} + h4 { font-size: 11px; } diff --git a/src/webui/index.html b/src/webui/index.html index c120d6bb9..b357b1bbb 100644 --- a/src/webui/index.html +++ b/src/webui/index.html @@ -64,7 +64,7 @@ -
+
  • Downloads
  • diff --git a/src/webui/scripts/client.js b/src/webui/scripts/client.js index 2b9d61fa2..4751d922f 100644 --- a/src/webui/scripts/client.js +++ b/src/webui/scripts/client.js @@ -78,7 +78,13 @@ window.addEvent('domready', function(){ var request = new Request.JSON({ url: url, method: 'get', - onComplete: function(events) { + onFailure: function() { + $('error_div').set('html', 'qBittorrent client is not reachable'); + waiting=false; + ajaxfn.delay(2000); + }, + onSuccess: function(events) { + $('error_div').set('html', ''); if(events){ // Add new torrents or update them unfinished_hashes = myTable.getRowIds(); @@ -145,7 +151,7 @@ window.addEvent('domready', function(){ }); } waiting=false; - ajaxfn.delay(1000); + ajaxfn.delay(2000); } }).send(); }