Author:   Lars Michelsen <[email protected]>
Date:     Sun Apr 17 18:12:07 2011 +0200
Committer:   Lars Michelsen <[email protected]>
Commit-Date: Sun Apr 17 18:12:07 2011 +0200

Now really fixed the map object removal code after config change

---

 .../frontend/nagvis-js/js/NagVisStatefulObject.js  |    2 +-
 share/frontend/nagvis-js/js/frontend.js            |   21 ++++++++++---------
 2 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/share/frontend/nagvis-js/js/NagVisStatefulObject.js 
b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
index 7658079..024ced2 100644
--- a/share/frontend/nagvis-js/js/NagVisStatefulObject.js
+++ b/share/frontend/nagvis-js/js/NagVisStatefulObject.js
@@ -198,7 +198,7 @@ var NagVisStatefulObject = NagVisObject.extend({
                        oLabel = null;
                }
     
-    // Append child to map and save reference in parsedObject
+               // Append child to map and save reference in parsedObject
                var oMap = doc.getElementById('map');
                if(oMap) {
                        this.parsedObject = oMap.appendChild(oContainerDiv);
diff --git a/share/frontend/nagvis-js/js/frontend.js 
b/share/frontend/nagvis-js/js/frontend.js
index 46c006f..37d90c6 100644
--- a/share/frontend/nagvis-js/js/frontend.js
+++ b/share/frontend/nagvis-js/js/frontend.js
@@ -1602,22 +1602,23 @@ function parseMap(iMapCfgAge, type, mapName) {
        // Only perform the reparsing actions when all information are there
        if(oPageProperties && oObjects) {
                // Remove all old objects
-               var a = 0;
-               do {
-                       if(oMapObjects[a] && typeof oMapObjects[a].remove === 
'function') {
+               var keys = Object.keys(oMapObjects);
+               for(var i = 0, len = keys.length; i < len; i++) {
+                   var obj = oMapObjects[keys[i]];
+                       if(obj && typeof obj.remove === 'function') {
                                // Remove parsed object from map
-                               oMapObjects[a].remove();
+                               obj.remove();
 
-                               if(!oMapObjects[a].bIsLocked)
+                               if(!obj.bIsLocked)
                                    iNumUnlocked -= 1;
                                
+                               obj = null;
+                               
                                // Remove element from object container
-                               delete oMapObjects[a];
-                       } else {
-                               a++;
+                               delete oMapObjects[keys[i]];
                        }
-               } while(oLength(oMapObjects) > a);
-               a = null;
+               }
+               keys = null;
                
                // Update timestamp for map configuration (No reparsing next 
time)
                oFileAges[mapName] = iMapCfgAge;


------------------------------------------------------------------------------
Benefiting from Server Virtualization: Beyond Initial Workload 
Consolidation -- Increasing the use of server virtualization is a top
priority.Virtualization can reduce costs, simplify management, and improve 
application availability and disaster protection. Learn more about boosting 
the value of server virtualization. http://p.sf.net/sfu/vmware-sfdev2dev
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to