Author: Lars Michelsen <[email protected]>
Date: Wed Nov 20 18:35:34 2013 +0100
Committer: Lars Michelsen <[email protected]>
Commit-Date: Wed Nov 20 18:35:34 2013 +0100
Better error handling on non-expected response on overview page
---
share/frontend/nagvis-js/js/ajax.js | 13 +++++++------
share/frontend/nagvis-js/js/frontend.js | 6 +++---
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/share/frontend/nagvis-js/js/ajax.js
b/share/frontend/nagvis-js/js/ajax.js
index 65830de..7b33a90 100644
--- a/share/frontend/nagvis-js/js/ajax.js
+++ b/share/frontend/nagvis-js/js/ajax.js
@@ -199,6 +199,8 @@ function getAsyncRequest(sUrl, bCacheable, callback,
callbackParams) {
frontendMessageRemove('httpError');
frontendMessageRemove('ajaxError');
+
+ var oResponse = null;
if(oRequest.responseText.replace(/\s+/g, '').length === 0) {
if(bCacheable)
updateQueryCache(sUrl, iNow, '');
@@ -211,15 +213,14 @@ function getAsyncRequest(sUrl, bCacheable, callback,
callbackParams) {
} else {
// Handle responses of json objects - including eval
and wron response
// error handling and clearing
- var oResponse = handleJsonResponse(sUrl, responseText);
-
- if(oResponse)
- callback(oResponse, callbackParams);
- oResponse = null;
+ oResponse = handleJsonResponse(sUrl, responseText);
+ if(oResponse === '')
+ oResponse = null;
}
-
responseText = null;
}
+ callback(oResponse, callbackParams);
+ oResponse = null;
}
}
diff --git a/share/frontend/nagvis-js/js/frontend.js
b/share/frontend/nagvis-js/js/frontend.js
index 4ceddb2..fe18979 100644
--- a/share/frontend/nagvis-js/js/frontend.js
+++ b/share/frontend/nagvis-js/js/frontend.js
@@ -1317,12 +1317,12 @@ g_processed_maps = 0;
/**
* Adds a single map to the overview map list
*/
-function addOverviewMap(map_conf) {
+function addOverviewMap(map_conf, map_name) {
g_processed_maps += 1;
// Exit this function on invalid call
if(map_conf === null || map_conf.length != 1) {
- eventlog("worker", "warning", "addOverviewMap: Invalid call - maybe
broken ajax response");
+ eventlog("worker", "warning", "addOverviewMap: Invalid call - maybe
broken ajax response ("+map_name+")");
if (g_processed_maps == g_map_names.length)
finishOverviewMaps();
return false;
@@ -1452,7 +1452,7 @@ function getOverviewMaps() {
for (var i = 0, len = g_map_names.length; i < len; i++) {
getAsyncRequest(oGeneralProperties.path_server+'?mod=Overview&act=getObjectStates'
+ '&i[]=map-' + escapeUrlValues(g_map_names[i]) +
getViewParams(),
- false, addOverviewMap);
+ false, addOverviewMap, g_map_names[i]);
}
}
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing
conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins