Author:   Lars Michelsen <[email protected]>
Date:     Wed Nov  7 10:32:18 2012 +0100
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Wed Nov  7 10:32:18 2012 +0100

Hiding HTTP status error messages automatically on next successful request

---

 ChangeLog                           |    3 +++
 share/frontend/nagvis-js/js/ajax.js |    8 +++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f98217e..5a54c89 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,7 @@
 1.7.4
+Frontend:
+  * Hiding HTTP status error messages automatically on next successful request
+
 Geomap:
   * New option source_type to configure a csv file or the used backend as
     datasource. In backend mode, the backend used on the map must support
diff --git a/share/frontend/nagvis-js/js/ajax.js 
b/share/frontend/nagvis-js/js/ajax.js
index ee8c556..e55d9d8 100644
--- a/share/frontend/nagvis-js/js/ajax.js
+++ b/share/frontend/nagvis-js/js/ajax.js
@@ -123,7 +123,7 @@ function ajaxError(e) {
 function httpError(text) {
     frontendMessage({'type': 'CRITICAL',
                      'title': 'HTTP error',
-                     'message': text});
+                     'message': text}, 0, 'httpError');
 }
 
 function phpError(text) {
@@ -182,16 +182,22 @@ function getAsyncRequest(sUrl, bCacheable, callback, 
callbackParams) {
                 // If something different is received, something must be 
wrong. Raise a whole
                 // screen message in this case.
                 if(oRequest.status != 200) {
+                    if(oRequest.status == 0) {
+                        return; // silently skip status code 0 (occurs e.g. 
during page switching)
+                    }
+
                     var msg = 'HTTP-Response: ' + oRequest.status;
                     if(oRequest.responseText != '') {
                         msg += ' - Body: ' + oRequest.responseText;
                     } else if(oRequest.status == 500) {
                         msg += ' - Internal Server Error (Take a look at the 
apache error log for details.)'
                     }
+
                     httpError(msg);
                     return;
                 }
 
+                frontendMessageRemove('httpError');
                 frontendMessageRemove('ajaxError');
                 if(oRequest.responseText.replace(/\s+/g, '').length === 0) {
                     if(bCacheable)


------------------------------------------------------------------------------
LogMeIn Central: Instant, anywhere, Remote PC access and management.
Stay in control, update software, and manage PCs from one command center
Diagnose problems and improve visibility into emerging IT issues
Automate, monitor and manage. Do more in less time with Central
http://p.sf.net/sfu/logmein12331_d2d
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to