Module: nagvis
Branch: master
Commit: 829785b39c6c9c926185f2ab2c44220a75e6d873
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=829785b39c6c9c926185f2ab2c44220a75e6d873

Author: Lars Michelsen <[email protected]>
Date:   Thu May  6 20:53:50 2010 +0200

Added code for blocking asynchronous updates while reparsing maps

---

 share/frontend/nagvis-js/js/frontend.js |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/share/frontend/nagvis-js/js/frontend.js 
b/share/frontend/nagvis-js/js/frontend.js
index 94f9e22..abf8fd3 100644
--- a/share/frontend/nagvis-js/js/frontend.js
+++ b/share/frontend/nagvis-js/js/frontend.js
@@ -33,6 +33,7 @@ var oHoverTemplates = {};
 var oHoverUrls = {};
 var oContextTemplates = {};
 var oAutomapParams = {};
+var bBlockUpdates = false;
 
 /**
  * submitFrontendForm()
@@ -1579,6 +1580,9 @@ function automapParse(mapName) {
  */
 function parseMap(iMapCfgAge, mapName) {
        var bReturn = false;
+
+       // Block updates of the current map
+       bBlockUpdates = true;
        
        // Get new map/object information from ajax handler
        var oMapBasics = getMapProperties(mapName);
@@ -1646,6 +1650,9 @@ function parseMap(iMapCfgAge, mapName) {
        oMapBasics = null;
        oMapObjects = null;
        
+       // Updates are allowed again
+       bBlockUpdates = false;
+       
        return bReturn;
 }
 
@@ -1660,6 +1667,9 @@ function parseMap(iMapCfgAge, mapName) {
 function parseAutomap(iMapCfgAge, mapName) {
        var bReturn = false;
        
+       // Block updates of the current map
+       bBlockUpdates = true;
+       
        // Get new map/object information from ajax handler
        var oMapBasics = getAutomapProperties(mapName);
        var oMapObjects = 
getSyncRequest(oGeneralProperties.path_server+'?mod=AutoMap&act=getAutomapObjects&show='+mapName+getAutomapParams());
@@ -1726,6 +1736,9 @@ function parseAutomap(iMapCfgAge, mapName) {
        oMapBasics = null;
        oMapObjects = null;
        
+       // Updates are allowed again
+       bBlockUpdates = false;
+       
        return bReturn;
 }
 
@@ -1886,6 +1899,14 @@ function workerInitialize(iCount, sType, sIdentifier) {
 function handleUpdate(o, aParams) {
        var sType = aParams[0];
        var bStateChanged = false;
+
+       // Stop processing these informations when the current view should not 
be
+       // updated at the moment e.g. when reparsing the map after a changed 
mapcfg
+       if(bBlockUpdates) {
+               eventlog("ajax", "info", "Throwing new object information away 
since the view is blocked");
+               return false;
+       }
+
        if(o.length > 0)
                bStateChanged = updateObjects(o, aMapObjects, sType);
        


------------------------------------------------------------------------------
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to