[Nagvis-checkins] SF.net Git: nagvis: #119 Problem with second state change on overview page for th
Brought to you by:
larsi-
From: lars <la...@us...> - 2009-09-23 19:26:35
|
Module: nagvis Branch: nagvis-1.4 Commit: 84952a08527dd5fb3f076a366ca611f328d555f4 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis/nagvis;a=commit;h=84952a08527dd5fb3f076a366ca611f328d555f4 Author: Lars Michelsen <la...@ve...> Date: Wed Sep 23 21:21:48 2009 +0200 #119 Problem with second state change on overview page for the same object is fixed --- nagvis/nagvis/includes/js/frontend.js | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/nagvis/nagvis/includes/js/frontend.js b/nagvis/nagvis/includes/js/frontend.js index c579903..d3783c8 100644 --- a/nagvis/nagvis/includes/js/frontend.js +++ b/nagvis/nagvis/includes/js/frontend.js @@ -464,8 +464,11 @@ function updateObjects(aMapObjectInformations, aObjs, sType) { // output could have changed since last update). Basically this is only // needed for gadgets and/or labels with [output] or [perfdata] macros if(!aObjs[intIndex].stateChanged() && aObjs[intIndex].outputOrPerfdataChanged()) { - // Reparse object to map - aObjs[intIndex].parse(); + // Reparse object to map (only for maps!) + // No else for overview here, senseless! + if(sType === 'map') { + aObjs[intIndex].parse(); + } } // Detect state changes and do some actions @@ -480,7 +483,13 @@ function updateObjects(aMapObjectInformations, aObjs, sType) { if(sType === 'map') { aObjs[intIndex].parse(); } else if(sType === 'overview') { - aObjs[intIndex].parsedObject = aObjs[intIndex].parsedObject.parentNode.replaceChild(aObjs[intIndex].parseOverview(), aObjs[intIndex].parsedObject); + // Reparsing the object on index page. + // replaceChild seems not to work in all cases so workaround it + var oOld = aObjs[intIndex].parsedObject; + aObjs[intIndex].parsedObject = aObjs[intIndex].parsedObject.parentNode.insertBefore(aObjs[intIndex].parseOverview(), aObjs[intIndex].parsedObject); + aObjs[intIndex].parsedObject.parentNode.removeChild(oOld); + + oOld = null; } /** |