Module: nagvis Branch: master Commit: 8541c488251cbe05707a6a61a3c42f34b95a3cd0 URL: http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=8541c488251cbe05707a6a61a3c42f34b95a3cd0
Author: LaMi <[email protected]> Date: Sat Feb 13 17:44:34 2010 +0100 #117: Lines which are recognized or in a downtime have now different colors. The configured colors for warn/crit/... are lightened a bit when an object is in downtime or acked. --- .../frontend/nagvis-js/js/NagVisStatefulObject.js | 4 +++ share/frontend/nagvis-js/js/nagvis.js | 22 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 0 deletions(-) diff --git a/share/frontend/nagvis-js/js/NagVisStatefulObject.js b/share/frontend/nagvis-js/js/NagVisStatefulObject.js index 6c31437..8dfab90 100644 --- a/share/frontend/nagvis-js/js/NagVisStatefulObject.js +++ b/share/frontend/nagvis-js/js/NagVisStatefulObject.js @@ -502,10 +502,14 @@ var NagVisStatefulObject = NagVisObject.extend({ // Get the border color depending on ack/downtime if(this.conf.summary_problem_has_been_acknowledged == 1) { colorBorder = '#666666'; + + colorFill = lightenColor(colorFill, 100, 100, 100); } if(this.conf.summary_in_downtime == 1) { colorBorder = '#666666'; + + colorFill = lightenColor(colorFill, 100, 100, 100); } // Parse the line object diff --git a/share/frontend/nagvis-js/js/nagvis.js b/share/frontend/nagvis-js/js/nagvis.js index 8f86e41..d91e069 100644 --- a/share/frontend/nagvis-js/js/nagvis.js +++ b/share/frontend/nagvis-js/js/nagvis.js @@ -981,3 +981,25 @@ function drawNagVisTextbox(id, class, bgColor, borderColor, x, y, z, w, h, text, return oLabelDiv; } +/** + * Scales a hex color down/up + * + * @return String New and maybe scaled hex code + * @author Lars Michelsen <[email protected]> + */ +function lightenColor(code, rD, gD, bD) { + var r = parseInt(code.substring(1, 3), 16); + var g = parseInt(code.substring(3, 5), 16); + var b = parseInt(code.substring(5, 7), 16); + + r += rD; if (r > 255) r = 255; if (r < 0) r = 0; + g += gD; if (g > 255) g = 255; if (g < 0) g = 0; + b += bD; if (b > 255) b = 255; if (b < 0) b = 0; + + code = r.length < 2 ? "0"+r.toString(16) : r.toString(16); + code += g.length < 2 ? "0"+g.toString(16) : g.toString(16); + code += b.length < 2 ? "0"+b.toString(16) : b.toString(16); + + return "#" + code.toUpperCase(); +} + \ No newline at end of file ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev _______________________________________________ Nagvis-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagvis-checkins
